I'm having difficulty sampling from a 3d texture... I've made a simple shader: - Texture Object Node with Auto-Cast Mode set to "Locked To Texture 3D" - World Position Node - Texture Sampler Node. The Tex input is connected to the Tex output of the Texture Object, and the UV input is connected to the XYZ output of the World Position Node. - RGBA output of the sampler is connected to the albedo channel of the surface shader.
When I try to compile this shader, I get the error:
Unable to cast from SAMPLER3D to SAMPLER2D. You might want to use a Texture Sample node and connect it to the 'Tex' port. Generating dummy data ( 0 )
And of course the shader doesn't work... If I look in the generated code, on the Tex3d line, instead of the sampler, there's a "0" (I'm guessing the dummy data), and if I replace that for the sampler (_Texture0"), it works fine.
Looking at the code where the error message is raised and backtracking, it seems the sampler node only accepts 2d textures, which seems weird (unless there's a texture sampler node for 3d somewhere I can't find)...
I've attached the shader in case it helps, and I'm running version 1.5.3_dev01
Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, the Unity Asset Store thrives on user interaction and direct feedback. Every bit helps, your feedback is extremely valuable to us!
Feel free to get back in touch if you have further issues or questions, thanks!