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

improve planet rings shaders #5708

Merged
merged 3 commits into from
Jan 18, 2024
Merged

Conversation

Mc-Pain
Copy link
Contributor

@Mc-Pain Mc-Pain commented Jan 8, 2024

All rings are assumed to be icy

  1. Each object in ring is darker depending of its phase
    (like Moon phases)
  2. Each object shines brightly if sun is behind the ring
    (lot of low angle specular reflections)
  3. Each object shines brightly if looking from the sun
    (simulating high geometric albedo > 1.0)

@bszlrd bszlrd added Cosmetic or UI Rendering Everything related to rendering and removed Cosmetic or UI labels Jan 8, 2024
@Web-eWorks
Copy link
Member

Snapshot_2024-01-08_20-44-24
Snapshot_2024-01-08_20-42-59
Snapshot_2024-01-08_20-42-01
Snapshot_2024-01-08_20-40-12

This looks quite good, excellent work! I have two concerns:

  • First, there is a clear black "terminator" at the inner and outer edges of the overall ring structures. I assume this is probably caused by erroneous vertex colors being passed when generating the ring meshes. I'd like to see this resolved before merge.
  • Secondly, there's a clear/sharp shadow terminator between shadowed portions of the ring and unshadowed portions. I'd like to see a softer shadow computation here, as the current terminator is not only a bit unnatural (ignores partially-shadowed light reaching the ring / gravitational lensing / edge-of-atmosphere light diffusion) but also suffers from a lack of anti-aliasing.
    This is not a concern that needs to be addressed before merge, but I would like to be improved post-merge if you are able.

data/shaders/opengl/planetrings.frag Outdated Show resolved Hide resolved
@impaktor
Copy link
Member

impaktor commented Jan 9, 2024

Secondly, there's a clear/sharp shadow terminator between shadowed portions of the ring and unshadowed portions. I'd like to see a softer shadow computation here .... This is not a concern that needs to be addressed before merge

Indeed, this can be left to another day. But forgive me if I sound like an imbecile, but shadows in vacuum of space are very "hard", right?. So personally, I don't see that as an issue, (but I haven't tried the branch).

@bszlrd
Copy link
Contributor

bszlrd commented Jan 9, 2024

@impaktor Shadow softness is more of a function of the size of the light source and the distance between the object and the surface where the shadow is cast. The bigger it is, the softer the shadows, and the further away the surface is, the softer as well. You can observ this even here on Earth: the shadow of a tall pole will be much sharper at the base compared to its top/furthest from the object. Similar to how they show the penumbra on those lunar eclipse explanations:
Geometry_of_a_Lunar_Eclipse svg

EDIT, this image might exaggerate the softnes, and this one might be closer:
image
image

The Sun is about 10 times larger than Saturn for example, and the shadow on the rings would look about like this:
image
(Quickly put together in Blender, Saturn and Sun size and distance is to scale)

Regardless, I think this PR is cool as is, and this part could be tackled later on if there's inclination to do it.

@Web-eWorks
Copy link
Member

Additionally, the sharpness of the shadow is partially because the shadowing condition is evaluated per screen pixel and produces a very "jagged" edge without any attempt at anti-aliasing.

All rings are assumed to be icy

1) Each object in ring is darker depending of its phase
   (like Moon phases)
2) Each object shines brightly if sun is behind the ring
   (lot of low angle specular reflections)
3) Each object shines brightly if looking from the sun
   (simulating high geometric albedo > 1.0)
@Web-eWorks Web-eWorks merged commit f9a920c into pioneerspacesim:master Jan 18, 2024
6 checks passed
@Mc-Pain Mc-Pain deleted the ring-shaders branch January 26, 2024 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Rendering Everything related to rendering
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants