# Geometry clipmaps

7 replies to this topic

### #1TiagoVCosta

New Member

• Members
• 4 posts

Posted 19 April 2011 - 05:10 PM

I have 2 questions related to geometry clipmaps:

1 - The value sampled from the elevation map is used in the z-coordinate of each vertex. Shouldnt it be used in the y-coordinate to change the elevation?

2 - is there any mathematical function to calculate the position of each 2D block?

### #2Reedbeta

DevMaster Staff

• 5311 posts
• LocationSanta Clara, CA

Posted 19 April 2011 - 06:58 PM

1. Depends whether you're using a Y-up or Z-up coordinate system. Both conventions can be found in the wild.
2. Need more context; can you elaborate?
reedbeta.com - developer blog, OpenGL demos, and other projects

### #3TiagoVCosta

New Member

• Members
• 4 posts

Posted 19 April 2011 - 07:26 PM

The terrain is made of 2d grids. How do I calculate the position and scaling of each 2D grid instance?

### #4Reedbeta

DevMaster Staff

• 5311 posts
• LocationSanta Clara, CA

Posted 19 April 2011 - 07:48 PM

Umm... x = column_index * grid_spacing, y = row_index * grid_spacing?
reedbeta.com - developer blog, OpenGL demos, and other projects

### #5TiagoVCosta

New Member

• Members
• 4 posts

Posted 19 April 2011 - 08:00 PM

I see your not familiar with Geometry Clipmaps
http://research.micr...oppe/gpugcm.pdf Check page 7.

### #6Reedbeta

DevMaster Staff

• 5311 posts
• LocationSanta Clara, CA

Posted 19 April 2011 - 09:29 PM

Ahh, a link to a paper! That would've been what I was asking for when I said "need more context".

First of all, for each ring you'll need to find out the origin of the ring. For the outer ring, this seems to be just the nearest grid point to the camera (using the grid size for that ring). So you'd take the camera coordinates, divide by the grid size, round to the nearest integer, then multiply by the grid size again.

From there, it should be simple to figure out the positions of the gray and green pieces. You just need to decide where you're measuring positions from. Let's say from the lower-left corner of each grid piece. Then, for instance, the gray piece labeled #1 in the diagram has coordinates of x = grid_spacing * (-2 * (m -1) - 1), y = grid_spacing * ((m - 1) + 1). You're just counting grid squares left, right, up or down from the origin. (m - 1) is the width of one the of the gray pieces.

Then you need to decide where to place the origin of the next inner ring, as that'll affect the placement of the blue pieces. There are four possible positions, each offset by half a grid square in X, Y from the outer ring's origin. Choose whichever is closest to the viewpoint.
reedbeta.com - developer blog, OpenGL demos, and other projects

### #7TiagoVCosta

New Member

• Members
• 4 posts

Posted 19 April 2011 - 11:07 PM

About the first question: Why anyone would use z-up, I believe theres more about it... Reedbeta can you check the check the shader in the page 11 of the paper? Thanks

### #8Reedbeta

DevMaster Staff

• 5311 posts
• LocationSanta Clara, CA

Posted 19 April 2011 - 11:51 PM

Why would anyone use Z-up? Why not? It's not like there's a law that says Y has to be up...to many people, it makes more sense to have X and Y be horizontal, and Z be vertical.

Anyway, I'm not going to "check the shader" for you, as I have more important things to do than try to read your mind about what you do or don't understand about it or what you think might be wrong with it...if you have a SPECIFIC question, I'll entertain that.
reedbeta.com - developer blog, OpenGL demos, and other projects

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users