Phoenix FD RGB channel
#1
Hey guys, just started playing around with tyflow yesterday and I'm loving it!

Does anyone know how to get Phoenix FD color data into tyflow? I have  a PHX sim with two different color'd smoke sources interacting and I want to pipe this RGB data into a Vray Light Mtl color slot. Worst case scenario could I convert the RGB data to integers, and use this to somehow drive a mtl ID? Either way I couldn't find any operator for getting the RGB channel into tyflow.

I'm open to crazy ideas!

- Spencer
  Reply
#2
Hey,

So I don't currently read RGB data in tyFlow....although it's not a problem to do so. I guess the general workflow you'd want would be: PHX RGB into tyFlow custom data channel, then from there, apply that custom data to a mapping channel of your choice and then use a vertex color map in your VRayLightMtl? Seems plausible.
  Reply
#3
(04-11-2019, 11:11 PM)tyFlow Wrote: Hey,

So I don't currently read RGB data in tyFlow....although it's not a problem to do so. I guess the general workflow you'd want would be: PHX RGB into tyFlow custom data channel, then from there, apply that custom data to a mapping channel of your choice and then use a vertex color map in your VRayLightMtl? Seems plausible.

Yep that sounds pretty cool!
  Reply
#4
Would you guys be able to elaborate on this process a bit more? I have a phoenix smoke sim with mixing color smoke and particles following it. I want the particles to inherit their color from the smoke sim. How do i get tyflow to read the rgb channel from phoenix?

Thanks!
  Reply
#5
You can use a fluid properties operator to read RGB data to a custom data channel, then use a mapping operator to assign that data to a mapping channel. Then use a vertex color map in your material to render those colors. Make sure those operators are set to "continuous".
  Reply
#6
Sorry, im still new to this and i still dont fully understand. I added the fluid properties node and enabled rgb. (vector) Do i then use the custom properties operator somehow? I also set up a vertex color material but im unsure how to pipe the data into it. I also added a mapping operator but im not sure if i need any specific settings.

Any more insight would be greatly appreciated, perhaps a quick screenshot showing the setup or a scene demonstrating it?

Thanks
  Reply
#7
A vertex color map just takes UVW coordinates and turns them into colors. So normally a UVW coordinate would be something like [0.5, 05, 0] (midpoint on a texmap) or whatever, whereas a vertex color coordinate would be an RGB value that is something like [255.0, 0.0, 0.0] (red).

So the question is, how can tyFlow assign RGB values like that to UVW coordinates? And the answer is simple: the Fluid Properties operator can be used to take PhoenixFD RGB values and assign them to particle data channels. However, a texmap has no idea that particles have data channels. So we then use a Mapping operator to take the vector value of the data channel, and push it into a UVW mapping channel, so that it can be read by a vertex color texmap. Of course you'll need to adjust your Mapping operator settings to tell it to take your custom vector and place it in the mapping channel of your choice.
  Reply
#8
I still cant seem to get it to inherit the smoke color from the sim. I have added the fluid properties however i cant seem to assign a mapping channel to the RGB. If i type a number in there it doesnt seem to save my entry, if i deselect and re-select the fluid properties operator the entry in rgb is blank again. I tested with the velocity instead of RGB and it appears to work. (not sure if its correct though...) The particles render and they have colors but as soon as i assign it to any other channel it breaks and the particles render as black. (still visible in alpha channel) my setup is this....

Fluid properties operator inheriting the pfd sim. Velocity enabled with channel set to 1. (set to continuous)
custom properties operator set to GET (load from channel) with custom vector set to mapping channel 1 (set to continuous)
mapping operator set to get mapping from vector channel 1, map channel 1 (set to continuous)

standard material set up with vertex color map in the diffuse slot, vertex map channel set to 1 and assigned to the tyflow icon. (it also made my emitter geom the same color, not sure why)

I have attached my scene file below, saved with max 2018. You will need phoenix to resim the smoke but you should still be able to examine the flow setup.
  Reply
#9
I seemed to have stumbled across an entirely different solution. Instead of dealing with these vector mapping channels im going right to the source. PhoenixFD has a 3d texmap that is generated from the simulation. I simply assigned the PhoenixFDTexmap to the diffuse slot of a standard material, set the diffuse color to black, set the channel to Grid RGB and the coordinates to object, then assign the material to the tyflow icon.

This seems to work for a normal render however im still having trouble getting the prt cache exporter to save the color so i can load it into krakatoa.

P.S. I would also still like to know how to get it working with the vertex colors for future reference.

EDIT: I have managed to get the krak prt files to have the correct colors by assigning the phoenixfd grid texture to the prt cache after its loaded with the prt loader. It would still be nice to figure out how to bake the colors into the particles during the prt simulation however.
  Reply
#10
I'll check tonight, and provide a working scene file (assuming the issues you're experiencing are not simply a bug).
  Reply
#11
Great! Thank you!

P.S. I have encountered some odd artifacts when rendering using my method. Sometimes there are little black triangles that appear. It tends to be more visible with larger sized particles. Not sure if its an issue with the pfd texmap or something else. I will continue to investigate and post my results here.

Edit: For some reason it seems like some particles are being skipped by the mapping and are rendering as black. Still not sure if its an issues with pfd or tyflow though.
  Reply
#12
So turns out there's a bug in the fluid properties operator...not in the way it works internally, but the channel name text box itself isn't accepting input properly...so that probably explains why you were having trouble getting it working. Sorry about that Smile Fixed in the next build.
  Reply
#13
In the meantime you can experiment with the attached file. It should still work in v0.16014, even though the RGB textbox of the Fluid Properties operator won't work properly. Viewport display of the Vertex Color texmap doesn't work properly, but if you hit render you'll see the particles are getting the proper RGB colorings.


Attached Files
.max   phxRGB.max (Size: 688 KB / Downloads: 379)
  Reply
#14
Hey,

I tried your max scene but its still not working. I assume its because youre running a newer version of tyflow? If i sim the phoenix smoke and then hit render the particles render as black.

I suppose i will wait for the next version of tyflow. Any eta on the next patch? Big Grin
  Reply
#15
Hmm that's odd....well, as opposed to troubleshooting the previous build I guess I'll just recommend to try it in the next. Hoping to post it tonight, if not tonight then definitely tomorrow night.
  Reply
#16
Hey,

The new update seems to be coloring the particles with the vertex map correctly now! Thanks for the update. Smile

Unfortunately im still getting some wierd rendering artifacts when i have larger particle sizes. Sometimes some of the particles will render as black. Its the same artifacts i was getting with my other texmap method. It might be an issue with particles being just outside the rgb sample locations. I noticed that particles using the fluid force operator dont always match exactly the contours of the smoke. Hopefully i can work around it.
  Reply
#17
If you upload a scene or send to support@tyflow.com I can take a look.
  Reply
#18
After a bunch of experimentation i still have not found a work around. It seems like the sampling for the color channel is a bit off. Increasing the steps per frame helps somewhat, but even 1/32 doesnt eliminate it. When i apply the vertex color map you can see that some of the particles arnt reciving the map and are colored black. I get this issue if i use the vertex color map method or the pxd texture map method. It seems to mainly happen along the z axis. It could also be along the velocity, which is traveling -z. Changing the sampling in the mapping operator also seemed to help slightly but didnt fix it. In the pxd grid texture there are some tiling modes. One is single clamped, which repeats the color of the edge pixels. That sounds like exactly what i need but its not working for some reason. This material is originally ment for the liquid particles and coloring fluid meshes.

https://imgur.com/6h26HvV

P.S. I attached my scene file, try and have a look.


Attached Files
.max   ink_falling_colors.max (Size: 728 KB / Downloads: 406)
  Reply
#19
Well only cells that have advected color values will have those color values. The default for all cells is black. And there's no way to enforce that particles only visit cells which have also advected color.

You could try using a PhxMapper object to set some default color value for all cells other than black. Or you could try using a script operator to enforce some default color value if black (ie, [0,0,0]) is detected as the assigned color.
  Reply
#20
Yeah that makes sense, however if i use the RGB display in phoenix it appears like the "volume" that includes the color is slightly larger than the smoke volume. The locations of the artifacts also seem oddly specific. It only tends to appear on the leaded edges of the smoke. I will keep trying to find a solution but so far no luck. Sad

Have a look at the max file and take a look. Smile
  Reply


Forum Jump: