thombruce / verse

🚀 A universe in progress
Other
8 stars 0 forks source link

Potential Distance Issue with Shader-based Background #121

Open thombruce opened 8 months ago

thombruce commented 8 months ago

I was noticing a weird artefact near the origin of the shader background - a sort of bloom with a cross-section, probably an artefact of calculations near to 0.,0.

To try to hide this, I attempted to set some initial coordinates far, far away from that origin. The result was a loss of detail and a set of large pixelated artefacts being rendered.

Given that all I did was add N to the X and Y values (where N was a number in the 10s of thousands - relatively small), I fear that the shader might produce those artefacts again once the player moves far away enough from the origin.

I am not presently sure how concerned to be about this (the apparent motion of the shader is the players motion divided by a large number, so it will take some distance before it is an issue), but it is worth noting.

thombruce commented 8 months ago

Image with large values added to X and Y:

image

And how it is supposed to look (no values added):

image

The difference (above is with the adjustments producing the bug, below is without):

- var from_ = vec3<f32>(100000.0 + (background.position.x / 50000.0), 100000.0 + (-background.position.y / 50000.0), 0.5);
+ var from_ = vec3<f32>(background.position.x / 50000.0, -background.position.y / 50000.0, 0.5);

It's just a large value added to X and Y, meaning we probably encounter the effect if we travel out beyond some distance...