Skip to main content
gamedev.net
🔒 Locked

Traverse mipmap tree

Started by 51mon Sep 22, 2006 at 4:31 AM 1 replies 950+ views
Original Post
51mon
51mon
I'm using a mipmap chain as a tree structure. I traverse it recursively; but here I got a problem. How much should I offset the texture coordinate for every step down the tree. I guess this picture explains it better than my words: I'm working in directx so top-left is the filling convention. The texture coordinates goes from 0-(HalfPixel-FLT_MIN) to 1+HalfPixel and each coordinate has the range (HalfPixel >= Coordinate > -HalfPixel), the number of pixels in each level is power of two. The dimension of the top level texture (the leaf nodes) is 1024x1024 so I need 9 different offsets. Maybe someone know some article that talks about this subject? (I think I got all the numbers right)
51mon
51mon
Is it this simple:

0.5
0.25, 0.75 : Offset 0.25
0.125, 0.375, 0.625, 0.875 : Offset 0.125
...

?
AndyTX
AndyTX
If you're storing all of your images in one texture (i.e. with a single mip level), it will depend on the arrangement that you have chosen, but gnerally you divide your local texture coordinates (i.e. where 0-1 spans the current mip level) by two, and offset by the dimension of your current mip level.

If you're using *real* mipmapping (i.e. with an attachment surface chain), then simply use LOD bias to traverse to different levels without having to change your texture coordinates at all.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.