PFlow Clouds Tutorial:
Hey everyone, I passed by Jonathan de Blok's sneak peak video on his tool (Voluminance) this tool is able to create a cheat volumetric system both in terms of lighting and creating sprites so I thought of useing only the lighting part of his tool and use PFlow for the sprites, this way we have more flexibility, control, and it's gonna be light since we are dealing with instanced particles.
The tool with the description can be found on CGTalk. Or for direct donwload here.
And also for 3ds max 2016 users you can check his Voluminance tool using MCG on scriptspot. it's faster than the script and works in realtime but it lacks the environment color.
A short video showing a camera moving over at a close distance, and as you can see there is no flickering and rendering time was considerably fast around 3 min per frame for 40,000 particle on a laptop.
The clouds particle are going to be placed on the mesh surface, so we will start by sculpting the base mesh using some modifiers, a small note that the parameters I put is a personal preferance and based on trials so plz feel free to experiment and do your own version :
- First of all let's create a 2500x2500 plane and 200 segs for H&W.
- Apply a displace modifier with strength equal to 200 and choose Cellular map in the map slot (in the next step I'm gonna explain buiding the displace material)
- Apply Push to give that rounded fluffy look.
- Relax will be a nice addon.
- And finally add some noise to break that smooth looking surface.
For the cellular (customise it as you like) for my setup I made sure to use explicit map channel and tweek the following parameters:
- Variation: 50 that will give you the height variation.
- Circular size: 0.2
- Spread: 0.4
- Make sure to check Fractal with 10 for Iterations.
I added Noise map instead of the black color, the noise parameters are shown in the picture below to the right.
After getting the desired base mesh shape next move will be using Voluminance scritp to bake the lighting to vertex color, this script will give you the possibility to calculate light absorption and luminance (environment color).
I'm just going to use the lighting capabilities of this script:
- create an omni some where in the scene and make as far a possible (because the script will calculate the rays being emitted from the light to each vertex, so if the light is far then it's going to give the effect of a sun).
it doesn't have to be on, the light color and intensity also doesn't matter.
- Now in the tool pick your mesh.
- Pick the light.
- Put the light color to dark gray (nutral color, you can adjust it later in the material editor to give your clouds the desired look)
- Luminance color will stay light blue.
- Transmittan: 800 this will let the light pentrate the mesh deeper.
- Finally hit Calculate Absorption then Calculate Luminance.
it will take some time to calculate and when it's done you will not see any change in the mesh yet, because you have to go to your object property and make sure that Vertex Channel display is turned on.
This is how your mesh is supposed to look, and remember the more you increase the mesh density the more calculation time the tool will take. One thing here you might prefer to slice the mesh and remove the bottom part, if you do so do it before using the script this will save you some calculation time.
For Particle Flow now to pick up the vertex color we need to apply it to the mesh as in the picture.
Moving to Particle flow we will create an empty flow and add:
- Birth of 20,000 particle at frame 0.
- Add Position Object and pick the clouds mesh, you can introduce some surface offset, it will give some volume.
- Shape facing will be used to make sure the sprites are always facing the camera. The size was set to 200 with 40% variation and the orientation to random, making the cards large will result in a more blended and smoth cloud.
- Data Operator will be discussed in the next step.
- I used Material Frequency so I can add some variation to the sprites.
Data Operator is the brain of this tool, it will allow the particle to grap the vertex color underneath it and apply it to the particle:
- I used New in event (Standard Input) as an optimization to make the tool only runs the first time it is initialized not at every frame.
- Add select an object and pick your cloud mesh.
- Add two Geometry Operators one will give you the closest point on the surface to the particle, and the second one will give you that point color and feed it to the output.
- Add an output and choose vertex color.
Now PFlow will read the mesh and give our particles the corresponding color.
At this stage you will be having a bunch of colored cards, and don't forget to check Vertex Channel display in object property ot be able to see the color in the viewport.
Now we have to create the shader to be applied to the particles I will let the picture below explain the process.
The main trick is to let the vertex color we extracted form the mesh drive the self illumination, this way our particles will look like as if they are litten and has volume at no cost. I added some stages to vertex color:
- The first one is mix which will remap the original colors to the one that suits your case, for exaple you can choose yellow for the highlights and orange for the environment (in my case I used white and blue for a clear sky).
- Second is the output to control the intesity of the light and light spread.
- Finally a noise is always welcome to add some variation.
After you finished building your shader just go and drag it to your Pflow Material operator.
You can create two or thee materials like this one with some variation and add them to a multi/sub-object material, this way the material frequency in PFlow will use them all with the persentage you choose.
By the end of this tutorial you managed to create one patch of clouds, you can duplicate it multiple times to cover big areas. and if you are using Vray you better check Max Transp Levels in Global Switches tab and make it at least 150 or 200 depending on the count of your particles and the angle you are looking from.
I really enjoyed writting this tutorial, I'm looking forwards for your feedback.
Alaa Alnahlawi. ^_^