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

Distance fog changes colour based on height relative to ground plane #54

Open
danieldeankon opened this issue Apr 10, 2020 · 5 comments
Labels
enhancement New feature or request visuals Something should be prettier

Comments

@danieldeankon
Copy link
Contributor

It would be helpful when navigating to have some visual feedback about how deep or how high you are on a large scale. Equidistant surfaces tend to look equally curved beyond a certain size and it is difficult to find your way back to planar ground when you're on an equidistant.

@Ralith Ralith added enhancement New feature or request visuals Something should be prettier labels Apr 10, 2020
@Ralith
Copy link
Owner

Ralith commented Apr 10, 2020

A naive solution, passing the elevation into the shader and just picking a color before proceeding as usual, would be simple but incorrect and a bit ugly, as it doesn't account for the appearance of a view ray that passes through multiple layers of fog.

I suspect a reasonably cheap analytic model for the color of a ray passing through elevation-sensitive fog could be derived (@MagmaMcFry how's your calculus? I think we can pose this as a fairly straightforward integral), and even if not, a precomputed 2D LUT could still be used, parameterized by altitude and angle.

We'd have to fudge it a bit to keep visibility similar to the nonphysical exponential-squared fog we have now, of course.

@Ralith
Copy link
Owner

Ralith commented Apr 10, 2020

Relevant discussion of elevation fog in euclidean space: https://www.iquilezles.org/www/articles/fog/fog.htm

@Ralith
Copy link
Owner

Ralith commented Apr 10, 2020

it is difficult to find your way back to planar ground when you're on an equidistant.

While this is very true for the time being, I think it will be mitigated once we have collision detection, gravity, and gravity-based camera orientation. That said, nonuniform fog is still pretty.

@danieldeankon
Copy link
Contributor Author

A naive solution, passing the elevation into the shader and just picking a color before proceeding as usual, would be simple but incorrect and a bit ugly, as it doesn't account for the appearance of a view ray that passes through multiple layers of fog.

The naive solution was what I had in mind when I raised the issue---global fog colour as a function of elevation instead of a constant.

It seems there are multiple motivations, pulling in different directions, when it comes to designing and implementing how fog works. On one hand there's fog as merely something to solve problems such as chunks popping into existence too suddenly, or not knowing how far you are from the plane. On the other, there's fog treated as a physical feature of the world, where simulating it correctly is important for its own sake. And then there are aesthetic considerations. What's your overall vision for the place of fog in hypermine?

@Ralith
Copy link
Owner

Ralith commented Apr 11, 2020

I see thick fog as an unfortunate compromise we have to make due to a poor view distance, but so long as we're going to have it I'd like it to be pretty. In an ideal world where our view distance is much larger, we still want slight fog because it's a key element of depth perception, but it would be far more subtle, and more physically plausible. Elevation-based color variation is desirable regardless.

The naive solution is definitely an improvement, but an approach that models the effect of a ray passing through a range of elevations will be a large improvement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request visuals Something should be prettier
Projects
None yet
Development

No branches or pull requests

2 participants