Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-02-13 14:18:08 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-02-13 14:18:08 +0300
commitb12793fb4ffc539a3b786604865c2d6aaf526453 (patch)
tree8c76f51964109f52694f4ddeec6e4d62a604cdd6 /source/blender/blenkernel/intern
parent31922633670f03ceb2e963984e418fecd1a59d40 (diff)
Render Simplification
This adds a few settings to control global render quality, for faster renders when tweaking lighting etc. The implementation is not so great, and this should really be part of a proper render profile and preset system. So for now it's a hidden Peach feature, enabled by setting rt to 1. Before the next release, I'll either remove or improve it. Settings are: - Maximum subsurf level - Child particles percentage - Maximum shadow map samples - AO and SSS quality factor
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/particle_system.c36
-rw-r--r--source/blender/blenkernel/intern/scene.c40
-rw-r--r--source/blender/blenkernel/intern/subsurf_ccg.c15
3 files changed, 73 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c
index c4ad6faadc2..a66d27c1b26 100644
--- a/source/blender/blenkernel/intern/particle_system.c
+++ b/source/blender/blenkernel/intern/particle_system.c
@@ -63,7 +63,6 @@
#include "BKE_bad_level_calls.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_displist.h"
-
#include "BKE_particle.h"
#include "BKE_global.h"
#include "BKE_utildefines.h"
@@ -77,6 +76,7 @@
#include "BKE_pointcache.h"
#include "BKE_mesh.h"
#include "BKE_modifier.h"
+#include "BKE_scene.h"
#include "BSE_headerbuttons.h"
@@ -145,15 +145,24 @@ static void alloc_particles(Object *ob, ParticleSystem *psys, int new_totpart)
psys->totpart=totpart;
}
-static int get_alloc_child_particles_tot(ParticleSystem *psys)
+static int get_psys_child_number(ParticleSystem *psys)
{
- int child_nbr;
+ int nbr;
if(!psys->part->childtype)
return 0;
- child_nbr= (psys->renderdata)? psys->part->ren_child_nbr: psys->part->child_nbr;
- return psys->totpart*child_nbr;
+ if(psys->renderdata) {
+ nbr= psys->part->ren_child_nbr;
+ return get_render_child_particle_number(&G.scene->r, nbr);
+ }
+ else
+ return psys->part->child_nbr;
+}
+
+static int get_psys_tot_child(ParticleSystem *psys)
+{
+ return psys->totpart*get_psys_child_number(psys);
}
static void alloc_child_particles(ParticleSystem *psys, int tot)
@@ -863,7 +872,7 @@ int psys_threads_init_distribution(ParticleThread *threads, DerivedMesh *finaldm
BLI_kdtree_balance(tree);
- totpart=get_alloc_child_particles_tot(psys);
+ totpart=get_psys_tot_child(psys);
cfrom=from=PART_FROM_FACE;
if(part->flag&PART_CHILD_SEAMS){
@@ -912,9 +921,9 @@ int psys_threads_init_distribution(ParticleThread *threads, DerivedMesh *finaldm
}
else{
/* no need to figure out distribution */
- int child_nbr= (psys->renderdata)? part->ren_child_nbr: part->child_nbr;
+ int child_nbr= get_psys_child_number(psys);
- totpart= get_alloc_child_particles_tot(psys);
+ totpart= get_psys_tot_child(psys);
alloc_child_particles(psys, totpart);
cpa=psys->child;
for(i=0; i<child_nbr; i++){
@@ -4219,9 +4228,8 @@ static void psys_update_path_cache(Object *ob, ParticleSystemModifierData *psmd,
ParticleSettings *part=psys->part;
ParticleEditSettings *pset=&G.scene->toolsettings->particle;
int distr=0,alloc=0;
- int child_nbr= (psys->renderdata)? part->ren_child_nbr: part->child_nbr;
- if((psys->part->childtype && psys->totchild != psys->totpart*child_nbr) || psys->recalc&PSYS_ALLOC)
+ if((psys->part->childtype && psys->totchild != get_psys_tot_child(psys)) || psys->recalc&PSYS_ALLOC)
alloc=1;
if(alloc || psys->recalc&PSYS_DISTR || (psys->vgroup[PSYS_VG_DENSITY] && (G.f & G_WEIGHTPAINT)))
@@ -4231,7 +4239,7 @@ static void psys_update_path_cache(Object *ob, ParticleSystemModifierData *psmd,
if(alloc)
alloc_particles(ob,psys,psys->totpart);
- if(get_alloc_child_particles_tot(psys)) {
+ if(get_psys_tot_child(psys)) {
/* don't generate children while computing the hair keys */
if(!(psys->part->type == PART_HAIR) || (psys->flag & PSYS_HAIR_DONE)) {
distribute_particles(ob,psys,PART_FROM_CHILD);
@@ -4386,7 +4394,6 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
int totpart,oldtotpart=0,p;
float disp, *vg_vel=0, *vg_tan=0, *vg_rot=0, *vg_size=0;
int init=0,distr=0,alloc=0;
- int child_nbr;
/*----start validity checks----*/
@@ -4457,8 +4464,7 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
else
totpart = psys->part->totpart;
- child_nbr= (psys->renderdata)? part->ren_child_nbr: part->child_nbr;
- if(oldtotpart != totpart || psys->recalc&PSYS_ALLOC || (psys->part->childtype && psys->totchild != psys->totpart*child_nbr))
+ if(oldtotpart != totpart || psys->recalc&PSYS_ALLOC || (psys->part->childtype && psys->totchild != get_psys_tot_child(psys)))
alloc = 1;
if(alloc || psys->recalc&PSYS_DISTR || (psys->vgroup[PSYS_VG_DENSITY] && (G.f & G_WEIGHTPAINT) && ob==OBACT))
@@ -4477,7 +4483,7 @@ static void system_step(Object *ob, ParticleSystem *psys, ParticleSystemModifier
if((psys->part->type == PART_HAIR) && !(psys->flag & PSYS_HAIR_DONE))
/* don't generate children while growing hair - waste of time */
psys_free_children(psys);
- else if(get_alloc_child_particles_tot(psys))
+ else if(get_psys_tot_child(psys))
distribute_particles(ob, psys, PART_FROM_CHILD);
}
initialize_all_particles(ob, psys, psmd);
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 74b86415c63..dd6dae84cc5 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -220,6 +220,11 @@ Scene *add_scene(char *name)
sce->r.stereomode = 1; // no stereo
+ sce->r.simplify_subsurf= 6;
+ sce->r.simplify_particles= 1.0f;
+ sce->r.simplify_shadowsamples= 16;
+ sce->r.simplify_aosss= 1.0f;
+
sce->toolsettings = MEM_callocN(sizeof(struct ToolSettings),"Tool Settings Struct");
sce->toolsettings->cornertype=1;
sce->toolsettings->degr = 90;
@@ -701,3 +706,38 @@ void sculpt_reset_curve(SculptData *sd)
curvemapping_changed(sd->cumap, 0);
}
+
+/* render simplification */
+
+int get_render_subsurf_level(RenderData *r, int lvl)
+{
+ if(G.rt == 1 && (r->mode & R_SIMPLIFY))
+ return MIN2(r->simplify_subsurf, lvl);
+ else
+ return lvl;
+}
+
+int get_render_child_particle_number(RenderData *r, int num)
+{
+ if(G.rt == 1 && (r->mode & R_SIMPLIFY))
+ return (int)(r->simplify_particles*num);
+ else
+ return num;
+}
+
+int get_render_shadow_samples(RenderData *r, int samples)
+{
+ if(G.rt == 1 && (r->mode & R_SIMPLIFY) && samples > 0)
+ return MIN2(r->simplify_shadowsamples, samples);
+ else
+ return samples;
+}
+
+float get_render_aosss_error(RenderData *r, float error)
+{
+ if(G.rt == 1 && (r->mode & R_SIMPLIFY))
+ return ((1.0f-r->simplify_aosss)*10.0f + 1.0f)*error;
+ else
+ return error;
+}
+
diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c
index 0b1563beced..9c9c4a884f4 100644
--- a/source/blender/blenkernel/intern/subsurf_ccg.c
+++ b/source/blender/blenkernel/intern/subsurf_ccg.c
@@ -42,16 +42,18 @@
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
#include "BKE_bad_level_calls.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_customdata.h"
+#include "BKE_DerivedMesh.h"
+#include "BKE_displist.h"
#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_mesh.h"
+#include "BKE_scene.h"
#include "BKE_subsurf.h"
-#include "BKE_displist.h"
-#include "BKE_DerivedMesh.h"
#include "BLI_blenlib.h"
#include "BLI_editVert.h"
@@ -2421,7 +2423,14 @@ struct DerivedMesh *subsurf_make_derived_from_derived(
useSubsurfUv, dm);
} else if(useRenderParams) {
/* Do not use cache in render mode. */
- CCGSubSurf *ss = _getSubSurf(NULL, smd->renderLevels, 0, 1, useSimple);
+ CCGSubSurf *ss;
+ int levels;
+
+ levels= get_render_subsurf_level(&G.scene->r, smd->renderLevels);
+ if(levels == 0)
+ return dm;
+
+ ss = _getSubSurf(NULL, levels, 0, 1, useSimple);
ss_sync_from_derivedmesh(ss, dm, vertCos, useSimple);