• Advertisement
Sign in to follow this  

3D Texture Gradient computation on the fly

This topic is 4711 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Just query the surrounding pixels and compute it yourself inside the pixel shader. Thats the best I can think of. I shall look into it and get back t you later.

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
Sign in to follow this  

  • Advertisement