Shadow Mapping in GLSL

Troy Corbin Developer Updates Leave a Comment

Hi Folks,

I haven’t updated things here in a while, and despite not feeling as if I have anything finished and polished enough to show off, we have made enough progress that I decided to throw caution to the wind. Or into the shadows, as it were.

I’ve spent almost this entire weekend learning GLSL ( OpenGL Shading Language ), implementing it in the engine, and then writing my first Shader to implement shadow mapping.

Let me just say… I haven’t found a single tutorial on the web that takes you through this process A-Z. Not one. Either some crucial piece was missing like how you need to set the texture compare mode on the Depth Texture (Hint: Use glTexParameteri( GL_TEXTURE_2D , GL_TEXTURE_COMPARE_MODE, GL_COMPARE_R_TO_TEXTURE );),  or there were stupid bugs like dividing the Shadow Texture coordinates by w, then turning around and using Shadow2DProj which also divides by w. Of course, as a noob you don’t know all this and you end up wondering why your shadows don’t work or make sense. I’m actually amazed that I still have hair.

However, now that all that is over with, I’m super stoked. I’ve managed to implement GLSL Shaders in an object oriented way so that each Material can have it’s own shader program, or use the fixed function pipeline. This will be a huge plus as I migrate more and more materials over from the fixed pipe. Having GLSL support also ensures that I can start pumping out some crazy-awesome effects for weapons and explosions.

Before this whirlwind of Shader goodness, I was heavily working on implementing our GUI. I have working video and audio options menus ( though they still need more options available ) and I also have a foundation in place for the critical inventory screen. Obviously for a game where mining and crafting will be a key component, it’s important that I get this screen and it’s user interface right, so I’ll likely spend a lot of time play testing and tweaking the inventory screen.

Also I’ve decided to upgrade my workstation. The logic was simple: if I intend to produce cutting edge visual effects, I need to be able to see just what those effects looked like. Pedantic Games currently uses an ATI Radeon HD 4850 w/ 512meg of RAM that I bought years ago. ( Before I bought my house, which was 2009 ) Newegg is shipping me a new Gigabyte Radeon 7950 w/ 3 gig of RAM. Since it’s shipping from close by ( Memphis ) it should arrive tomorrow night, which will be great as I still have a lot of work that I want to get started on this week ( graphically speaking ). With luck I’ll finally be able to push out a decent video with commentary for this weekend’s Screenshot Saturday. I’ve been so dissapointed with my video quality in the past that I haven’t made a video in several months. It was so long ago that I still didn’t have working AI, or death. Wow.

Oh! And finally, a comment left on this blog lead me to www.solcommand.com, which offers free to use space ships and related 3d models. Honestly I have very limited graphical talent, and I’m not very comfortable with Blender yet, so these resources will probably be very handy in the weeks to come. Thanks SolCommand!

Troy CorbinShadow Mapping in GLSL

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.