So I'm playing with OSL right now, and have had a lot of luck in the past with texture
and most of its key-value optional parameters. I've moved on to texture3d
, which uses voxel formats—a great idea—but I can't find any documentation as to what voxel formats Blender supports.
I tried VDB, which is what volumes export to by default (also a voxel texture format); but can't tell if it's actually reading the file or not. I'm definitely not getting the shape I expected.
My code is as follows:
volume voltex(string filename = "", point uv = 0, output color cOut = 0, output float aOut = 0.0) {
color cTex = texture3d(filename, uv);
cOut = cTex;
aOut = cTex[0];
}
Filename is set to "///data.vdb", and this file does exist in the project's directory.
But, when I tie the node to Principled Volume, I get an error-pink with no variations on transparency or color. No issue loading the file is reported in the terminal.
The little round grey cloud in the above image is the imported volume of data.vdb; these two objects should be at least shaped the same way. I might be missing something obvious.
Is OSL's texture3d
function fully supported? For which formats does it work?
UPDATE: It seems that volume shaders don't really handle UV coordinates in the same way; I'm using object-space coordinates now and having some results. However, the question of which file formats qualify as voxel textures remains.