Jump to content
papsphilip

Bake 2d particle position to texture

Recommended Posts

Sounds simple but i've never done this before. How can i bake particle positions into a texture sequence?

the point count is the same through out the animation

their position is always on XZ plane and 0 to 1 space

Share this post


Link to post
Share on other sites

yeah i think this doesn't apply to this particular problem because they are rasterizing points in a grayscale texture, what i want is the actual xyz information in an exr sequence so that i can import it into Unity VFX graph.

i am using the vertex animation rop for now and it is exporting a really large texture. Each pixel is a point on a particular frame

this is probably the way to go although i would prefer if i had separate textures for each frame. Each pixel would have a color that corresponds to its xyz position for one frame.

i am not sure what the correct workflow is here

Share this post


Link to post
Share on other sites

Ah, yes, a different use case here.  I'm sure someone in the Games subgroup here or on SideFXs forums can offer additional ideas or clarify the Houdini<->Unity best practices for this sort of thing

Share this post


Link to post
Share on other sites

i managed to export a position map for all my particles  - one texture per frame - using a custom but simple solution.

i write each particle position as Cd on a grid of points. The grid point count must equal the particle count - if grid points are more its ok.

Then in COPS using a VopCopfilter i write the Cd from each grid point as one pixel value. So bottom left pixel 0,0 takes Cd from point 0 then continues right to the end of the row and then to the row above starting left to right.

 

i will upload my solution as soon as i find the time.

I am also thinking now maybe a python node would be the best solution of all. i will definitely try that as well - exporting point positions to an image straight from a python node

  • Like 1

Share this post


Link to post
Share on other sites

well that was my first choice but the texture for 500.000 or 1M particles over 480 frames is pretty huge and heavy. i wasn't sure this was the right workflow to be honest.

Also i am still not sure about the resulting precision of these textures from COPs. Even though i export 32bit float exr in my custom solution, when i go over the image in Houdini with the color sampler i can see the numbers are rounded. So a @P.x value of 0.625753 becomes 0.6258

since vat also uses COPs if i am not mistaken i was afraid of losing precision.

 

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×