Sign in to follow this  

3D Texture Gradient computation on the fly

Recommended Posts

Hi, I've been wondering if given a 3D texture and a shader pointing to one of its voxel, I could compute the gradient on the fly(most likely I'll be using a central difference). After looking at the GLSL spec, I found out the noise an backward/forward differences functions but I cannot apply them here. Someone told me it could be done but couldn't say how... Does anyone knows about this technique? Thanks, Jeff.

Share this post

Link to post
Share on other sites
Well that is what I actually do but I was hoping for an optimised built in function.

When fetching my neighbors in a central difference, the differential steps are proportionnal to the texture size.
Like if I have a 128*64*32 3D texture the steps would be :
1/128, 1/64 and 1/32

Thats is what annoys me as the code should be general, and using a uniform vec3(GLSL convention) doesn't suit me as my shaders are already "heavy".
Any ideas would be welcome :-)

Cheers, Jeff.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this