
To see the expression, open the expression editor, view by name and select expression1.
int $maxY = OceanWakeTexture1.resolutionH;
float $dropFrequency = raindropSettings.dropFrequency;
float $dropSize = raindropSettings.dropSize;
float $randSeed = time * 32.21;
int $numDrops = (noise( $randSeed ) * .5 + 0.5) * ($dropFrequency + 1);
for( $i = 0; $i < $numDrops; $i++){
$randSeed = ($randSeed + 0.2) * 1.23;
int $x = (noise( $randSeed ) * .5 + 0.5) * (float)$maxX;
$randSeed = ($randSeed -.1) * 1.67;
int $y = (noise( $randSeed ) * .5 + 0.5) * (float)$maxY;
if( $x >= $maxX ){
$x = $maxX -1;
} else if( $x < 0 ){
$x = 0;
}
if( $y >= $maxY ){
$y = $maxY -1;
} else if( $y < 0 ){
$y = 0;
}
setFluidAttr -xi $x -yi $y -at density -ad -fv $dropSize OceanWakeTexture1;
}
Note that the ripples will render just where the fluid wake is positioned. However one can make the ripples cover the entire ocean by making the "dropoff shape" = "off", and the boundaries all wrapping, which is what has been done in this example. The pattern of ripples repeat across the ocean, however an individual ripple can keep expanding to cover the entire ocean because of the way the wrapping simulation boundaries work( although it generally is too weak to see at that point ).
It is also possible to have particle rain emit into the ocean. Inside a particle expression one could test for the particle being below the water height then use "fluidVoxelInfo" to get the index of a fluid at the particle location. One then kills the particle by setting its lifespanPP to -1 and emits density into the fluid voxel using setFluidAttr. If you want to test if the particle is below the exact height of the waves, you can use colorAtPoint on the ocean shader with the particle xz position to get the height. A look at the expression generated by "ocean:add surface locator" will illustrate how to do this.
Note that one problem with this method currently is that the ripples can be a bit noisy and spikey. Instead of emitting into a single voxel one could emit a guassian distribution into a clump of voxels (like a smooth airbrush stamp). This is more work but should provide smoother results. One way of doing this might be to animate the position and intensity of a fluid emitter that uses dropoff.
ColorAtPoint currently only works with non-projected 2D textures. In the hypershade menus there is an option to convert 3d or projective textures to 2D file textures that may be of use to you. If you had the 3D surface point you could potentially try and do set/getAttrs on the projection node to get the uvCoordinate outputs, although it would be a bit tricky to setup.
I think that there are some plugins for maya for applying 3D textures to particles( check out the 3d Kolektiv ).
Duncan
I’m trying to use colorAtPoint to control the scale of particles goaled to geometry. It works fine if I try a 2D map like checker, but I need to be able to camera project my texture. It doesn’t seem to be working. Is this something colorAtPoint can do?
The folks at autodesk support have just supplied me with code to add particle event collision detection, and with your code above I was able to do the project, looks great. Thank you Autodesk and Duncan.
Sure wish you could show some more code for this as ripples appearing out of nowhere disconnected from any raindrops that might be falling on it are not too impressive. For instance, when a particle hits the surface, how to test for its position relative to the ocean plane, and then resolve that using “fluidvoxelInfo”, and how to set up the gaussen distribution of the fluid emitter. This is getting close to what one would want in fluid dynamics, and seems still out of reach of Maya’s standard out-of-the-box capabilities even today with Houdini and Realflow showing more comprehensive (read faster to market) solutions. I have a real need to produce something like this now, but have not the budget to purchase Realflow (I have to show a working concept with Maya Unlimited first).
hi duncan i have been ur hardcore fan..u R simply amazing like einstein with cracking ideas & tricks..one more thing would like to know abt how to achieve sea shore dynamics with maya particles & fluids..So far i have reached succesfully in creating seashore foam with 2d fluid texture (one of ur techniques ) but looks flat with when it comes close to camera ..I apolozise tht this is a not a correct way to ask u in this thread but i m in a real bad need to accomplish this task of creating believeable sea shore look. i m looking forward to achieve the look as it was done in “Madagascar & in Sufrsup”.
by the way I m using Wire Deformer to create big breaking waves by pareting the base cuev of wire deformer with its original curve,I was albe to move my deformer like a wave now i want 2 emit particles from edges of the wave & shuld crawl like as it does in real world...plz plz help me with these..especially the particles crawling towards us & emitting from the edges of waves.for rest of the things like spray & crest mist i have followed ur old threads & i m able to create those effect ..M illions of thnxs & wish u a very happ new year & also Merry X-mas.
frm India...Vikas(vfx artist).
Thanks anyway for the reply
Cheers,
Gus
I don’t know of any tutorials on that, offhand.
Duncan
Hello Duncan,
How are you?
We met at the last 3december, we took a picture right in front the projector. I was wondering if you have any tutorial on Mental Ray Secondary Output Pass (I am the guy who is making CG food, in case you don’t remember).
That will save my life.
many thanks!
Gus
Great, that helps get me started, thank you.
When you simply go to assign a texture, fluids will appear in the options. The fluid textures are similar to the standard fluids, except that they are textures, not shaders, and thus do not compute lighting. Also note that fluids can have outTransparency (or outAlpha) that is very independant from the outColor.
Duncan




