[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [27212] branches/render25: Render Branch: some hacked code to test per tile subdivision, and

Brecht Van Lommel brecht at blender.org
Mon Mar 1 21:01:40 CET 2010


Revision: 27212
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=27212
Author:   blendix
Date:     2010-03-01 21:01:40 +0100 (Mon, 01 Mar 2010)

Log Message:
-----------
Render Branch: some hacked code to test per tile subdivision, and
how it would interact with GI, it has no catmull-clark, grid cracks,
slow performance, no shadow, sss, raytrace, etc. Example file:

http://users.pandora.be/blendix/snow_subdiv.blend
http://users.pandora.be/blendix/snow_subdiv.png

Modified Paths:
--------------
    branches/render25/release/scripts/ui/properties_object.py
    branches/render25/source/blender/blenkernel/BKE_blender.h
    branches/render25/source/blender/blenkernel/intern/object.c
    branches/render25/source/blender/blenloader/intern/readfile.c
    branches/render25/source/blender/makesdna/DNA_object_types.h
    branches/render25/source/blender/makesrna/intern/rna_object.c
    branches/render25/source/blender/render/extern/include/RE_shader_ext.h
    branches/render25/source/blender/render/intern/include/camera.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/include/part.h
    branches/render25/source/blender/render/intern/source/cache.c
    branches/render25/source/blender/render/intern/source/camera.c
    branches/render25/source/blender/render/intern/source/convertblender.c
    branches/render25/source/blender/render/intern/source/object.c
    branches/render25/source/blender/render/intern/source/object_mesh.c
    branches/render25/source/blender/render/intern/source/rendercore.c
    branches/render25/source/blender/render/intern/source/shadeinput.c
    branches/render25/source/blender/render/intern/source/texture_stack.c
    branches/render25/source/blender/render/intern/source/zbuf.c

Added Paths:
-----------
    branches/render25/source/blender/render/intern/source/object_subdivide.c

Modified: branches/render25/release/scripts/ui/properties_object.py
===================================================================
--- branches/render25/release/scripts/ui/properties_object.py	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/release/scripts/ui/properties_object.py	2010-03-01 20:01:40 UTC (rev 27212)
@@ -127,8 +127,6 @@
 
         col = split.column()
         col.prop(ob, "layers")
-        col.separator()
-        col.prop(ob, "pass_index")
 
         if wide_ui:
             col = split.column()
@@ -220,8 +218,30 @@
         col.prop(ob, "x_ray", text="X-Ray")
         col.prop(ob, "draw_transparent", text="Transparency")
 
-        layout.prop(ob, "displacement_bound")
+class OBJECT_PT_render(ObjectButtonsPanel):
+    bl_label = "Render"
 
+    def draw(self, context):
+        layout = self.layout
+
+        ob = context.object
+        wide_ui = context.region.width > narrowui
+
+        split = layout.split()
+        col = split.column()
+
+        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"
 
@@ -312,6 +332,7 @@
 bpy.types.register(OBJECT_PT_relations)
 bpy.types.register(OBJECT_PT_groups)
 bpy.types.register(OBJECT_PT_display)
+bpy.types.register(OBJECT_PT_render)
 bpy.types.register(OBJECT_PT_duplication)
 bpy.types.register(OBJECT_PT_animation)
 

Modified: branches/render25/source/blender/blenkernel/BKE_blender.h
===================================================================
--- branches/render25/source/blender/blenkernel/BKE_blender.h	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/source/blender/blenkernel/BKE_blender.h	2010-03-01 20:01:40 UTC (rev 27212)
@@ -42,8 +42,8 @@
 struct bContext;
 struct ReportList;
 
-#define BLENDER_VERSION			250
-#define BLENDER_SUBVERSION		17
+#define BLENDER_VERSION			251
+#define BLENDER_SUBVERSION		1
 
 #define BLENDER_MINVERSION		250
 #define BLENDER_MINSUBVERSION	0

Modified: branches/render25/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/render25/source/blender/blenkernel/intern/object.c	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/source/blender/blenkernel/intern/object.c	2010-03-01 20:01:40 UTC (rev 27212)
@@ -1046,6 +1046,11 @@
 	ob->fluidsimSettings = NULL;
 
 	ob->pc_ids.first = ob->pc_ids.last = NULL;
+
+	/* render */
+	ob->shadingrate= 1.0f;
+	ob->rayresolution= 1.0f;
+	ob->displacebound= 0.1f;
 	
 	/* Animation Visualisation defaults */
 	animviz_settings_init(&ob->avs);

Modified: branches/render25/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/render25/source/blender/blenloader/intern/readfile.c	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/source/blender/blenloader/intern/readfile.c	2010-03-01 20:01:40 UTC (rev 27212)
@@ -6386,6 +6386,7 @@
 	Tex *tex;
 	World *wo;
 	Lamp *la;
+	Object *ob;
 	
 	for(ma=main->mat.first; ma; ma=ma->id.next) {
 		if(ma->rampin_col==MA_RAMP_IN_ENERGY)
@@ -6411,6 +6412,12 @@
 		la->energy *= M_PI*la->dist;
 		la->falloff_smooth = 1.0f;
 	}
+
+	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_constraints_radians_degrees_250(ListBase *lb)
@@ -10588,9 +10595,6 @@
 		}
 	}
 
-	if (main->versionfile < 250 || (main->versionfile == 250 && main->subversionfile < 17))
-		do_version_shading_sys_250(fd, lib, main);
-
 	/* put 2.50 compatibility code here until next subversion bump */
 	{
 		Scene *sce;
@@ -10649,6 +10653,9 @@
 		} /* sequencer changes */
 	}
 
+	if (main->versionfile < 251 || (main->versionfile == 251 && main->subversionfile < 1))
+		do_version_shading_sys_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/makesdna/DNA_object_types.h
===================================================================
--- branches/render25/source/blender/makesdna/DNA_object_types.h	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/source/blender/makesdna/DNA_object_types.h	2010-03-01 20:01:40 UTC (rev 27212)
@@ -188,8 +188,11 @@
 	char empty_drawtype, pad1[3];
 	float empty_drawsize;
 	float dupfacesca;	/* dupliface scale */
+
 	float displacebound;		/* displacement bound */
-	float pad3;
+	float shadingrate;
+	float rayresolution;
+	char renderflag, pad[3];
 	
 	ListBase prop;
 	ListBase sensors;
@@ -404,6 +407,8 @@
 #define OB_BOUND_POLYT		5
 #define OB_BOUND_DYN_MESH   6
 
+/* renderflag */
+#define OB_RENDER_SUBDIVIDE	1
 
 /* **************** BASE ********************* */
 

Modified: branches/render25/source/blender/makesrna/intern/rna_object.c
===================================================================
--- branches/render25/source/blender/makesrna/intern/rna_object.c	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/source/blender/makesrna/intern/rna_object.c	2010-03-01 20:01:40 UTC (rev 27212)
@@ -1923,12 +1923,28 @@
 	RNA_def_property_ui_text(prop, "X-Ray", "Makes the object draw in front of others.");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL);
 
-	/* displacement bound */
+	/* Render */
 	prop= RNA_def_property(srna, "displacement_bound", PROP_FLOAT, PROP_TRANSLATION);
 	RNA_def_property_float_sdna(prop, NULL, "displacebound");
 	RNA_def_property_range(prop, 0, FLT_MAX);
 	RNA_def_property_ui_text(prop, "Displacement Bound", "Maximum displacement offset for rendering.");
 	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
+
+	prop= RNA_def_property(srna, "shading_rate", PROP_FLOAT, PROP_NONE);
+	RNA_def_property_float_sdna(prop, NULL, "shadingrate");
+	RNA_def_property_range(prop, 0.01f, 100.0f);
+	RNA_def_property_ui_text(prop, "Shading Rate", "Minimum polygon size for render subdivision, low renders more detail, 1.0 corresponds to approximately 1 polygon per pixel.");
+	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
+
+	prop= RNA_def_property(srna, "ray_resolution", PROP_FLOAT, PROP_FACTOR);
+	RNA_def_property_float_sdna(prop, NULL, "rayresolution");
+	RNA_def_property_ui_text(prop, "Ray Resolution", "Percentage of full resolution to raytracing, 0.0 corresponds to the lowest possible resolution, and 1.0 to full resolution.");
+	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
+
+	prop= RNA_def_property(srna, "render_subdivide", PROP_BOOLEAN, PROP_BOOLEAN);
+	RNA_def_property_boolean_sdna(prop, NULL, "renderflag", OB_RENDER_SUBDIVIDE);
+	RNA_def_property_ui_text(prop, "Render Subdivide", "Subdivide the object for rendering displacements, depending on the image resolution and specified shading rate.");
+	RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_update");
 	
 	/* Grease Pencil */
 	prop= RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);

Modified: branches/render25/source/blender/render/extern/include/RE_shader_ext.h
===================================================================
--- branches/render25/source/blender/render/extern/include/RE_shader_ext.h	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/source/blender/render/extern/include/RE_shader_ext.h	2010-03-01 20:01:40 UTC (rev 27212)
@@ -35,6 +35,8 @@
 /* this include is for shading and texture exports            */
 /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
 
+struct RenderPart;
+
 /* localized texture result data */
 /* note; tr tg tb ta has to remain in this order */
 typedef struct TexResult {
@@ -208,6 +210,7 @@
 		short do_preview;		/* for nodes, in previewrender */
 		short thread, sample;	/* sample: ShadeSample array index */
 		short nodes;			/* indicate node shading, temp hack to prevent recursion */
+		struct RenderPart *pa;
 		
 #ifdef RE_RAYCOUNTER
 		RayCounter raycounter;

Modified: branches/render25/source/blender/render/intern/include/camera.h
===================================================================
--- branches/render25/source/blender/render/intern/include/camera.h	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/source/blender/render/intern/include/camera.h	2010-03-01 20:01:40 UTC (rev 27212)
@@ -48,6 +48,8 @@
 void camera_halo_co_to_hoco(struct RenderCamera *cam, float hoco[4], float co[3]);
 void camera_matrix_co_to_hoco(float winmat[][4], float hoco[4], float co[3]);
 void camera_window_matrix(struct RenderCamera *cam, float winmat[][4]);
+void camera_window_rect_bounds(int winx, int winy, struct rcti *rect, float bounds[4]);
+void camera_hoco_to_zco(struct RenderCamera *cam, float zco[3], float hoco[4]);
 
 int camera_hoco_test_clip(float hoco[4]);
 

Modified: branches/render25/source/blender/render/intern/include/object.h
===================================================================
--- branches/render25/source/blender/render/intern/include/object.h	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/source/blender/render/intern/include/object.h	2010-03-01 20:01:40 UTC (rev 27212)
@@ -33,6 +33,7 @@
 struct Render;
 struct RenderCamera;
 struct RenderDB;
+struct RenderPart;
 
 /* Object */
 
@@ -59,6 +60,13 @@
 
 struct Material *give_render_material(struct Render *re, struct Object *ob, int nr);
 
+/* Adaptive Subdivision */
+
+void part_subdivide_objects(struct Render *re, struct RenderPart *pa);
+void part_subdivide_free(struct RenderPart *pa);
+struct ObjectInstanceRen *part_get_instance(struct RenderPart *pa, struct ObjectInstanceRen *obi);
+
+
 /* Structs */
 
 struct HaloRen;
@@ -132,6 +140,7 @@
 #define R_INSTANCEABLE		1
 #define R_LOWRES			2
 #define R_HIGHRES			4
+#define R_TEMP_COPY			8
 
 /* objectinstance->flag */
 #define R_DUPLI_TRANSFORMED	1

Modified: branches/render25/source/blender/render/intern/include/object_mesh.h
===================================================================
--- branches/render25/source/blender/render/intern/include/object_mesh.h	2010-03-01 19:18:56 UTC (rev 27211)
+++ branches/render25/source/blender/render/intern/include/object_mesh.h	2010-03-01 20:01:40 UTC (rev 27212)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list