Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate potential inaccuracies in the surface normal generation for sloped terrain geometry #372

Open
rdw-software opened this issue Feb 18, 2024 · 3 comments

Comments

@rdw-software
Copy link
Member

rdw-software commented Feb 18, 2024

One of the issues I've found while investigating #345 and #352 is that the surface normals are clearly wrong (at least for slopes). It's unclear whether this is a big problem; it might explain why diffuse colors aren't rendered correctly, but it may also be a red herring. In order to investigate the impact of this, a flat terrain map should be created, by simply setting all heights to zerot:

  • If this fixes the inaccuracies observed in diffuse texture blending stage (simulated in the terrain shader), normals are the issue
  • If this doesn't fix the colors being "too dark" in pay_dun00 then there may be yet another problem that needs investigating
  • It should also (always) fix the shadows being projected to the walls of pay_dun00 and the slopes in xmas_fild01
  • Given that the rendition looks better for sloped terrain (IMHO), it's only worth "fixing" if it does cause the wrong diffuse colors

I'm fairly certain that they took some shortcuts here to generate less accurate normals faster, which explains the delta.

@rdw-software
Copy link
Member Author

This doesn't meaningfully change the output of the lighting model; Flattening the terrain doesn't resolve any of the remaining rendering issues, which makes me think that this is more or less completely irrelevant (within the acceptable margin of error).

@rdw-software
Copy link
Member Author

Looks like switching the output format from sRGB to RGBA fixed all remaining issues - at least as far as I can tell.

@rdw-software
Copy link
Member Author

Hmm... I think this was actually unrelated to the sRGB output; there are some inaccuracies on sloped terrain still. IIRC replacing the diffuse textures with a white (blank) image and disabling all other rendering features resulted in visible differences for the interpolated colors from the directional light source. I also feel like there are visible differences on xmas_fild01 (blue-ish tint).

No big deal, but I'll reopen this nonetheless. First, should try to reproduce the original issue in a flattened pay_dun00 though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment