fenomas / noa

Experimental voxel game engine.
MIT License
611 stars 87 forks source link

Image artifacts with textures on blocks when moving #108

Closed Jarred-Sumner closed 4 years ago

Jarred-Sumner commented 4 years ago

Sorry to bother you again

This color thing is always present, but its especially noticeable when moving: gifgif

At first I thought it was an artifact from running a PNG optimizer on all the textures, so I tried without that but the textures look the same.

I also looked at this thread https://forum.babylonjs.com/t/help-on-eliminating-annoying-artifacts/5452 and tried:

scene.getEngine().setHardwareScalingLevel(1 / window.devicePixelRatio);

and

  const pipeline = new DefaultRenderingPipeline(
    "defaultrendering",
    false,
    scene,
    [scene.activeCamera]
  );
  pipeline.fxaaEnabled = true;
  pipeline.samples = 4;

I also tried setting lightSpecular to [0,0,0], [1,1,1] and the clearColor of the scene but none of these made a big difference

Any ideas what might cause this?

fenomas commented 4 years ago

I'm not much of a 3D expert, but it looks like a job for anisotropic filtering to me? I believe in Babylon filtering can be set per-texture, but IIRC there are some webgl limitations - e.g. I think on windows you can't have anisotropic filtering and nearest-neighbor filtering (i.e. pixelated textures) at the same time, you have to choose one or the other.

But note I don't know any Babylon-specific details here, like whether there's a markAsDirty flag you need to set after changing these sorts of properties.

Jarred-Sumner commented 4 years ago

Sounds good I'll look into anistropic filtering