Depth Buffer
Note: In my last post shaders 36 and 37 weren't working correctly so I replaced them. If you got the old ones you can throw those out and re-download the new ones on the same links.
These shaders are based on the Leadwerks soft particle shader, which I was directed to by Marcousik, and which I noobalyzed into a model shader. What the soft particle shader does is create a soft falloff in opacity depending on how close objects are behind it. To clarify, imagine looking down at a water plane, and a terrain beneath it. Depending on how far away the terrain is from the water plane determines how much of the effect you see. If the water plane is near the ground along the shore it is invisible. But on the deep end, where the ground and the water surface are far apart you get more opacity in the effect.
The core of what's going on is you're getting the distance from the eye or camera to the water plane, and the distance from the eye to the terrain surface, and then you're finding the difference between the two.
This shader makes nice fog effects. Just make a plane and set the shader on it, and adjust the height to your liking:
If you invert the effect using "1-diff" you get a strong opacity near objects which then fades to alpha the more space there is between its surface and the surface behind it. That's how I was able to make this forcefield shader:
Happy shading!
Next: Tessellation...
- 7
0 Comments
Recommended Comments
There are no comments to display.