Posted 19 April 2011 - 05:10 PM
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?
Thanks in advance.
Posted 19 April 2011 - 07:26 PM
Posted 19 April 2011 - 09:29 PM
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.
Posted 19 April 2011 - 11:07 PM
Posted 19 April 2011 - 11:51 PM
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.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users