Page 1 of 1

Sampling from 3d textures doesn't seem to work

PostPosted: Mon May 14, 2018 3:42 pm
by Filipe Caseirito
Hi there,

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

Can you help?

Thanks
Filipe

Re: Sampling from 3d textures doesn't seem to work

PostPosted: Mon May 14, 2018 3:46 pm
by Filipe Caseirito
Ah, forgot to mention, this is using Unity 2017.4.2f2

Filipe

Re: Sampling from 3d textures doesn't seem to work

PostPosted: Mon May 14, 2018 5:30 pm
by Amplify_Borba
Hello Filipe, thank you for getting in touch and for reporting this issue.

I've just confirmed it on my side and have forwarded it to the developers for further investigation, I'll be sure to let you know as soon as we have any developments, thanks!

Re: Sampling from 3d textures doesn't seem to work

PostPosted: Tue May 15, 2018 1:09 pm
by Filipe Caseirito
Hi there!

Is there an ETA for this?

Best regards,
Filipe

Re: Sampling from 3d textures doesn't seem to work

PostPosted: Tue May 15, 2018 1:51 pm
by Amplify_Borba
Hey there! The issue is still under investigation by our developers, I'll be sure to let you know as a reply to this post as soon as they have any new developments regarding it.

Apologies for any inconvenience caused!

Re: Sampling from 3d textures doesn't seem to work

PostPosted: Fri May 18, 2018 6:17 pm
by Amplify_Borba
Hello Filipe, thank you for your patience!

We've just release a new version, currently available for download through our website, in which we've corrected the issue you've reported.

Please let us know if you come across any further issues, thanks!

Re: Sampling from 3d textures doesn't seem to work

PostPosted: Mon May 21, 2018 10:38 am
by Filipe Caseirito
Hi!

It seems the problem is fixed! Thanks!

Filipe

Re: Sampling from 3d textures doesn't seem to work

PostPosted: Mon May 21, 2018 11:08 am
by Amplify_Borba
No problem, glad to be of assistance!

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!