AWS Thinkbox Discussion Forums

Masking multiple particle files inside 1 frost object.

Hi,

short question about creating masks for materials inside frost. Would it be possible to keep 1 frost object (1 mesh) but create masks for materials which respect each particle sequence file.
EG: I simulated 3 different emitters in realflow and would need them to be 3 different colors yet remain 1 mesh.

Cheers,
Ralph

Hi Ralph,

It is possible, but if the three sequences have intersections, they will blend their data, so using Material IDs might be a bad idea as each triangle in the final mesh would have to pick a single integer, resulting in possibly jagged edges.

The better approach is to use Blend Materials controlled by a Vertex Color channel’s components. So you have R,G and B channels in a Color, and if you assign a Vertex Color channel of Red to the first cloud, Vertex Color channel of Green to the second and Blue to the third, you could then create two nested Blend Materials. In the first Blend Material you can put the Materials of the first and second systems and control their blending based on the Green channel (when it is 0.0, the first particle’s material should be used, when it is 1.0, the second), then nest this into another Blend where you control with the Blue channel - when it is 0.0, the first Blend material will be used, when it is 1.0, the third particle system’s Material will be used.

Setting the Vertex Color channel can be done using a Krakatoa Magma modifier (if you don’t have Krakatoa at least in Evaluation mode, you should get it - it is free).

Here is how it looks:
*I took a simple RealFlow simulation and loaded it in a Krakatoa PRT Loader
*I cloned the PRT Loader 2 times to create 3 copies of the same simulation.
Frost_BlendMaterials_PRTLoaders.png
*I then added a Krakatoa Magma modifier to each of the three PRT Loaders, and set the flow to Red, Gree or Blue output as Color:


*In the viewports, I got the 3 PRT Loaders showing the Color set by Magma:
Frost_BlendMaterials_MagmaRed.png
*I created a Frost (Zhu/Bridson mode) from the three PRT Loaders
*I then went to the Frost Object Properties and enabled Vertex Color Display with Shaded option turned on:

*Now I created a Blend material with a reddish Standard Material set to Specular Level 100, Glossiness 10 in the first slot, a greenish material with SL 100 and Glossiness 50 in the second slot, and a Vertex Color Map set to Green channel controlling their blending.
*Then I created a second Blend Material that took the first Blend as first input, and a bluish Standard Material with a dark/light blue Noise Map in its Diffuse slot and no Glossiness as the second input. I connected another Vertex Color Map set to Blue channel to control their blending:

*Now I rendered the scene (as Blend Materials do not show up in the viewports), and got the blending of 3 unique materials as I hoped:

How does this compare to masking using the Integer MtlIndex channel?

*I added a MtlIndex channel output to each of the three Magma modifiers to set the PRT Loaders to 0, 1 and 2:
Frost_BlendMaterials_MtlIndex0_Magma.png
*I then created a Multi/Sub Material with the reddish, greenish and bluish materials from my previous test in the 3 slots and assigned it to the Frost object.


*In the Frost object, under “Material” rollout, I changed the drop-down list to “ID from MtlIndex Channel”.
*The viewport now showed the 3 materials in the scene, with individual faces getting the predominant material:

*Rendering produced a similar result, masking the materials on the faces according to the MtlIndex of the closest particles:

Bobo this looks exactly like what I wanted. Sadly I’m not in the office anymore so I only can test it out on monday. Still a massive thanks for the detailed explanation!

One preemptive question though: As far as I understood your simulation inside realflow was originally one emitter. So if I have 3 emitters each prt loader would have to hold one of the 3 sequences?

Cheers,
Ralph

If you saved each Emitter as its own PRT sequence, then you will need 3 PRT Loaders, one for each Emitter’s PRT sequence.
If you can somehow “tag” the particles of one Emitter via some channel in RealFlow (e.g. if your particles are already colored Red, Green and Blue by Emitter), then you could save a single PRT sequence and just run with the existing Color channel in one PRT Loader without the need for additional Magmas. Unless you want to do the MtlIndex channel approach, in which case you would have to test the Color channel and set the MtlIndex to 0,1 or 2 depending on the R.G and B components of the Color…

So in theory if I add channels via the realflow graph nodes to an emitter based on certain conditions the prt loader/frost would be able to read those channels I created and can work with them?

Well, you can do all kinds of magic with Magma before the channels get into Frost. As long as you can get the right channels out of RealFlow, the rest should be rather easy.

Okay got it. :slight_smile: Thanks again.

i was wondering if yo can use about 5 fluids.if so , how?
Thanks

3ds Max (and thus Krakatoa MX) has support for 100 mapping channels. So you can tag your particles using a component of any of them.
Instead of using the Color channel in Magma to set the R, G or B, you can use Mapping2, Mapping3, Mapping4 etc., and set up a cascade of Blend materials controlled by a VertexColor map reading the R,G or B components of Mapping2, Mapping3 etc. for any number of “tags”. It gets problematic if you need to mix more than 300 as then you would be out of channels. But I think that would be unlikely. Note that in your Magma, you will have to set outputs for ALL channels used in the Blend material flow. For example if you have 6 PRT Loaders to blend, the first PRT Loader will have a Magma with Mapping2 set to 1,0,0, Mapping3 set to 0,0,0. The second PRT Loader will have Mapping2 set to 0,1,0, Mapping3 to 0,0,0, and so on until the 6th PRT Loader has Mapping2 of 0,0,0 and Mapping3 of 0,0,1.

Privacy | Site terms | Cookie preferences