Raycast volume rendering shader

Hey everyone, I’m developing a shader inside of playcanvas that renders volumetric data inside of a box using a raycast renderer. I believe I have the shader running properly but we’re having trouble understanding how to properly setup and populate a 3dtexture with data and then send it to the Shader.

https://playcanvas.com/editor/scene/936532

This is the project we’re currently working on and the specific shaders are in /Alpha/VolumeRendering/scripts

If anyone has any suggestions for me I welcome the feedback.

Have a look here how a 2d texture is created:
https://developer.playcanvas.com/en/api/pc.Texture.html

When creating a volume texture, specify options.volume and also depth, and then when you lock texture, you should receive array large enough for width * height * depth pixels.

2 Likes

also note, that volume textures are only available on webgl2, so test for that.

1 Like