How to export volumes that appear-disappear to a USD file?

   508   2   1
User Avatar
Member
3 posts
Joined: Dec. 2014
Offline
I would like to know what is the correct setup and export method in USD land for volume caches that have shorter ranges then my animation range, therefore "appear-disappear" during a shot. For example muzzle flashes, explosions. In SOPs it is enough to have a cache that covers the range of the simulation and then before-after, nothing shows up (since I don t have any cached frames). Let s say my animation range is 1000-1100, my cache frame range is 1050-1070, then during 1000-1049 and 1071-1100 nothing shows up. Which is what I expect from an explosion or any volume that starts at a certain point in time.
In LOPs when I load the same cache via Volume LOP, and then export it to a USD, it will freeze the first available frame of the cache and show that before the sim is happening (so in the 1000-1049 and 1071-1100 range). What is strange to me is that the fields have animated visiblity, so they are invisible during the "preroll" phase, however, the volume primitive containing the fields is visible at all times and therefore forces to show the first available cache frame.
I tried a number of ways to counteract this, animating the visiblity of the volume prim, layering in the vdb cache on a static empty volume and it all works until I export all this via the USD ROP, then it will not animate the visiblity anymore and will always show this first available frame of a cache.
Only way I could achieve the desired result, if the first frame of the cache has all the fields necessary but all of them empty, with zeroed out values. This way, the USD will freeze this empty frame and nothing shows up before.
I would like to keep the exported USD "light" as possible, so I don t want to modifications that will result in writing out a new vdb sequence next to the USD export.
Thanks for the insight.
Edited by Tamas Molnar - Dec. 5, 2023 06:29:51
User Avatar
Staff
4438 posts
Joined: July 2005
Offline
Various places in LOPs where multiple frames of USD are stitched together (Cache LOP, USD ROP, USD Render ROP) have a toggle to "Track Primitive Existence to set Visibility" which creates an animated Visibility attribute on primitives when the source data (usually coming from time varying SOP geometry) pops in and out of existence. This toggle is designed for precisely this purpose.
User Avatar
Member
3 posts
Joined: Dec. 2014
Offline
Thanks for the response! I was aware of this toggle, it was enabled on the USD ROP I used. It worked in a way that the visiblity of the fields were animating indeed but their parent, the volume node prim was not, so it ended up showing the frozen first frame of the cache sequence.
I found an old thread where it was explained that the usd_setvisibility function that I was using to animate the visibility of the volume node prim is actually not time sensitive, this is the reason my setup didn t work before. But manually overwriting/animating the property "s@visiblity" actually forces the visiblity and it works now. In the name of efficiency I ended up just adding a prune node with an expression that it makes the prim visible-invisible based on the sample frame range coming from the volume node settings (something like "if $F<ch("cacheStart"),1,0)"). This way, the export of the volume is very efficient (it doesn t cycle through the frames because of the frame range multi-sampling) but the visiblity before-after the cache is set properly. So the volume switches on and off properly.
Edited by Tamas Molnar - Dec. 5, 2023 14:37:05
  • Quick Links