Insula :: shader efforts with shadows and transparency

I wrote, revised, scrapped and rewrote the shaders and the associated engine infrastructure that handled hiding and revealing the insides of objects. These vines are the fruits of my efforts:

neat animations but poor lighting

{{vine //}}

While I was (and still am) very proud of the way the world animates when you walk inside of an enclosed space, I was frustrated with the odd shadow effects on the hidden walls. At this point I didn't understand the concept of a shadowpass in a Unity surface shader.

I was unaware that shadows were applied in their own pass (draw call). My naive attempts at this shader were focused around lerping the alpha channel in a surface shader. Clearly I needed to go deeper.

vert and frag shaders

{{vine //}}

Now would you look at that (the vine above)... it works! Even on openglES devices. In case it isn't clear, the difference is in the shadow. Specifically, transparent objects no longer render their shadowmap overtop of the geometry below.

After plumbing the depths of the documentation and built in shaders I decided to rewrite the surface shaders for typical frag/vertex shaders. Furthermore I had to implement my own shadowpass which I learned from studying the built-in shaders. What I did exactly is a post for another day because...

Unity 5

It's been a while since I've worked on this project and Unity 5 completely changed how shadows are worked in shaders. I would have to-reinvent this system all over again, I'm afraid. That being said, I think the new GI features would make this much simpler than before.

cross section shader

I never ended up using this but it's pretty neat.

{{vine //}}

Brandon Catcho

Senior Software Engineer at TechSmith Corporation. I write/record music and explore game development on the side. All views expressed here are my own.

Lansing Michigan