Home Technical Talk

Fastest way to render 3D volume textures

polycounter lvl 8
Offline / Send Message
Cactus on Fire polycounter lvl 8
What's the fastest way to render 3D volume textures from a model with textures?

Replies

  • Eric Chadwick
    By render, fo you mean convert? What file format does the volume need to be?

    I've converted meshes into DDS volume texture files, using the Slice modifier in 3ds Max.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    The simplest way is most likely Houdini. I tried out the slice modifier method mentioned by Eric too. Its fairly straight forward to set up, but my computer was choking from the many instances. I was basically laying out all the slices at once and make one shot. Getting textures from the mesh to bake into the volume is tricky though. Since the all the slicing methods would show thin surface and possibly wrong colors because of the camera transform. I also developed several methods for Unreal for capturing volume textures from meshes but I havent done anything regarding including the texture of the mesh into the volume.
  • Cactus on Fire
    Offline / Send Message
    Cactus on Fire polycounter lvl 8
    By render, fo you mean convert? What file format does the volume need to be?

    I've converted meshes into DDS volume texture files, using the Slice modifier in 3ds Max.

    Obscura said:
    The simplest way is most likely Houdini. I tried out the slice modifier method mentioned by Eric too. Its fairly straight forward to set up, but my computer was choking from the many instances. I was basically laying out all the slices at once and make one shot. Getting textures from the mesh to bake into the volume is tricky though. Since the all the slicing methods would show thin surface and possibly wrong colors because of the camera transform. I also developed several methods for Unreal for capturing volume textures from meshes but I havent done anything regarding including the texture of the mesh into the volume.
    Yeah I mean something like this but with rendering the textures on the model as well. I tried it with Max and I can make it work with animating the position of slice and cap holes modifiers but the cap holes produces glitchy results on complex models.

  • Eric Chadwick
    I just rendered it out as an animated sequence, then used Shoebox to compile the sprite sheets.
    http://renderhjs.net/shoebox/

    I can't remember which modifier combo I used, but I don't think it was Cap Holes.  Maybe an animated ProBoolean. But I did it on a skull mesh, and it worked pretty well.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    The max method should be cabable of baking texture of the model too. Just make sure you somehow keep the uvmap of the mesh. Then assign the textures to the model, and when you render, render an unlit image so it shows the texture. This will look incorrect from the view of the slicer camera but the outside voxels of the volume should be mostly correct, unless the mesh surface on the given slice is fully vertical.
  • Cactus on Fire
    Offline / Send Message
    Cactus on Fire polycounter lvl 8
    Obscura said:
    The max method should be cabable of baking texture of the model too. Just make sure you somehow keep the uvmap of the mesh. Then assign the textures to the model, and when you render, render an unlit image so it shows the texture. This will look incorrect from the view of the slicer camera but the outside voxels of the volume should be mostly correct, unless the mesh surface on the given slice is fully vertical.


    I tried to render the volume texture of a tree with the slice+cap method but as you said the vertical bark of the tree was almost completely invisible so I had to create an array of cylinders to simulate the bark and give shell modifier to the leaves so they don't look like sheets of paper. I don't think there is a perfect solution for this available in any program.


    I just rendered it out as an animated sequence, then used Shoebox to compile the sprite sheets.
    http://renderhjs.net/shoebox/

    I can't remember which modifier combo I used, but I don't think it was Cap Holes.  Maybe an animated ProBoolean. But I did it on a skull mesh, and it worked pretty well.
    Could it capture the skull as if its a full solid volume or did it only capture the surface of it?
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Houdini->convert to volume would work.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    On your result shot it kinda looks like you just stacked some planes ontop of each other and mapped them to the texture. Why don't you use a volumetric shader instead? It would be similarly expensive anyways.
  • Cactus on Fire
    Offline / Send Message
    Cactus on Fire polycounter lvl 8
    Obscura said:
    On your result shot it kinda looks like you just stacked some planes ontop of each other and mapped them to the texture. Why don't you use a volumetric shader instead? It would be similarly expensive anyways.
    Because I plan to use these in a terrain shader where I can change the positions, visibility and scale of the trees as well as create fake shadows within the shader so it doesnt have to do any light calculation. Displaying volume this way is quite cheap since only 100 alpha tested planes don't cost alot for thousands of trees but it really chokes the graphics card when you try to calculate shadows for them.
    Also to my experience volumetric shaders don't play too nice with other objects around the scene as it relates the proper Z-writing.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Open and/or paper geo is generally a problem with the most of the effiecient solutions because of the way they work (captured from an alternate camera transform). I just worked on an Unreal based approach that can deal with any geometry without a problem including thin and open meshes.It basically resamples the vertex and index array of the mesh into a voxel volume, but its incredibly slow. It can't bake color neither. Only surface yet. I have another one that is basically instantaneous but runs on like 30 fps with a 50k tris input mesh so you still can't use it in truly real time. Can you provide info on how are they going to be used? I'm asking because I find the max way inconvinient and slow if you need many volumes.
  • Cactus on Fire
    Offline / Send Message
    Cactus on Fire polycounter lvl 8
    Obscura said:
    Open geometry and paper geo is generally a problem with the most of the effiecient solutions because of the way they work (captured from an alternate camera transform). I just worked on an Unreal based approach that can deal with any geometry without a problem including thin and open meshes.It basically resamples the vertex and index array of the mesh into a volume, but its incredibly slow. It can't bake color though. Only surface yet.
    Yeah I think I saw the unreal demo for it. It works great for things like painting realtime clouds and even some air simulations but it's not ideal for this case.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Nah this is different :D I think you are talking about the one by Ryan Brucks where he paints smoke in vr and stuff like that. I was specifically trying out techniques for baking and rendering solid things as volumes.

    This is the slow one I mentioned. This works with any mesh but its very slow and its wip (bottom of the page). The example shows a mesh turned into an sdf volume texture, and then rendered using ray marching. Normals are calculated from the sdf.
    https://polycount.com/discussion/157279/the-wonders-of-technical-art-unreal-engine/p6

    This is the another one that is realtime but its allergic to open and thin geo:

  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    Obscura said:
    On your result shot it kinda looks like you just stacked some planes ontop of each other and mapped them to the texture. Why don't you use a volumetric shader instead? It would be similarly expensive anyways.
    Because I plan to use these in a terrain shader where I can change the positions, visibility and scale of the trees as well as create fake shadows within the shader so it doesnt have to do any light calculation. Displaying volume this way is quite cheap since only 100 alpha tested planes don't cost alot for thousands of trees but it really chokes the graphics card when you try to calculate shadows for them.
    Also to my experience volumetric shaders don't play too nice with other objects around the scene as it relates the proper Z-writing.
    You can pre calculate the amount of steps needed based on the scene depth and then they play nicely with polygonal stuff. This is described in this article of Ryan:
    https://shaderbits.com/blog/creating-volumetric-ray-marcher

    This can work with solid things as well.
  • Cactus on Fire
    Offline / Send Message
    Cactus on Fire polycounter lvl 8
    Obscura said:
    Nah this is different :D I think you are talking about the one by Ryan Brucks where he paints smoke in vr and stuff like that. I was specifically trying out techniques for baking and rendering solid things as volumes.

    This is the slow one I mentioned. This works with any mesh but its very slow and its wip (bottom of the page). The example shows a mesh turned into an sdf volume texture, and then rendered using ray marching. Normals are calculated from the sdf.
    https://polycount.com/discussion/157279/the-wonders-of-technical-art-unreal-engine/p6

    This is the another one that is realtime but its allergic to open and thin geo:

    That walking guy is pretty sick :D I've seen UE4 has pretty advanced methods for combining volumetric stuff properly with the scene but I doubt Unity has the same advancement with yet. Otherwise I have lots of things I can use with a stable volumetric rendering shader.
  • Obscura
    Offline / Send Message
    Obscura grand marshal polycounter
    You can just translate the shader code to Unity. These are not default features in Unreal but made using hlsl and sometimes with a help of blueprints. Good luck anyways. Interesting project.
  • Cactus on Fire
    Offline / Send Message
    Cactus on Fire polycounter lvl 8
    Obscura said:
    You can just translate the shader code to Unity. These are not default features in Unreal but made using hlsl and sometimes with a help of blueprints. Good luck anyways. Interesting project.
    Good to know. Thanks for the help.
Sign In or Register to comment.