Revision: 17161
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=17161
Author:   broken
Date:     2008-10-22 03:31:46 +0200 (Wed, 22 Oct 2008)

Log Message:
-----------
Point Density:

Replaced 'Sharp' falloff with 'Soft'. This falloff type has 
a variable softness, and can get some quite smooth results. 
It can be useful to get smooth transitions in density when 
you're using particles on a large scale:

http://mke3.net/blender/devel/rendering/volumetrics/pd_falloff_soft.jpg

Also removed 'angular velocity' turbulence source - it
wasn't doing anything useful atm

Modified Paths:
--------------
    branches/sim_physics/source/blender/blenkernel/intern/texture.c
    branches/sim_physics/source/blender/blenloader/intern/readfile.c
    branches/sim_physics/source/blender/makesdna/DNA_texture_types.h
    branches/sim_physics/source/blender/render/intern/source/pointdensity.c
    branches/sim_physics/source/blender/src/buttons_shading.c

Modified: branches/sim_physics/source/blender/blenkernel/intern/texture.c
===================================================================
--- branches/sim_physics/source/blender/blenkernel/intern/texture.c     
2008-10-22 00:26:19 UTC (rev 17160)
+++ branches/sim_physics/source/blender/blenkernel/intern/texture.c     
2008-10-22 01:31:46 UTC (rev 17161)
@@ -875,6 +875,7 @@
        pd= MEM_callocN(sizeof(PointDensity), "pointdensity");
        pd->radius = 0.3f;
        pd->falloff_type = TEX_PD_FALLOFF_STD;
+       pd->falloff_softness = 2.0;
        pd->source = TEX_PD_PSYS;
        pd->point_tree = NULL;
        pd->point_data = NULL;

Modified: branches/sim_physics/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/sim_physics/source/blender/blenloader/intern/readfile.c    
2008-10-22 00:26:19 UTC (rev 17160)
+++ branches/sim_physics/source/blender/blenloader/intern/readfile.c    
2008-10-22 01:31:46 UTC (rev 17161)
@@ -7908,6 +7908,8 @@
                                tex->pd->noise_fac = 1.0f;
                                tex->pd->noise_influence = TEX_PD_NOISE_STATIC;
                        }
+                       if (tex->pd->falloff_softness < 1.0f)
+                               tex->pd->falloff_softness = 2.0f;
                }
                
        }

Modified: branches/sim_physics/source/blender/makesdna/DNA_texture_types.h
===================================================================
--- branches/sim_physics/source/blender/makesdna/DNA_texture_types.h    
2008-10-22 00:26:19 UTC (rev 17160)
+++ branches/sim_physics/source/blender/makesdna/DNA_texture_types.h    
2008-10-22 01:31:46 UTC (rev 17161)
@@ -131,9 +131,10 @@
        short flag;
 
        short falloff_type;
+       float falloff_softness;
        float radius;
        short source;
-       short pdpad[3];
+       short pdpad;
 
        struct Object *object;  /* for 'Object' or 'Particle system' type - 
source object */
        short psys_cache_space;         /* cache points in worldspace, object 
space, ... ? */
@@ -425,7 +426,7 @@
 /* falloff_type */
 #define TEX_PD_FALLOFF_STD             0
 #define TEX_PD_FALLOFF_SMOOTH  1
-#define TEX_PD_FALLOFF_SHARP   2
+#define TEX_PD_FALLOFF_SOFT            2
 #define TEX_PD_FALLOFF_CONSTANT        3
 #define TEX_PD_FALLOFF_ROOT            4
 
@@ -441,8 +442,7 @@
 /* noise_influence */
 #define TEX_PD_NOISE_STATIC            0
 #define TEX_PD_NOISE_VEL               1
-#define TEX_PD_NOISE_ANGVEL            2
-#define TEX_PD_NOISE_TIME              3
+#define TEX_PD_NOISE_TIME              2
 
 #endif
 

Modified: 
branches/sim_physics/source/blender/render/intern/source/pointdensity.c
===================================================================
--- branches/sim_physics/source/blender/render/intern/source/pointdensity.c     
2008-10-22 00:26:19 UTC (rev 17160)
+++ branches/sim_physics/source/blender/render/intern/source/pointdensity.c     
2008-10-22 01:31:46 UTC (rev 17161)
@@ -107,10 +107,6 @@
                                pd->point_data[i*3 + 0] = state.vel[0];
                                pd->point_data[i*3 + 1] = state.vel[1];
                                pd->point_data[i*3 + 2] = state.vel[2];
-                       } else if (pd->noise_influence == TEX_PD_NOISE_ANGVEL) {
-                               pd->point_data[i*3 + 0] = state.ave[0];
-                               pd->point_data[i*3 + 1] = state.ave[1];
-                               pd->point_data[i*3 + 2] = state.ave[2];
                        }
                }
        }
@@ -252,6 +248,7 @@
     float squared_radius;
     float *point_data;
        float *vec;
+       float softness;
     short falloff_type;   
 } PointDensityRangeData;
 
@@ -265,8 +262,8 @@
                density = dist;
        else if (pdr->falloff_type == TEX_PD_FALLOFF_SMOOTH)
                density = 3.0f*dist*dist - 2.0f*dist*dist*dist;
-       else if (pdr->falloff_type == TEX_PD_FALLOFF_SHARP)
-               density = dist*dist;
+       else if (pdr->falloff_type == TEX_PD_FALLOFF_SOFT)
+               density = pow(dist, pdr->softness);
        else if (pdr->falloff_type == TEX_PD_FALLOFF_CONSTANT)
                density = pdr->squared_radius;
        else if (pdr->falloff_type == TEX_PD_FALLOFF_ROOT)
@@ -302,6 +299,7 @@
        pdr.point_data = pd->point_data;
        pdr.falloff_type = pd->falloff_type;
        pdr.vec = vec;
+       pdr.softness = pd->falloff_softness;
        noise_fac = pd->noise_fac * 0.5f;       /* better default */
        
        if (pd->flag & TEX_PD_TURBULENCE) {
@@ -329,13 +327,16 @@
 
        texres->tin = density;
 
-       //texres->tr = vec[0];
-       //texres->tg = vec[1];
-       //texres->tb = vec[2];
        
+       
+       BRICONT;
+       
        return TEX_INT;
        
        /*
+       texres->tr = vec[0];
+       texres->tg = vec[1];
+       texres->tb = vec[2];
        BRICONTRGB;
        
        texres->ta = 1.0;

Modified: branches/sim_physics/source/blender/src/buttons_shading.c
===================================================================
--- branches/sim_physics/source/blender/src/buttons_shading.c   2008-10-22 
00:26:19 UTC (rev 17160)
+++ branches/sim_physics/source/blender/src/buttons_shading.c   2008-10-22 
01:31:46 UTC (rev 17161)
@@ -738,7 +738,7 @@
        short yco=PANEL_YMAX;
        
        block= uiNewBlock(&curarea->uiblocks, "texture_panel_pointdensity", 
UI_EMBOSS, UI_HELV, curarea->win);
-       if(uiNewPanel(curarea, block, "Point Density", "Texture", PANELX, 
PANELY, PANELW, PANELH)==0) return;
+       if(uiNewPanel(curarea, block, "Point Density", "Texture", PANELX, 
PANELY, PANELW, PANELH+25)==0) return;
        uiSetButLock(tex->id.lib!=0, ERROR_LIBDATA_MESSAGE);
        
        if(tex->pd==NULL) {
@@ -758,8 +758,14 @@
                
                uiDefBut(block, LABEL, B_NOP, "Falloff:",
                        X2CLM1, yco-=BUTH, BUTW2, BUTH, 0, 0, 0, 0, 0, "");     
-               uiDefButS(block, MENU, B_REDR, "Standard %x0|Smooth %x1|Sharp 
%x2|Constant %x3|Root %x4",
+               uiBlockBeginAlign(block);
+               uiDefButS(block, MENU, B_REDR, "Standard %x0|Smooth %x1|Soft 
%x2|Constant %x3|Root %x4",
                        X2CLM1, yco-=BUTH, BUTW2, BUTH, &pd->falloff_type, 0.0, 
0.0, 0, 0, "Falloff type");
+               if (pd->falloff_type == TEX_PD_FALLOFF_SOFT) {
+                       uiDefButF(block, NUM, B_REDR, "Softness: ",
+                               X2CLM1, yco-=BUTH, BUTW2, BUTH, 
&(pd->falloff_softness), 1.0, 1024.0, 10, 2, "The intensity of the falloff");
+               }
+               uiBlockEndAlign(block);
                
                yco -= YSPACE;
                
@@ -782,7 +788,7 @@
                        yco -= YSPACE;
 
                        if (pd->source == TEX_PD_PSYS) {
-                               uiDefButS(block, MENU, B_REDR, "Noise Influence 
%t|Static %x0|Velocity %x1|Angular Velocity %x2",
+                               uiDefButS(block, MENU, B_REDR, "Noise Influence 
%t|Static %x0|Velocity %x1",
                                        X2CLM1, yco-=BUTH, BUTW2, BUTH, 
&(pd->noise_influence), 0.0, 0.0, 0, 0, "Noise Influence");
                        }
                }


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to