[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27937] branches/render25: Render Branch: More work on displacement/subdivision.

Brecht Van Lommel brecht at blender.org
Thu Apr 1 22:03:21 CEST 2010


Revision: 27937
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27937
Author:   blendix
Date:     2010-04-01 22:03:21 +0200 (Thu, 01 Apr 2010)

Log Message:
-----------
Render Branch: More work on displacement/subdivision.

* Displacement textures are now filtered with derivatives.
* Render subdivision is now a scene level setting, which is automatically
  applied to all objects with displacement.
* Subdivision rate is now a scene level setting with per object relative
  rates for more/less detail.
* The unsubdivided low resolution mesh for raytracing is now displaced as
  well to match the high resolution better.
* Render previews now also do render subdivision.
* All texture coordinates should now work for displacement.

Implementation:
* Change shadeinput uv values to be interpolation weights, simplifies code
  and is easier to understand for me.
* Shadeinput texture coordinates and material setup for displacement now
  uses same code instead of it's own.
* Autosmooth and displacement are now moved from mesh to general postprocess.
* Autosmooth now uses orco's to stay stable under animation, which avoids
  some hacky code to preserve original normals and works for more cases.
* Stress texture coordinates are now supported for nurbs/curves/metaballs too.

Still to do:
* Control over resolution for raytracing/shadows.
* Stitching up grid cracks.
* Smooth derivatives across boundaries.
* Automatic displacement bounds.

Modified Paths:
--------------
    branches/render25/release/scripts/ui/properties_object.py
    branches/render25/release/scripts/ui/properties_render.py
    branches/render25/source/blender/blenkernel/BKE_blender.h
    branches/render25/source/blender/blenkernel/intern/depsgraph.c
    branches/render25/source/blender/blenkernel/intern/object.c
    branches/render25/source/blender/blenkernel/intern/scene.c
    branches/render25/source/blender/blenlib/BLI_math_vector.h
    branches/render25/source/blender/blenlib/intern/math_vector.c
    branches/render25/source/blender/blenloader/intern/readfile.c
    branches/render25/source/blender/editors/render/render_preview.c
    branches/render25/source/blender/makesdna/DNA_object_types.h
    branches/render25/source/blender/makesdna/DNA_scene_types.h
    branches/render25/source/blender/makesrna/intern/rna_object.c
    branches/render25/source/blender/makesrna/intern/rna_scene.c
    branches/render25/source/blender/render/extern/include/RE_shader_ext.h
    branches/render25/source/blender/render/intern/include/object.h
    branches/render25/source/blender/render/intern/include/object_mesh.h
    branches/render25/source/blender/render/intern/source/bake.c
    branches/render25/source/blender/render/intern/source/convertblender.c
    branches/render25/source/blender/render/intern/source/diskocclusion.c
    branches/render25/source/blender/render/intern/source/object.c
    branches/render25/source/blender/render/intern/source/object_displace.c
    branches/render25/source/blender/render/intern/source/object_mesh.c
    branches/render25/source/blender/render/intern/source/object_particle.c
    branches/render25/source/blender/render/intern/source/object_subdivide.c
    branches/render25/source/blender/render/intern/source/path.c
    branches/render25/source/blender/render/intern/source/rayshade.c
    branches/render25/source/blender/render/intern/source/shadeinput.c
    branches/render25/source/blender/render/intern/source/texture_stack.c

Modified: branches/render25/release/scripts/ui/properties_object.py
===================================================================
--- branches/render25/release/scripts/ui/properties_object.py	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/release/scripts/ui/properties_object.py	2010-04-01 20:03:21 UTC (rev 27937)
@@ -228,23 +228,11 @@
         layout = self.layout
 
         ob = context.object
-        wide_ui = context.region.width > narrowui
 
-        split = layout.split()
-        col = split.column()
+        layout.prop(ob, "pass_index")
+        layout.prop(ob, "displacement_bound")
+        layout.prop(ob, "relative_subdivision_rate")
 
-        col.prop(ob, "pass_index")
-        col.separator()
-
-        col.prop(ob, "render_subdivide")
-        col.prop(ob, "shading_rate")
-
-        if wide_ui:
-            col = split.column()
-
-        col.prop(ob, "displacement_bound")
-        col.prop(ob, "ray_resolution")
-
 class OBJECT_PT_duplication(ObjectButtonsPanel):
     bl_label = "Duplication"
 
@@ -318,7 +306,7 @@
         row.prop(ob, "slow_parent")
         row.active = (ob.parent is not None)
         col.prop(ob, "time_offset", text="Offset")
-		
+
         # XXX: these are still used for a few curve-related tracking features
         if wide_ui:
             col = split.column()

Modified: branches/render25/release/scripts/ui/properties_render.py
===================================================================
--- branches/render25/release/scripts/ui/properties_render.py	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/release/scripts/ui/properties_render.py	2010-04-01 20:03:21 UTC (rev 27937)
@@ -188,15 +188,19 @@
         split = layout.split()
 
         col = split.column()
-        col.prop(rd, "render_textures", text="Textures")
-        col.prop(rd, "render_shadows", text="Shadows")
-        col.prop(rd, "render_sss", text="Subsurface Scattering")
-        col.prop(rd, "render_envmaps", text="Environment Map")
+        col.prop(rd, "use_textures")
+        col.prop(rd, "use_shadows")
+        col.prop(rd, "use_sss")
+        col.prop(rd, "use_envmaps")
+        col.prop(rd, "use_subdivision")
+        row = col.row()
+        row.active = rd.use_subdivision
+        row.prop(rd, "subdivision_rate", text="Rate")
 
         if wide_ui:
             col = split.column()
-        col.prop(rd, "render_raytracing", text="Ray Tracing")
-        col.prop(rd, "render_raytrace_all")
+        col.prop(rd, "use_raytracing")
+        col.prop(rd, "use_raytrace_all")
         col.prop(rd, "color_management")
         col.prop(rd, "alpha_mode", text="Alpha")
 
@@ -235,7 +239,7 @@
         sub.active = rd.use_compositing
         sub.prop(rd, "free_image_textures")
         sub = col.column()
-        sub.active = rd.render_raytracing
+        sub.active = rd.use_raytracing
         sub.label(text="Acceleration structure:")
         sub.prop(rd, "raytrace_structure", text="")
         if rd.raytrace_structure == 'OCTREE':

Modified: branches/render25/source/blender/blenkernel/BKE_blender.h
===================================================================
--- branches/render25/source/blender/blenkernel/BKE_blender.h	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/blenkernel/BKE_blender.h	2010-04-01 20:03:21 UTC (rev 27937)
@@ -45,7 +45,7 @@
 struct Main;
 	
 #define BLENDER_VERSION			252
-#define BLENDER_SUBVERSION		10
+#define BLENDER_SUBVERSION		11
 
 #define BLENDER_MINVERSION		250
 #define BLENDER_MINSUBVERSION	0

Modified: branches/render25/source/blender/blenkernel/intern/depsgraph.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/depsgraph.c	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/blenkernel/intern/depsgraph.c	2010-04-01 20:03:21 UTC (rev 27937)
@@ -2237,6 +2237,8 @@
 				for(go= group->gobject.first; go; go= go->next) {
 					if(ELEM5(go->ob->type, OB_MESH, OB_CURVE, OB_SURF, OB_FONT, OB_MBALL))
 						go->ob->recalc |= OB_RECALC_DATA;
+					if(go->ob->proxy_from)
+						go->ob->recalc |= OB_RECALC_OB;
 				}
 				
 				group->id.flag &= ~LIB_DOIT;

Modified: branches/render25/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/object.c	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/blenkernel/intern/object.c	2010-04-01 20:03:21 UTC (rev 27937)
@@ -1043,8 +1043,7 @@
 	ob->pc_ids.first = ob->pc_ids.last = NULL;
 
 	/* render */
-	ob->shadingrate= 1.0f;
-	ob->rayresolution= 1.0f;
+	ob->subdivision_rate= 1.0f;
 	ob->displacebound= 0.1f;
 	
 	/* Animation Visualisation defaults */

Modified: branches/render25/source/blender/blenkernel/intern/scene.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/scene.c	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/blenkernel/intern/scene.c	2010-04-01 20:03:21 UTC (rev 27937)
@@ -316,7 +316,7 @@
 	sce= alloc_libblock(&G.main->scene, ID_SCE, name);
 	sce->lay= 1;
 	
-	sce->r.mode= R_GAMMA|R_OSA|R_SHADOW|R_SSS|R_ENVMAP|R_RAYTRACE;
+	sce->r.mode= R_GAMMA|R_OSA|R_SHADOW|R_SSS|R_ENVMAP|R_RAYTRACE|R_SUBDIVISION;
 	sce->r.cfra= 1;
 	sce->r.sfra= 1;
 	sce->r.efra= 250;

Modified: branches/render25/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- branches/render25/source/blender/blenlib/BLI_math_vector.h	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/blenlib/BLI_math_vector.h	2010-04-01 20:03:21 UTC (rev 27937)
@@ -112,6 +112,7 @@
 void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3]);
 void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float w[4]);
 void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const float t);
+void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3]);
 
 void mid_v3_v3v3(float r[3], float a[3], float b[3]);
 

Modified: branches/render25/source/blender/blenlib/intern/math_vector.c
===================================================================
--- branches/render25/source/blender/blenlib/intern/math_vector.c	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/blenlib/intern/math_vector.c	2010-04-01 20:03:21 UTC (rev 27937)
@@ -83,6 +83,14 @@
 	p[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2] + v4[2]*w[3];
 }
 
+void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3])
+{
+	p[0] = v1[0]*w[0] + v2[0]*w[1] + v3[0]*w[2];
+	p[1] = v1[1]*w[0] + v2[1]*w[1] + v3[1]*w[2];
+	p[2] = v1[2]*w[0] + v2[2]*w[1] + v3[2]*w[2];
+	p[3] = v1[3]*w[0] + v2[3]*w[1] + v3[3]*w[2];
+}
+
 void mid_v3_v3v3(float *v, float *v1, float *v2)
 {
 	v[0]= 0.5f*(v1[0] + v2[0]);

Modified: branches/render25/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/render25/source/blender/blenloader/intern/readfile.c	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/blenloader/intern/readfile.c	2010-04-01 20:03:21 UTC (rev 27937)
@@ -6453,12 +6453,23 @@
 	}
 
 	for(ob= main->object.first; ob; ob= ob->id.next) {
-		ob->rayresolution= 1.0f;
 		ob->displacebound= 0.1f;
 		ob->shadingrate= 1.0f;
 	}
 }
 
+static void do_version_subdivision_250(FileData *fd, Library *lib, Main *main)
+{
+	Scene *sce;
+	Object *ob;
+
+	for(ob= main->object.first; ob; ob= ob->id.next)
+		ob->subdivision_rate= ob->shadingrate;
+
+	for(sce= main->scene.first; sce; sce= sce->id.next)
+		sce->r.subdivision_rate= 1.0f;
+}
+
 static void do_version_constraints_radians_degrees_250(ListBase *lb)
 {
 	bConstraint *con;
@@ -10752,6 +10763,8 @@
 
 	if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 10))
 		do_version_shading_sys_250(fd, lib, main);
+	if (main->versionfile < 252 || (main->versionfile == 252 && main->subversionfile < 11))
+		do_version_subdivision_250(fd, lib, main);
 
 	/* WATCH IT!!!: pointers from libdata have not been converted yet here! */
 	/* WATCH IT 2!: Userdef struct init has to be in editors/interface/resources.c! */

Modified: branches/render25/source/blender/editors/render/render_preview.c
===================================================================
--- branches/render25/source/blender/editors/render/render_preview.c	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/editors/render/render_preview.c	2010-04-01 20:03:21 UTC (rev 27937)
@@ -312,6 +312,8 @@
 					sce->r.mode |= R_RAYTRACE;
 				if(mat->sss_flag & MA_DIFF_SSS)
 					sce->r.mode |= R_SSS;
+				if(scene->r.mode & R_SUBDIVISION)
+					sce->r.mode |= R_SUBDIVISION;
 				
 				/* turn off fake shadows if needed */
 				/* this only works in a specific case where the preview.blend contains
@@ -356,7 +358,7 @@
 				}
 			}
 			else {
-				sce->r.mode &= ~(R_OSA|R_RAYTRACE|R_SSS);
+				sce->r.mode &= ~(R_OSA|R_RAYTRACE|R_SSS|R_SUBDIVISION);
 			}
 			
 			for(base= sce->base.first; base; base= base->next) {

Modified: branches/render25/source/blender/makesdna/DNA_object_types.h
===================================================================
--- branches/render25/source/blender/makesdna/DNA_object_types.h	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/makesdna/DNA_object_types.h	2010-04-01 20:03:21 UTC (rev 27937)
@@ -190,9 +190,9 @@
 	float dupfacesca;	/* dupliface scale */
 
 	float displacebound;		/* displacement bound */
-	float shadingrate;
-	float rayresolution;
-	char renderflag, pad[3];
+	float shadingrate;			/* will remove this */
+	float subdivision_rate;		/* subdivision rate */
+	float pad;
 	
 	ListBase prop;
 	ListBase sensors;

Modified: branches/render25/source/blender/makesdna/DNA_scene_types.h
===================================================================
--- branches/render25/source/blender/makesdna/DNA_scene_types.h	2010-04-01 19:48:29 UTC (rev 27936)
+++ branches/render25/source/blender/makesdna/DNA_scene_types.h	2010-04-01 20:03:21 UTC (rev 27937)
@@ -392,8 +392,10 @@
 	int integrator;
 	int path_samples;
 	int raytrace_all;
-	int pad;
 
+	/* subdivision */
+	float subdivision_rate;
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list