Planet Shader TypA

Some changes must be made to the EngineDesign to realize the PlanetShader.

• Multipass Shader implementation
• Deal with transparent Material
• Better and brighter Glow-Pass
• Managing state changes by Material

How the Shader works
The Shader works perfekt on simple SphereGeometry. Here ist the basic idea how to do it.

Draw the opaque textured sphere. Calculate a basic-rim, sharpen the rim and discard some rim-pixels. You can use the basic-rim-value to calculate the color of the atmosphere. Add the atmospheric color to rgb-out.

//basic rim-gradient
float rim  = 1-saturate(dot (view,N));
//sharpen rim edges for clipping
float RimOfAtmos = min(1,pow(rim,RimIntensity *30) *10);
//clip some geometry



Draw transparent atmospheric glow. Use the same values for rim calculation. Output just the atmospheric rim color and apply a glow pass to the result. Add the glow on top. Because the glow can not lit by the DeferredLightPass, you have to lit it directly in the MaterialShader (NdotL).

PlanetShader atmospheric glow

atmospheric glow

Night Light
The engine supports EmissiveLight. So it was easy, just applied the EmissiveLightMap multiplied by a color and render it to the glow target. Invert and sharpen NdotL to apply the emissive parts only on the dark side.

PlanetShader light and emissive nightlight

light and emissive nightlight

Bright Glow
A simple big graussian blur pass is not enough to get a nice glow or bloom. A better and faster way is to use multiple shorter blur passes and add the results. Now the Glow/Bloom Pass is using four BlurTargets with different sizes, Fullsize/2, Fullsize/4, Fullsize/8, Fullsize/16. Add all results to get the final Glow/Bloom effect. This technique produces nice bright results and reduces flickering.




Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s