Set foamOffset to
8- Make the following modifications to the foam_particleShape runtime expression (or copy/paste from the CDrom text file floatParticlesDone_expression.txt):
//float particles on ocean surface (runtime)
//get ocean height at current particle position vector $ppos = foam_particleShape.position; float $pu = $ppos.x; float $pv = $ppos.z;
float $cpoint[] = "colorAtPoint -u $pu -v $pv oceanShaderl"
//get ocean height at current particle position vector $ppos = foam_particleShape.position; float $pu = $ppos.x; float $pv = $ppos.z;
float $cpoint[] = "colorAtPoint -u $pu -v $pv oceanShaderl"
- add user offset to foam height float $py = $cpoint[0]+OceanWakeEmitter1.foamOffset;
- when particle position lower than ocean, stick to ocean if($ppos.y <= $py)
foam_particleShape.position = <<$pu, $py, $pv>>; //gradually increase gravity(faked) to counter turbulence //and make particles stick faster else if(foam_particleShape.ageNormalized >= 0.1) { vector $pvel = foam_particleShape.velocity;
foam_particleShape.velocity = <<$pvel.x, $pvel.y-1, $pvel.z>>; }
Expression changes explained: $py : Contains our new height offset;
ageNormalized : ageNormalized is the current age in percentage, relative to 1 (where 0 is birth, and 1 is death). ageNormalized is normally only available if you connected an arrayMapper to the particle at some point (usually by adding a ramp to a Per Particle attribute. In this case we already had one in rgbPP);
.velocity: We're just subtracting 1 from the velocityY each frame starting at 10% of the particle lifespan, so it will start coming down faster after a good initial push (from the emitter and turbulence field);
9- When you playback, the particles should behave correctly. We're still missing any interaction at the waterline around the hull. This is more difficult to accomplish than with fluids. We don't want our particles to emit from the hull too far above the waterline, and emitting too many particles below would be a waste. Ideally, we want to emit from the point of intersection between the boat hull and the water surface.
We'll generate a curve that follows the point of intersection. It'll be usable for particle or even fluid emission. First, we need a NURBS ocean surface, because we'll by using the intersectSurfaces tool that require two NURBS surfaces;
- slow process because the intersection has to be recalculated every trame. We'll greatly improve performance by baking the curve (which also allows us to get rid of the very heavy NURBS previewPlane);
13- Two problems with this new intersect curve prevent it from being baked: It's a curve on surface;
It has a different number of CVs every time it's rebuilt (every frame);
Select the intersection curve, then Modeling > Edit Curves > Duplicate Surface
Curves. Now we've generated a regular curve;
Select the new duplicate curve (should be outside the hierarchy), then Modeling > Edit Curves > Rebuild Curve . Starting from the default settings, just change Number OF Spans to 24;
IMPORTANT: Throughout this whole process construction history should be ON (until we finish baking the curve).
14- Maya doesn't have any good tools to bake geometry, for tasks like that we need some external scripts. An updated version of the popular bakeSoft.mel script is included with the course data (bakeSoftPro.mel).
With bakeSoftPro.mel sourced, select the rebuilt intersect curve's shape node, then type in the command prompt:
Post a comment