Jump to content
  • Advertisement
Sign in to follow this  
ShmeeBegek

3d Texture Clamp (Cube Maps with respect to length?)

This topic is 4871 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

I have been tinkering with the idea of using a 3d texture for a lighting function with distance attentuation (and shadows, making computation at runtime impossible) however there is a problem in that the clamping of the texture only seems to be possible with respect to a single texture coordinate, meaning that rather than acting like a cube map of the outer 6 sides of the texture [without respect for length once the the vector hits the edge of the 3d texture] the texel accessed will continue to change as the length of the vector changes. One solution to this would be to use a sequence of cube maps interpolating between them but this would probably be both hard to implement and slow. I am wondering whether or not there is any extension, clamping mode, texture type, or other that could solve this problem? In short I need a texture lookup that acts like a 3d texture unless the vector is outside of [0,0,0]->[1,1,1] in which case I need it to access the last texel along the vector that lies within the box (like a cube map). Hopefully I'm making some sense here, it's rather confusing to explain... Thanks, ~SPH Edit: I could also check bounds and if it is out of bounds then grab from a cube map, but this wouuld require a fragment shader and be rather slow.

Share this post


Link to post
Share on other sites
Advertisement
WRT 3d textures i think u can use GL_CLAMP... (defualt is repeat) thus this shouldnt be accuring
Quote:
the texel accessed will continue to change as the length of the vector changes

one thing is u need to set the clamp method for all 3 axis's

Share this post


Link to post
Share on other sites

I should've clarified by saying that when the vector is out of the box I need the texel at the point of intersection with the box [0 0 0] -> [1 1 1].

Example:

The coordinates [0 0 0], [.5 1 0], [1 2 0], [2 4 0] are all colinear, but the clamped points [0 0 0], [.5 1 0], [1 1 0], [1 1 0] are not. The points that I need sampled are [0 0 0], [.5 1 0], [.5 1 0], [.5 1 0] because the point of intersection is [.5 1 0], and that's where it should be clamped (pictured like a cube map).

Thanks, ~SPH


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!