Jump to content

  • Log In with Google      Sign In   
  • Create Account


GeoClipMapping and Artefacts


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 PhillipHamlyn   Members   -  Reputation: 454

Like
0Likes
Like

Posted 27 February 2013 - 04:53 PM

Hi,

 

I've followed the information in Geo Clip Mapping for my terrain as far as I understood it, but am getting very unsatisfactory results, and hope someone might point out my error;

 

I have a series of annular meshes that I render for each frame. I have a single large heighmap and text2dlod sample it in the vertex buffer and assign the height to the Y coordinate. I merge the boundaries between the meshes by sampling coarse and fine meshes and lerping the result.

 

This works fine, and very fast too. However the actual visuals are horrible, so I must have misunderstood the technique. As the camer moves across the landscape, the meshes dont move - they are locked to the camera and the highest detail mesh is always nearest the camera. However as the mesh density drops away in the concentric rings moving the camera visibly pops the geometry as it rolls over any reasonably non-flat heightmap. Its not that the geometry or sampling are incorrect, its just that the distant geometry is clearly visible as "waves" as the underlying heightmap pushes up one side of a triangle, then the other, as the camera moves towards it. Especially visible on ridge lines.

 

What am I doing wrong here - is distant geometry not supposed to be refreshed with every frame ? Would that not just lead to even more aggressive popping ?

 

Other than the GPU Gems article, can anyone point me to another source for GeoClipMapping so I can read a different source ?

 

Thanks,



Sponsor:

#2 CC Ricers   Members   -  Reputation: 623

Like
0Likes
Like

Posted 27 February 2013 - 05:22 PM

The trick to getting good looking terrain silhouettes is to get it as close to 1 screen pixel to grid unit as possible. But that's the ideal resolution. Far-away clipmaps could probably do with just looking the same density as the closest level clipmap, given the screen space. The best looking geo clipmap samples I've seen polish it up by providing seamless boundaries, and terrain morphing. The morphing happens as the camera moves, but at any moments there would be a gradual change in detail from the interior of a clipmap to the exterior. This makes the pushing and moving of triangles look more gradual. Using cubic interpolation could also help.

How far back to start the "morph line" in the clipmaps is up to you. The closer it is to the edge, the more quickly it morphs, and the closer it is to the inner perimeter, the more gradually it morphs, but with more triangles changing at once.

This can be done in two ways: expand some of the triangles on every other row/column by interpolating the distance from the line, so that the largest triangles meet become as large as the the coarser resolution of the next clipmap. Or, instead of pushing the triangle vertices sideways you gradually interpolate the "real" height with the average height between two vertices, again working on every other row and column.

 

Also here is an interesting non-clipmap based solution that works with large terrains as well, using "pizza slice" static meshes that is apparently easy on the CPU. My problem with geoclipmaps (though I still use them) is that you sometimes notice drops in framerates if you move the camera rapidly, thus requiring more frequent updates.


My development blog: Electronic Meteor

#3 Syranide   Members   -  Reputation: 375

Like
0Likes
Like

Posted 28 February 2013 - 08:42 AM

Images please!

 

Anyway, "you talk about visibly propagating waves", to me this seems like the size of your transition/interpolation area is too big, i.e, it should be perhaps 10-20% at most. Put it higher than that and you sacrifice quality (for the given performance hit) and the terrain always looks like it's changing.

 

Also, note that heightmaps are not well-suited to high-frequency detail. I used real world data in my implementation of geoclipmaps which was somewhat high-frequency, I tried everything from low-quality to high-quality meshes and flew over the terrain at high speeds, and even then I could not really say that I felt bothered by the transitions other than in the worst high-frequency areas. So I would say it's a problem in your implementation (or heightmap resolution).

 

Also! I recommend that you don't compute the normals when sampling, sample them from a separate texture instead, hides the transitions a bit better and with the added bonus that you can use higher resolution normal textures (produces really good visuals even with low quality meshes).

 

Another thing, I don't remember the specifics at the moment and am too dumb to make sense of it right now, but in your transition area remember that it applies to triangles, you can't just sample in the middle if you want exact results, you need to do multiple samples (if this doesn't make any sense, just forget it). Otherwise you will find that certain the triangle pops in certain higher-frequency areas (i.e an /\ -shape will pop significantly and not interpolate), but it might not be warranted depending on your terrain.


Edited by Syranide, 28 February 2013 - 08:51 AM.




#4 PhillipHamlyn   Members   -  Reputation: 454

Like
0Likes
Like

Posted 28 February 2013 - 02:00 PM

The trick to getting good looking terrain silhouettes is to get it as close to 1 screen pixel to grid unit as possible. But that's the ideal resolution. Far-away clipmaps could probably do with just looking the same density as the closest level clipmap, given the screen space. The best looking geo clipmap samples I've seen polish it up by providing seamless boundaries, and terrain morphing. The morphing happens as the camera moves, but at any moments there would be a gradual change in detail from the interior of a clipmap to the exterior. This makes the pushing and moving of triangles look more gradual. Using cubic interpolation could also help.

How far back to start the "morph line" in the clipmaps is up to you. The closer it is to the edge, the more quickly it morphs, and the closer it is to the inner perimeter, the more gradually it morphs, but with more triangles changing at once.

This can be done in two ways: expand some of the triangles on every other row/column by interpolating the distance from the line, so that the largest triangles meet become as large as the the coarser resolution of the next clipmap. Or, instead of pushing the triangle vertices sideways you gradually interpolate the "real" height with the average height between two vertices, again working on every other row and column.

 

Also here is an interesting non-clipmap based solution that works with large terrains as well, using "pizza slice" static meshes that is apparently easy on the CPU. My problem with geoclipmaps (though I still use them) is that you sometimes notice drops in framerates if you move the camera rapidly, thus requiring more frequent updates.

 

Do you mean in your first para that my geometry quad size should be as close to 1 screen pixel as possible ? In terms of height sampling I use linear interpolation in the vertex shader, but in reality my terrain quads are enormously bigger than a screen pixel, so I'm clearly way out in terms of resolution; no wonder it look like rubbish.

 

I've had a look at the pizza slice example, which is kind of what I'm doing with fixed concentric meshes, but more optimal - I can see its better performance, and I might try it once I get the geometry->screen space relationship sorted.

 

Thanks for the tip.



#5 PhillipHamlyn   Members   -  Reputation: 454

Like
0Likes
Like

Posted 28 February 2013 - 02:04 PM

Images please!

 

Anyway, "you talk about visibly propagating waves", to me this seems like the size of your transition/interpolation area is too big, i.e, it should be perhaps 10-20% at most. Put it higher than that and you sacrifice quality (for the given performance hit) and the terrain always looks like it's changing.

 

Also, note that heightmaps are not well-suited to high-frequency detail. I used real world data in my implementation of geoclipmaps which was somewhat high-frequency, I tried everything from low-quality to high-quality meshes and flew over the terrain at high speeds, and even then I could not really say that I felt bothered by the transitions other than in the worst high-frequency areas. So I would say it's a problem in your implementation (or heightmap resolution).

 

Also! I recommend that you don't compute the normals when sampling, sample them from a separate texture instead, hides the transitions a bit better and with the added bonus that you can use higher resolution normal textures (produces really good visuals even with low quality meshes).

 

Another thing, I don't remember the specifics at the moment and am too dumb to make sense of it right now, but in your transition area remember that it applies to triangles, you can't just sample in the middle if you want exact results, you need to do multiple samples (if this doesn't make any sense, just forget it). Otherwise you will find that certain the triangle pops in certain higher-frequency areas (i.e an /\ -shape will pop significantly and not interpolate), but it might not be warranted depending on your terrain.

 

In your first para, do you mean that each concentric mesh ring should be no more than 20% less detailed that the nearer one ?

 

I agree about heightmaps - I apply a pertubation map over the top to make it more detailed.

 

I agree about the normals - I have a precomputed normal map.

 

In terms of sampling the heightmap, I use linear interpolation in the vertex shader (4 lookups) to make sure I dont pop the triangle corners.

 

I think your comment about resolution dropoff is probably where I'm going wrong - I think I'm being far too aggressive in reducing mesh resolution, leading to a world of popping. Another reply mentioned a target quad size of 4 pixels (or 1 pixel per vertex, if you like). Do you concur with this ?



#6 PhillipHamlyn   Members   -  Reputation: 454

Like
0Likes
Like

Posted 01 March 2013 - 02:56 AM

Thanks for the tips. I now understand my mistake.

 

Firstly I was allowing my geometry to be locked to the camera position, whereas I should have been offsetting it to the nearest whole texel (heightmap) location, otherwise almost all my heights end up being interpolated and therefore each vertex was changing its height on every frame - accurate, but gave a really inconsistent "ocean wave" effect. The popping that results as I transit between one texel and another is un-noticable now.

 

Secondly I didn't understand that, to get the best visual effect, that you should aim for a 1:1 relationship between your least detailed LOD geometry and the heightmap resolution. I haven't done this yet, but I can understand how this would reduce massively the "distant skyline" popping effects I was getting.

 

Phillip H



#7 samoth   Crossbones+   -  Reputation: 4682

Like
0Likes
Like

Posted 01 March 2013 - 08:51 AM

The trick to getting good looking terrain silhouettes is to get it as close to 1 screen pixel to grid unit as possible.

Note that you will often want a considerably (5-8 times) grid size anyway.

The reason for that is that you're having diminuishing gains in visual quality as triangles cover fewer than a dozen or so pixels, but the amount of pixel shader work and ROP pressure literally starts to explode as triangle sizes get smaller.

Given a roughly pixel-sized grid, you can in the worst case end up having 4 instances of the pixel shader being run and blended for every pixel for every grid cell, only for 3 values to be discarded in the end.

Now at silhouettes, where more than one grid cell projects to a pixel (but only the frontmost is visible), you could run the pixel shader maybe a hundred times, only to discard all but the fragment with the smallest Z value in the end.

#8 PhillipHamlyn   Members   -  Reputation: 454

Like
0Likes
Like

Posted 03 March 2013 - 10:03 AM

The trick to getting good looking terrain silhouettes is to get it as close to 1 screen pixel to grid unit as possible.

Note that you will often want a considerably (5-8 times) grid size anyway.

The reason for that is that you're having diminuishing gains in visual quality as triangles cover fewer than a dozen or so pixels, but the amount of pixel shader work and ROP pressure literally starts to explode as triangle sizes get smaller.

Given a roughly pixel-sized grid, you can in the worst case end up having 4 instances of the pixel shader being run and blended for every pixel for every grid cell, only for 3 values to be discarded in the end.

Now at silhouettes, where more than one grid cell projects to a pixel (but only the frontmost is visible), you could run the pixel shader maybe a hundred times, only to discard all but the fragment with the smallest Z value in the end.

Samoth,

 

Thanks for the tip.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS