Flicker Issue on Overlapping Surfaces

Aug 16, 2011 at 1:34 PM

I have a Silverlight 5 app using DrawingSurface and Babylon Toolkit. I render all my models by rceating triangles using VertexPositionNormalColor.

Everything looks fine except when two triangles happen to have an overlap in 3D space, that is, they are on the same exact plane. When this happens, the rendering will not be consistently of one or the other triangle but rather it appears to sometimes render one, sometimes the other. This appears independent of the order that the triangle indices are loaded into the buffers. When my camera or my model moves this shows up as a flicker on any overlapping areas, extremely noticeable.

Here is a short video showing the issue: http://www.youtube.com/watch?v=DNAcOLQ7rms

 In the demo above the vertex buffers are held constant, only the camera position is animated. 

Any ideas on where to look or what could be going on? Any help would be appreciated.

 

Developer
Aug 17, 2011 at 7:35 AM
This is a classic behavior in 3d and it is not specific to sl5/xna.
The problem is that when the CPU or gpu computes operations on floating point numbers (transforming vertex coordinates for example), the result is not absolutely precise (and not really deterministic as well). So, at each frame, result of computations can make 1 or the other surface appear closer to the camera. This produces flickers.

The only workaround that I know is to rework your model to eliminate this issue

Envoyé à partir de mon Windows Phone

De : ercercerc
Envoyé : 16/08/2011 15:34
À : simon.ferquel@hotmail.fr
Objet : Flicker Issue on Overlapping Surfaces [babylontoolkit:269253]

From: ercercerc

I have a Silverlight 5 app using DrawingSurface and Babylon Toolkit. I render all my models by rceating triangles using VertexPositionNormalColor.

Everything looks fine except when two triangles happen to have an overlap in 3D space, that is, they are on the same exact plane. When this happens, the rendering will not be consistently of one or the other triangle but rather it appears to sometimes render one, sometimes the other. This appears independent of the order that the triangle indices are loaded into the buffers. When my camera or my model moves this shows up as a flicker on any overlapping areas, extremely noticeable.

Here is a short video showing the issue: http://www.youtube.com/watch?v=DNAcOLQ7rms

In the demo above the vertex buffers are held constant, only the camera position is animated.

Any ideas on where to look or what could be going on? Any help would be appreciated.

Aug 17, 2011 at 1:24 PM

Thanks for the reply. Yes, I am learning this is a classic problem. There are quite a few "fixes" floating around the web but I have yet to find one that works in my case other than modifying my model. In my case the moel is created programmatically so it will be quite difficult to have a general solution that works in all cases without distorting the model itself. But I need to do some work on this and see where I land.