Tonight, I added some quick and dirty soft shadows to Stained. This had two effects:
- It made the sphere in the scene look more realistic by effectively diffusing them.
- It made the stained glass look more realistic by mixing some colors together while keeping some splashes of rich colors.
To accomplish this feat, I added some code to sample in the 6 basic directions relative to my light source, since technically my light source is not a point source, and has width, height, and depth, as well as the center point. So these 7 checks I added are done in a loop in my shadow function, including the center point of the light, of course. Normally, you would want to randomly sample dozens of these points, and probably in a greater number than 7, but this was fast and effective enough to create the basic desired effect in real-time in this case.
I’m actually really happy with the amount of improvement this one little adjustment has made to the scene.
Here’s the live shader (loads fastest in Chrome):