`vPositionW` precision lost with huge plane in specific perspective

PG: https://playground.babylonjs.com/#LPI149#1
As you can see I use vPositionW for color output. If it is accurate enough, the border between blur and black should in the box.
I know it is the huge plane that cause the problem, but 200000 seems not really big for float32.
So is there any way to improve the precision of rasterization except using two float to store the value?

1 Like

You could split the plane into chunks to manipulate smaller values in the shader.

What is your use case? There are many tricks around limited precision depending on your use case so that’s an important factor.

Rasterization precision is bottlenecked by gpu precision which is still 32 bits in 2024 ^^', using 2 floats is very likely not a good solution because of the complexity and overhead it will bring.

2 Likes

it’s so weird that I can repro this 100% of the time on one of my laptops, but 0% of the time on the other.
On both firefox and chrome

I wonder why that is, does dpi/4k screen make a difference, does nvidia vs amd gpu make a difference? so strange : O

1 Like

Maybe @Evgeni_Popov might have an idea ?

In the mean time, you can subdivide the ground plane more to workaround the issue.

1 Like

I’ve no idea where the problem comes from… I can see artifacts when I rotate up and down a little, but after a little while the artifacts disappear… It’s as if the calculation of the clipped coordinates by the GPU was not accurate enough at start, but is fixed in the end by some kind of “magic”…

3 Likes

I tested on 4 computers, 2 amd and 2 nvidia, it seems only nvidia have the problem while amd work well.
@CrashMaster,@sebavan, subdividing the ground plane works for the situation.

It is really wired that the problem only happens in a few perspective, if you set the alpha and beta manually it will still appear.

2 Likes