|06 June 2013|
Jonathan de Blok
Voluminance Cloud Script
I was going to make this a commercial one but screw that I'll up a proper release to scriptspot later.
A short video showing an older version but the process is the same: http://vimeo.com/59950346
Script attached, including a mat lib that gives you the the 'mr_card' shader for very fast rendering of sprites in MR.
Please share if you made something nice with it, enjoy!
Pick Mesh / Pick Light
This is your starting point, you pick a mesh that will form the base shape for your cloud and a light source you want to use for illumination. Best is to use a mesh that is mostly uniform in polygon size and avoid long thin faces. Start with a low/medium res object to quickly get a feel for all the different parameters, for default clouds a hires base shape is not even necessary. The light source is only used for it’s position, intensity and color can be setup independently for more artistic freedom.
Note: the mesh will be collapsed to an EditablePoly to speedup calculations, a backup of your mesh will be created called “<originalname>_backup’ and will it will be hidden automatically.
Light & Luminance color
‘Light color’ will determine the color of the cloud where light hits it directly, this color is then darkened by the amount of volume the light ray travels through. The amount of darkening per traveled volume is set by the ‘Absorption’ factor explained later on.
‘Luminance color’ is for the secondary component of the lighting model. After calculating the light intensity at each vertex, using the absorption model, they will affecting all surrounding vertices within a given radius using the ‘Luminance color’ and distance to calculate the additional secondary light influence.
Mesh & Sprite material
Here you can pick two materials, one that will be assigned to the bae mesh and one for the sprites. Maxscript doesn’t support drag&drop so you’ll have to pick them manually. The basic idea for the basemesh is to have the calculated vertexcolors set as a self-illumination map. The sprites will be textured by their own vertex colors and a radial opacity map resulting in little ‘puff’ textures. For a quick start the basic setup for both materials is included as a material library.
Load & save preset
Create presets for all adjustable parameters. The presets are normal ini files and can be edited manually if needed, you can for example safely remove lines from these files and only have the remaining parameters loaded.
Determines how much light is absorbed per distance traveled inside the volume of the base-mesh. Low values will make the cloud more absorbing , higher values will let light travel further.
For selected faces only
This will only do calculation for the selected faces. You can use this to quickly setup a small parts of the base-mesh and when content with the results do it for the whole mesh. Internally the intensities for each face center is calculated and these values are then averaged over the vertexes and stored as vertex colors. So each vertex that belongs to a selected face will be affected when this option is checked.
Each vertex can be thought of as an omni lightsource emitting it’s vertex color to all the surrounding vertices within a spherical volume using the given radius.
A simple multiplier to weigh the amount of luminance used.
For selected verts only
Only calculate the luminance for selected vertices when checked. Use this to quickly setup luminance for a small area, when content with the results uncheck and calculate for the whole cloud.
Doing luminance calculations is ‘destructive’, as in it overwrites the current vertexcolors. So while setting it up you can automatically recalculate the absorption step so you’ll start with the same original vertex colors each time.
Cover mesh in sprites
The total number of sprites distributed of the surface
Absolute sprite size when placed on the surface. When using a random offset size can vary depending on distance to surface. If that offset is 0 all sprites will have the size given here.
Relative sprite size at max distance. When using a random offset this size will determine the sprite’s size at maximum distance.
Relative size variation, independent of offset.
Offset max dist
Sprites will be places between the surface and a random offset along the face’s normal.
A bias of 0 will result in a uniform offset distribution between the surface and the offset, values >0 will pull the offset average closer the surface.
On selected faces only
Add sprites to selected faces only. Use in combination with the ‘Count * (% selected faces)’ parameter to quickly setup a small area that will be representative as if you would have covered the entire mesh.
Count * (% selected faces)
Checking this option will make sure you get the same sprite density when you’re applying sprites only to a small area of selected faces as if you would cover the whole mesh is sprites. So if you have on 10th of the faces selected you’ll only get a 10th of the given ‘count’.
Add sprites (don’t replace)
When checked existing sprites are left in place and addition sprites are added. Use this to patch small areas that need more sprites.
The GPU revolution will not be rasterized! - http://www.jdbgraphics.nl
Last edited by jonadb : 06 June 2013 at 02:30 PM.