[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56518] branches/soc-2011-tomato: Merging r56470 through r56517 from trunk into soc-2011-tomato

Sergey Sharybin sergey.vfx at gmail.com
Mon May 6 20:44:47 CEST 2013


Revision: 56518
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56518
Author:   nazgul
Date:     2013-05-06 18:44:46 +0000 (Mon, 06 May 2013)
Log Message:
-----------
Merging r56470 through r56517 from trunk into soc-2011-tomato

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56470
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56517

Modified Paths:
--------------
    branches/soc-2011-tomato/doc/python_api/rst/include__bmesh.rst
    branches/soc-2011-tomato/doc/python_api/rst/info_quickstart.rst
    branches/soc-2011-tomato/intern/cycles/blender/blender_mesh.cpp
    branches/soc-2011-tomato/intern/cycles/blender/blender_util.h
    branches/soc-2011-tomato/intern/cycles/kernel/closure/bsdf_microfacet.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_camera.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_differential.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_displace.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_emission.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_path.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_shader.h
    branches/soc-2011-tomato/intern/cycles/kernel/kernel_subsurface.h
    branches/soc-2011-tomato/intern/ghost/intern/GHOST_WindowCocoa.mm
    branches/soc-2011-tomato/release/datafiles/preview_cycles.blend
    branches/soc-2011-tomato/release/datafiles/startup.blend
    branches/soc-2011-tomato/release/scripts/freestyle/style_modules/shaders.py
    branches/soc-2011-tomato/release/scripts/modules/nodeitems_utils.py
    branches/soc-2011-tomato/release/scripts/startup/bl_ui/properties_paint_common.py
    branches/soc-2011-tomato/release/scripts/templates_py/operator_uv.py
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_DerivedMesh.h
    branches/soc-2011-tomato/source/blender/blenkernel/BKE_modifier.h
    branches/soc-2011-tomato/source/blender/blenkernel/intern/DerivedMesh.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/displist.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/mesh.c
    branches/soc-2011-tomato/source/blender/blenkernel/intern/tracking.c
    branches/soc-2011-tomato/source/blender/blenlib/intern/math_geom.c
    branches/soc-2011-tomato/source/blender/blenlib/intern/string.c
    branches/soc-2011-tomato/source/blender/blenlib/intern/string_cursor_utf8.c
    branches/soc-2011-tomato/source/blender/blenloader/intern/readfile.c
    branches/soc-2011-tomato/source/blender/collada/AnimationExporter.cpp
    branches/soc-2011-tomato/source/blender/collada/SceneExporter.cpp
    branches/soc-2011-tomato/source/blender/collada/collada_utils.cpp
    branches/soc-2011-tomato/source/blender/compositor/intern/COM_InputSocket.h
    branches/soc-2011-tomato/source/blender/editors/include/ED_view3d.h
    branches/soc-2011-tomato/source/blender/editors/interface/interface_handlers.c
    branches/soc-2011-tomato/source/blender/editors/interface/interface_layout.c
    branches/soc-2011-tomato/source/blender/editors/interface/interface_templates.c
    branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_knife.c
    branches/soc-2011-tomato/source/blender/editors/mesh/editmesh_loopcut.c
    branches/soc-2011-tomato/source/blender/editors/object/object_add.c
    branches/soc-2011-tomato/source/blender/editors/object/object_modifier.c
    branches/soc-2011-tomato/source/blender/editors/sculpt_paint/paint_ops.c
    branches/soc-2011-tomato/source/blender/editors/space_node/drawnode.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_edit.c
    branches/soc-2011-tomato/source/blender/editors/space_view3d/view3d_fly.c
    branches/soc-2011-tomato/source/blender/editors/uvedit/uvedit_unwrap_ops.c
    branches/soc-2011-tomato/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h
    branches/soc-2011-tomato/source/blender/freestyle/intern/system/PythonInterpreter.h
    branches/soc-2011-tomato/source/blender/gpu/intern/gpu_material.c
    branches/soc-2011-tomato/source/blender/imbuf/intern/jpeg.c
    branches/soc-2011-tomato/source/blender/makesdna/DNA_tracking_types.h
    branches/soc-2011-tomato/source/blender/makesrna/RNA_access.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_access.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_internal.h
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_main_api.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_mesh.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_object_api.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_texture.c
    branches/soc-2011-tomato/source/blender/makesrna/intern/rna_wm.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_array.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_bevel.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_boolean_util.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_dynamicpaint.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_edgesplit.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_mirror.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_ocean.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_particleinstance.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_screw.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_skin.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_solidify.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_subsurf.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_triangulate.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_uvproject.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_uvwarp.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_weightvgedit.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_weightvgmix.c
    branches/soc-2011-tomato/source/blender/modifiers/intern/MOD_weightvgproximity.c
    branches/soc-2011-tomato/source/blender/nodes/NOD_static_types.h
    branches/soc-2011-tomato/source/blender/python/bmesh/bmesh_py_ops_call.c
    branches/soc-2011-tomato/source/blender/python/bmesh/bmesh_py_types.c
    branches/soc-2011-tomato/source/blender/quicktime/apple/qtkit_export.m
    branches/soc-2011-tomato/source/blender/render/intern/source/imagetexture.c
    branches/soc-2011-tomato/source/blender/render/intern/source/render_texture.c
    branches/soc-2011-tomato/source/blender/windowmanager/intern/wm_event_system.c
    branches/soc-2011-tomato/source/creator/blender.map
    branches/soc-2011-tomato/source/gameengine/Expressions/ListValue.cpp
    branches/soc-2011-tomato/source/gameengine/Expressions/Value.cpp
    branches/soc-2011-tomato/source/gameengine/Expressions/Value.h
    branches/soc-2011-tomato/source/gameengine/Ketsji/KX_GameObject.cpp

Property Changed:
----------------
    branches/soc-2011-tomato/
    branches/soc-2011-tomato/source/blender/editors/interface/interface.c
    branches/soc-2011-tomato/source/blender/editors/space_outliner/


Property changes on: branches/soc-2011-tomato
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-56469
   + /branches/ge_harmony:42255,42279-42282,42286,42302,42338,42349,42616,42620,42698-42699,42739,42753,42773-42774,42832,44568,44597-44598,44793-44794
/branches/soc-2011-cucumber:37517,38166-38167,38177,38179-38180,38187,38242,38384,38387,38403-38404,38407,38968,38970,38973,39045,40845,42997-42998,43439
/branches/vgroup_modifiers:38694-39989
/trunk/blender:36831-56517

Modified: branches/soc-2011-tomato/doc/python_api/rst/include__bmesh.rst
===================================================================
--- branches/soc-2011-tomato/doc/python_api/rst/include__bmesh.rst	2013-05-06 17:59:02 UTC (rev 56517)
+++ branches/soc-2011-tomato/doc/python_api/rst/include__bmesh.rst	2013-05-06 18:44:46 UTC (rev 56518)
@@ -47,7 +47,7 @@
 Example Script
 --------------
 
-.. literalinclude:: ../../../release/scripts/templates/bmesh_simple.py
+.. literalinclude:: ../../../release/scripts/templates_py/bmesh_simple.py
 
 
 Stand-Alone Module

Modified: branches/soc-2011-tomato/doc/python_api/rst/info_quickstart.rst
===================================================================
--- branches/soc-2011-tomato/doc/python_api/rst/info_quickstart.rst	2013-05-06 17:59:02 UTC (rev 56517)
+++ branches/soc-2011-tomato/doc/python_api/rst/info_quickstart.rst	2013-05-06 18:44:46 UTC (rev 56518)
@@ -285,7 +285,7 @@
 Example Operator
 ----------------
 
-.. literalinclude:: ../../../release/scripts/templates/operator_simple.py
+.. literalinclude:: ../../../release/scripts/templates_py/operator_simple.py
 
 Once this script runs, ``SimpleOperator`` is registered with Blender and can be called from the operator search popup or added to the toolbar.
 
@@ -318,7 +318,7 @@
 
 Panels register themselves as a class, like an operator. Notice the extra **bl_** variables used to set the context they display in.
 
-.. literalinclude:: ../../../release/scripts/templates/ui_panel_simple.py
+.. literalinclude:: ../../../release/scripts/templates_py/ui_panel_simple.py
 
 To run the script:
 

Modified: branches/soc-2011-tomato/intern/cycles/blender/blender_mesh.cpp
===================================================================
--- branches/soc-2011-tomato/intern/cycles/blender/blender_mesh.cpp	2013-05-06 17:59:02 UTC (rev 56517)
+++ branches/soc-2011-tomato/intern/cycles/blender/blender_mesh.cpp	2013-05-06 18:44:46 UTC (rev 56518)
@@ -336,7 +336,7 @@
 		size_t i = 0;
 
 		for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v)
-			generated[i++] = get_float3(v->co())*size - loc;
+			generated[i++] = get_float3(v->undeformed_co())*size - loc;
 	}
 }
 
@@ -435,7 +435,8 @@
 	mesh_synced.insert(mesh);
 
 	/* create derived mesh */
-	BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview);
+	bool need_undeformed = mesh->need_attribute(scene, ATTR_STD_GENERATED);
+	BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, need_undeformed);
 	PointerRNA cmesh = RNA_pointer_get(&b_ob_data.ptr, "cycles");
 
 	vector<Mesh::Triangle> oldtriangle = mesh->triangles;
@@ -507,7 +508,7 @@
 		return;
 
 	/* get derived mesh */
-	BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview);
+	BL::Mesh b_mesh = object_to_mesh(b_data, b_ob, b_scene, true, !preview, false);
 
 	if(b_mesh) {
 		BL::Mesh::vertices_iterator v;

Modified: branches/soc-2011-tomato/intern/cycles/blender/blender_util.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/blender/blender_util.h	2013-05-06 17:59:02 UTC (rev 56517)
+++ branches/soc-2011-tomato/intern/cycles/blender/blender_util.h	2013-05-06 18:44:46 UTC (rev 56518)
@@ -39,9 +39,9 @@
 
 CCL_NAMESPACE_BEGIN
 
-static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL::Scene scene, bool apply_modifiers, bool render)
+static inline BL::Mesh object_to_mesh(BL::BlendData data, BL::Object object, BL::Scene scene, bool apply_modifiers, bool render, bool calc_undeformed)
 {
-	return data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, true);
+	return data.meshes.new_from_object(scene, object, apply_modifiers, (render)? 2: 1, true, calc_undeformed);
 }
 
 static inline void colorramp_to_array(BL::ColorRamp ramp, float4 *data, int size)

Modified: branches/soc-2011-tomato/intern/cycles/kernel/closure/bsdf_microfacet.h
===================================================================
--- branches/soc-2011-tomato/intern/cycles/kernel/closure/bsdf_microfacet.h	2013-05-06 17:59:02 UTC (rev 56517)
+++ branches/soc-2011-tomato/intern/cycles/kernel/closure/bsdf_microfacet.h	2013-05-06 18:44:46 UTC (rev 56518)
@@ -46,7 +46,7 @@
 {
 	float ag = sc->data0;
 
-	float m_ag = clamp(ag, 1e-3f, 1.0f);
+	float m_ag = clamp(ag, 0.0f, 1.0f);
 
 	sc->data0 = m_ag;
 	sc->type = CLOSURE_BSDF_MICROFACET_GGX_ID;
@@ -59,7 +59,7 @@
 	float ag = sc->data0;
 	float eta = sc->data1;
 
-	float m_ag = clamp(ag, 1e-3f, 1.0f);
+	float m_ag = clamp(ag, 0.0f, 1.0f);
 	float m_eta = eta;
 
 	sc->data0 = m_ag;
@@ -78,11 +78,12 @@
 
 __device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
 {
-	float m_ag = sc->data0;
+	float m_ag = max(sc->data0, 1e-4f);
 	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
 	float3 N = sc->N;
 
-	if(m_refractive) return make_float3 (0, 0, 0);
+	if(m_refractive || m_ag <= 1e-4f)
+		return make_float3 (0, 0, 0);
 	float cosNO = dot(N, I);
 	float cosNI = dot(N, omega_in);
 	if(cosNI > 0 && cosNO > 0) {
@@ -114,12 +115,13 @@
 
 __device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
 {
-	float m_ag = sc->data0;
+	float m_ag = max(sc->data0, 1e-4f);
 	float m_eta = sc->data1;
 	int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
 	float3 N = sc->N;
 
-	if(!m_refractive) return make_float3 (0, 0, 0);
+	if(!m_refractive || m_ag <= 1e-4f)
+		return make_float3 (0, 0, 0);
 	float cosNO = dot(N, I);
 	float cosNI = dot(N, omega_in);
 	if(cosNO <= 0 || cosNI >= 0)
@@ -176,26 +178,34 @@
 				// eq. 39 - compute actual reflected direction
 				*omega_in = 2 * cosMO * m - I;
 				if(dot(Ng, *omega_in) > 0) {
-					// microfacet normal is visible to this ray
-					// eq. 33
-					float cosThetaM2 = cosThetaM * cosThetaM;
-					float cosThetaM4 = cosThetaM2 * cosThetaM2;
-					float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-					// eq. 24
-					float pm = D * cosThetaM;
-					// convert into pdf of the sampled direction
-					// eq. 38 - but see also:
-					// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
-					*pdf = pm * 0.25f / cosMO;
-					// eval BRDF*cosNI
-					float cosNI = dot(N, *omega_in);
-					// eq. 34: now calculate G1(i,m) and G1(o,m)
-					float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-					float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
-					float G = G1o * G1i;
-					// eq. 20: (F*G*D)/(4*in*on)
-					float out = (G * D) * 0.25f / cosNO;
-					*eval = make_float3(out, out, out);
+					if (m_ag <= 1e-4f) {
+						// some high number for MIS
+						*pdf = 1e6f;
+						*eval = make_float3(1e6f, 1e6f, 1e6f);
+					}
+					else {
+						// microfacet normal is visible to this ray
+						// eq. 33
+						float cosThetaM2 = cosThetaM * cosThetaM;
+						float cosThetaM4 = cosThetaM2 * cosThetaM2;
+						float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
+						// eq. 24
+						float pm = D * cosThetaM;
+						// convert into pdf of the sampled direction
+						// eq. 38 - but see also:
+						// eq. 17 in http://www.graphics.cornell.edu/~bjw/wardnotes.pdf
+						*pdf = pm * 0.25f / cosMO;
+						// eval BRDF*cosNI
+						float cosNI = dot(N, *omega_in);
+						// eq. 34: now calculate G1(i,m) and G1(o,m)
+						float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
+						float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
+						float G = G1o * G1i;
+						// eq. 20: (F*G*D)/(4*in*on)
+						float out = (G * D) * 0.25f / cosNO;
+						*eval = make_float3(out, out, out);
+					}
+
 #ifdef __RAY_DIFFERENTIALS__
 					*domega_in_dx = (2 * dot(m, dIdx)) * m - dIdx;
 					*domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy;
@@ -224,27 +234,35 @@
 				*domega_in_dx = dTdx;
 				*domega_in_dy = dTdy;
 #endif
-				// eq. 33
-				float cosThetaM2 = cosThetaM * cosThetaM;
-				float cosThetaM4 = cosThetaM2 * cosThetaM2;
-				float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
-				// eq. 24
-				float pm = D * cosThetaM;
-				// eval BRDF*cosNI
-				float cosNI = dot(N, *omega_in);
-				// eq. 34: now calculate G1(i,m) and G1(o,m)
-				float G1o = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNO * cosNO) / (cosNO * cosNO)));
-				float G1i = 2 / (1 + safe_sqrtf(1 + alpha2 * (1 - cosNI * cosNI) / (cosNI * cosNI))); 
-				float G = G1o * G1i;
-				// eq. 21
-				float cosHI = dot(m, *omega_in);
-				float cosHO = dot(m, I);
-				float Ht2 = m_eta * cosHI + cosHO;
-				Ht2 *= Ht2;
-				float out = (fabsf(cosHI * cosHO) * (m_eta * m_eta) * (G * D)) / (cosNO * Ht2);
-				// eq. 38 and eq. 17
-				*pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
-				*eval = make_float3(out, out, out);
+
+				if (m_ag <= 1e-4f) {
+					// some high number for MIS
+					*pdf = 1e6f;
+					*eval = make_float3(1e6f, 1e6f, 1e6f);
+				}
+				else {
+					// eq. 33
+					float cosThetaM2 = cosThetaM * cosThetaM;
+					float cosThetaM4 = cosThetaM2 * cosThetaM2;
+					float D = alpha2 / (M_PI_F * cosThetaM4 * (alpha2 + tanThetaM2) * (alpha2 + tanThetaM2));
+					// eq. 24
+					float pm = D * cosThetaM;
+					// eval BRDF*cosNI
+					float cosNI = dot(N, *omega_in);
+					// eq. 34: now calculate G1(i,m) and G1(o,m)

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list