Rings around planets

Has anyone managed to get rings around planets Saturn Style?

Comments

  • edited February 11

    This doesn't really answer your question, since you're asking about EE, but SNIS has this, and I can describe briefly how it works: The ring is made of a mesh that is a flat circular disc with a hole in it. It extends from the planet surface to 4x the radius. There is a 256x256 texture containing all the ring textures. Each ring selects a single row of the 256x256 texture to be the cross section of the ring. The ring has a custom shader which maps this single row of the texture radially across the disc. The texture mapping allows for a variable inner and outer radius of the ring by altering how the texturing is mapped (the first and last pixels of each row of the texture are guaranteed to be transparent, and the sampling is clamped for values outside the inner and outer radius of the ring). Also, in the fragment shader a ray is cast back towards the sun and it checks if it intersects the sphere of the planet to determine whether this section of the ring is in shadow. Also, one side of the ring generally faces towards the sun, and the other away from the sun. This is calculated and taken into account for lighting, so that the ring has a light and a dark side. Likewise, in the planet's fragment shader, it shoots a ray towards the sun and calculates if it intersects the ring, and where, and samples the ring texture in order to render the shadow of the ring on the planet. I spent a lot of time watching this Cassini flyby video made from actual photographs... notice that the rings have a light and a dark side, the rings cast a shadow on the planet, and the planet casts a shadow on the rings, and the rings tend to be either entirely opaque or entirely transparent -- not much in the way of translucency there.


    I don't think you're going to get this kind of thing without custom shaders.

    Here are the shaders from SNIS.

    This is the shader for the planet, using cubemap textures. Apart from the ring shadows, there's a bunch of stuff for normal mapping, specular reflection, blinn-phong shading: https://github.com/smcameron/space-nerds-in-space/blob/master/share/snis/shader/textured-cubemap-and-lit-with-annulus-shadow-per-pixel.shader

    This is the shader for the rings: https://github.com/smcameron/space-nerds-in-space/blob/master/share/snis/shader/textured-with-sphere-shadow-per-pixel.shader

    Additionally, some kind of atmosphere helps. My atmosphere is kind of hacky, it's not the Sean O'Neil one with proper Mie scattering that you always see referenced, it's just some math that kinda looks right. It does do the orange sunset thing at the terminator by subtracting out blue and green light at a ratio that leave orange, iirc. Here's that one...

    Atmosphere vertex shader: https://github.com/smcameron/space-nerds-in-space/blob/master/share/snis/shader/atmosphere.vert

    Atmosphere fragment shader: https://github.com/smcameron/space-nerds-in-space/blob/master/share/snis/shader/atmosphere.frag

    What it looks like in the game: https://i.imgur.com/HKrW51O.png

  • Sadly not, I'll just have to play with a new object or second object

  • You can most likely add some generated ring mesh next to the sphere in the planet object here:

    Due to the 2D nature of the gameplay field however, you'll have to fiddle with it to get it to look nice, as looking on the rings head-on won't be really good looking.

Sign In or Register to comment.