[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [52418] trunk/blender/intern/cycles: Cycles bugfix: AUTO wasn't working for Equisolid Fisheye lens

Dalai Felinto dfelinto at gmail.com
Wed Nov 21 02:07:35 CET 2012


Revision: 52418
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=52418
Author:   dfelinto
Date:     2012-11-21 01:07:30 +0000 (Wed, 21 Nov 2012)
Log Message:
-----------
Cycles bugfix: AUTO wasn't working for Equisolid Fisheye lens
Now one no longer needs to match the sensor dimensions with the render dimensions manually.

IMPORTANT NOTE: if you were using AUTO before with mismathing sensor aspect ratio (comparing to the render dimensions)
this will change your render! We can doversion this, but apart from Tube project I don't know if anyone else
is using this yet (part due to this bug and the only recently fixed 3dview preview aspect ratio).

That should help more artists to take advantage of this fantastic Blender feature.
It still helps to know the parameters of kwnown cameras/lens though.
For example:

Nikon DX2S with a 10.5mm fisheye can be set with:
Render resolution: 4288 x 2848
Sensor 23.7 x 15.70 (15.70 can be ommitted if AUTO is used as fit method)

Note: some cameras render different sizes according to the recording mode.
For example, a Red Scarlet in 5k (@12 fps) can render a full circular fisheye with a sigma 4.5 lens.
The same camera in the 30fps recording mode renders 4k in a cropped circular image.
So it's not only the resolution that changes, but the actual sensor been used.

So just keep in mind that the more information you have from the camera/lens you want to emulate the better.
Bug found at/patch written as a follow up of the BlenderPRO2012, patch reviewed by Brecht Van Lommel

Modified Paths:
--------------
    trunk/blender/intern/cycles/blender/blender_camera.cpp
    trunk/blender/intern/cycles/util/util_boundbox.h

Modified: trunk/blender/intern/cycles/blender/blender_camera.cpp
===================================================================
--- trunk/blender/intern/cycles/blender/blender_camera.cpp	2012-11-21 01:00:03 UTC (rev 52417)
+++ trunk/blender/intern/cycles/blender/blender_camera.cpp	2012-11-21 01:07:30 UTC (rev 52418)
@@ -279,8 +279,22 @@
 
 	/* sensor */
 	cam->sensorwidth = bcam->sensor_width;
-	cam->sensorheight = bcam->sensor_height;
 
+	if (bcam->type == CAMERA_PANORAMA &&
+	   (bcam->sensor_fit == BlenderCamera::AUTO &&
+		bcam->panorama_type == PANORAMA_FISHEYE_EQUISOLID)
+	   ) {
+
+		float sensor_aspectratio = bcam->pano_viewplane.width() /
+								  (bcam->pano_viewplane.height() *
+								  (aspectratio));
+
+		cam->sensorheight = bcam->sensor_width * sensor_aspectratio;
+	}
+	else {
+		cam->sensorheight = bcam->sensor_height;
+	}
+
 	/* clipping distances */
 	cam->nearclip = bcam->nearclip;
 	cam->farclip = bcam->farclip;

Modified: trunk/blender/intern/cycles/util/util_boundbox.h
===================================================================
--- trunk/blender/intern/cycles/util/util_boundbox.h	2012-11-21 01:00:03 UTC (rev 52417)
+++ trunk/blender/intern/cycles/util/util_boundbox.h	2012-11-21 01:07:30 UTC (rev 52418)
@@ -182,6 +182,10 @@
 		        bottom == other.bottom && top == other.top);
 	}
 
+	float width() {return right - left;}
+
+	float height() {return bottom - top;}
+
 	BoundBox2D operator*(float f) const
 	{
 		BoundBox2D result;




More information about the Bf-blender-cvs mailing list