Particles

=========

- Fix crash in particle transform with the particle system not editable.
- Particle child distribution and caching is now multithreaded.
- Child particles now have a separate Render Amount next to the existing
  Amount. The render amount particles are now only distributed and cached
  at render time, which should make editing with child particles faster.

- Two new options for diffuse strand shading:
	- Surface Diffuse: computes the strand normal taking the normal at
	  the surface into account.
	- Blending Distance: the distance in Blender units over which to
	  blend in the normal at the surface.
- Special strand rendering for more memory efficient and faster hair and
  grass. This is a work in progress, and has a number of known issues,
  don't report bugs to me for this feature yet.

More info:
http://www.blender.org/development/current-projects/changes-since-244/particles/
This commit is contained in:
Brecht Van Lommel
2007-12-04 13:57:28 +00:00
parent ebfedd20b2
commit 32a8b4f8e6
35 changed files with 3533 additions and 886 deletions

View File

@@ -887,7 +887,7 @@ void zbufshadeDA_tile(RenderPart *pa)
if(R.flag & R_HALO)
if(rl->layflag & SCE_LAY_HALO)
halo_tile(pa, rl->rectf, rl->lay);
/* transp layer */
if(R.flag & R_ZTRA) {
if(rl->layflag & SCE_LAY_ZTRA) {
@@ -904,7 +904,7 @@ void zbufshadeDA_tile(RenderPart *pa)
/* zbuffer transp only returns ztramask if there's solid rendered */
if(ztramask)
solidmask= make_solid_mask(pa);
if(ztramask && solidmask) {
unsigned short *sps= solidmask, *spz= ztramask;
unsigned short fullmask= (1<<R.osa)-1;
@@ -929,6 +929,47 @@ void zbufshadeDA_tile(RenderPart *pa)
if(ztramask) MEM_freeN(ztramask);
}
}
/* strand rendering */
if((rl->layflag & SCE_LAY_STRAND) && R.strandbufs.first) {
float *fcol, *scol;
unsigned short *strandmask, *solidmask= NULL; /* 16 bits, MAX_OSA */
int x;
/* allocate, but not free here, for asynchronous display of this rect in main thread */
rl->scolrect= MEM_callocN(4*sizeof(float)*pa->rectx*pa->recty, "strand layer");
/* swap for live updates, and it is used in zbuf.c!!! */
SWAP(float*, rl->scolrect, rl->rectf);
strandmask= zbuffer_strands_shade(&R, pa, rl, rl->rectf);
SWAP(float*, rl->scolrect, rl->rectf);
/* zbuffer strands only returns strandmask if there's solid rendered */
if(strandmask)
solidmask= make_solid_mask(pa);
if(strandmask && solidmask) {
unsigned short *sps= solidmask, *spz= strandmask;
unsigned short fullmask= (1<<R.osa)-1;
fcol= rl->rectf; scol= rl->scolrect;
for(x=pa->rectx*pa->recty; x>0; x--, scol+=4, fcol+=4, sps++, spz++) {
if(*sps == fullmask)
addAlphaOverFloat(fcol, scol);
else
addAlphaOverFloatMask(fcol, scol, *sps, *spz);
}
}
else {
fcol= rl->rectf; scol= rl->scolrect;
for(x=pa->rectx*pa->recty; x>0; x--, scol+=4, fcol+=4)
addAlphaOverFloat(fcol, scol);
}
if(solidmask) MEM_freeN(solidmask);
if(strandmask) MEM_freeN(strandmask);
}
/* sky before edge */
if(rl->layflag & SCE_LAY_SKY)
sky_tile(pa, rl->rectf);
@@ -1081,6 +1122,24 @@ void zbufshade_tile(RenderPart *pa)
}
}
}
/* strand rendering */
if((rl->layflag & SCE_LAY_STRAND) && R.strandbufs.first) {
float *fcol, *scol;
int x;
/* allocate, but not free here, for asynchronous display of this rect in main thread */
rl->scolrect= MEM_callocN(4*sizeof(float)*pa->rectx*pa->recty, "strand layer");
/* swap for live updates */
SWAP(float*, rl->scolrect, rl->rectf);
zbuffer_strands_shade(&R, pa, rl, rl->rectf);
SWAP(float*, rl->scolrect, rl->rectf);
fcol= rl->rectf; scol= rl->scolrect;
for(x=pa->rectx*pa->recty; x>0; x--, scol+=4, fcol+=4)
addAlphaOverFloat(fcol, scol);
}
/* sky before edge */
if(rl->layflag & SCE_LAY_SKY)
@@ -1594,7 +1653,7 @@ void add_halo_flare(Render *re)
mode= R.r.mode;
R.r.mode &= ~R_PANORAMA;
project_renderdata(&R, projectverto, 0, 0);
project_renderdata(&R, projectverto, 0, 0, 0);
for(a=0; a<R.tothalo; a++) {
if((a & 255)==0) har= R.bloha[a>>8];