Jump to content

[SOLVED] Auxiliary buffer is doing depth test since 2.7.3 which results in Z Fighting


photo

Recommended Posts

Hi,

I just port our project from 2.7.2 to 2.7.3 and discovered that the auxiliary buffer is doing a depth test now.

My material is set to disable depth test and depth mask to prevent depth testing and writing so I can write all pixel in the auxiliary buffer to do the outlining with a sobel later.

It worked without problems in 2.7.2..

Is there a workarround without offsetting the geometry from the ground plane?

Sample code and video is in the attachement.

Thanks,

Sebastian

source.zip

Link to comment

Hello @sebastian.vesenmayer,

Consider using the Geometry Inflation feature as a possible workaround. Yes, it inflates the geometry, but the offset is not so perceptible on small values and the pivot point is not moved. Just add a couple of lines to your init function:

...
objMeshStatic->setMaterialParameter("auxiliary_color", Unigine::Math::vec4(1.f, 0.f, 0.f, 0.f), 0);

// enable the Geometry Inflation
objMeshStatic->setMaterialState("geometry_inflation", 1, 0);
objMeshStatic->setMaterialParameter("vertex_balloon", Unigine::Math::vec4(0.01f, 0.f, 0.f, 0.f), 0); // 0.01f is pretty enough

return 1;
}
...

It works like a charm in your sample project. If it is not acceptable for your logic, we'll come up with other ways.

Image 3.png

Thank you!

Link to comment
On 1/14/2019 at 5:46 AM, thomalex said:

Hello @sebastian.vesenmayer,

Consider using the Geometry Inflation feature as a possible workaround. Yes, it inflates the geometry, but the offset is not so perceptible on small values and the pivot point is not moved. Just add a couple of lines to your init function:


...
objMeshStatic->setMaterialParameter("auxiliary_color", Unigine::Math::vec4(1.f, 0.f, 0.f, 0.f), 0);

// enable the Geometry Inflation
objMeshStatic->setMaterialState("geometry_inflation", 1, 0);
objMeshStatic->setMaterialParameter("vertex_balloon", Unigine::Math::vec4(0.01f, 0.f, 0.f, 0.f), 0); // 0.01f is pretty enough

return 1;
}
...

It works like a charm in your sample project. If it is not acceptable for your logic, we'll come up with other ways.

Image 3.png

Thank you!

As you can see on your picture the outline is now generated arround the Ball.

If something would block the sight, the outlining will vanish.

Polygon offset is not working for us.

We did render it without depth test to make sure that fine height differences won't affect it on the zero ground. We cannot exactly say what the height is, since every scenery is different.

Best practise may be to define the same blending functions in auxiliary as in deferred and forward rendering procedure.

Link to comment
  • morbid changed the title to [SOLVED] Auxiliary buffer is doing depth test since 2.7.3 which results in Z Fighting
×
×
  • Create New...