Jump to content
  • Advertisement
Sign in to follow this  
Anfaenger

Pixel-sized gaps at LOD transitions after compressing vertices

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

Hi there!
 
I'm writing a voxel terrain engine which uses geomorphing/CLOD to render a seamless mesh which is composed of chunks with different LoDs (sizes and resolutions).
Each vertex stores its attributes both at the current and the next, twice coarser LoD; the correct attributes are selected in the vertex shader based on the size of the chunk's neighbors.
To reduce the size of a vertex to 32 bytes, I'm compressing vertex positions into 32-bit integers: {x:11,y:11,z:10}.
 
But this memory 'optimization' results in tiny gaps (dropped or shimmering pixels) at LOD transitions, like these:
n2WRyaW.png
 
To avoid these gaps, boundary vertex positions must precisely match between adjacent chunks.
 
I tried to quantize fine positions to 10 bits and coarse positions to 5 bits (so that 'quantization level/precision loss' would match between adjacent chunks which resolutions differ by 2), but that didn't work.
 
Should I store vertex positions at full precision?
Maybe, there is a simple and memory-efficient solution based on snapping positions to some global grid?
 

Share this post


Link to post
Share on other sites
Advertisement
I'm not sure if i understand everything, but assuming this:
Both (high and low detail) positions are initially the same at borders and so they will be using the same compressed bits. (Verify if you're not sure some rounding errors may happen)
There are no T junctions (a vertex in the middle of an edge).

If this is all the case there should be no gaps coming from the data.
So maybe what's happening is that the vertex shader uses different order of math instructions depending if high or low LOD. (compiler may reorder some stuff)
GLSL has some keywords to prevent this, but i forgot about it and can't find quickly.

Share this post


Link to post
Share on other sites

Floats are notoriously imprecise. I would imagine that you are losing enough precision in the float->integer->float conversion to cause a visible offset in vertex positions. Considering that you're losing more than half the bits of the float, I would almost guarantee it.

Share this post


Link to post
Share on other sites

I guess you decompress the position (i11:i11:i10 -> f32:f32:f32) and then add the offset of the chunk, as float. This will/would result in float precision issues.

Try to use integer offsets, therefor you decompress i11:i11:i10 to i32:i32:i32, add the integer offset and just now convert to f32:f32:f32.

Share this post


Link to post
Share on other sites

There are no T junctions (a vertex in the middle of an edge).


There clearly are T-junctions based on his screenshot.

2mff9ua.jpg

If your vertex positions start the same but end up at different positions, your routine is wrong.
Find out what is causing it.  You can snap vertices together, but this only hides the underlying issue.


L. Spiro

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!