View Full Version : Shadowmapping (Core GL3.0) avoiding deprecation
06-12-2010, 10:58 AM
I'm finishing this simple & fast 3d engine by adding a shadowing system. What I am finding difficult in implementing shadowmapping is not the technique per se, but choosing what's best for a GL 3.0 / GLSL 1.5 profile: most of the examples I find around are using deprecated stuff (ex. shadow2DProj), not to mention the matrix stack. So I wonder if anyone can give me some directions to what's the core way of pursuing this feature.
06-12-2010, 02:44 PM
What I am finding difficult in implementing shadowmapping is not the technique per se, but choosing what's best for a GL 3.0 / GLSL 1.5 profile: most of the examples I find around are using deprecated stuff (ex. shadow2DProj), not to mention the matrix stack.
Yeah, true. One easy way is just to temporarily flip your shaders up to #version 150 and see what breaks. Then you know what you'll need to update to run with that version.
You know some of the issues -- most GL built-ins are gone and you need to provide your own. For instance, built-in vertex attributes: gl_Vertex, gl_Normal, gl_Color, etc. Just use your own names and then glBindAttribLocation to bind them to a generic vertex attribute index.
Same thing with most built-in uniforms (e.g. gl_ModelViewMatrix). Use your own names and provide them yourself. As a first-step, use your own names and grab them directly off the fixed-function modelview stack to populate your user-define uniforms. Then later you can roll your own matrix stack.
Also, in GLSL 1.3 they got rid of the "type names" in the texturing functions (and also the "shadow" vs. "texture" string) to cut down on the number of texture sampling function names. So now e.g. texture2DProj() and shadow2DProj() are both textureProj().
You'll find this and anything else just flip "flipping up" to #version 150 and trying it.
06-12-2010, 05:24 PM
Thanks for the info Dark Photon but.... I knew all that already ;) If only I "met" you before! Took me ages to purge both code and shaders from all the deprecated stuff, and before I found out the #version directive it was even harder.
Anyway, now I was asking something more specific: if someone perhaps can point me to some whitepaper describing a gl 3.0+ technique for shadowmapping. Everything I found is barely gl 1.4, I could of course just replace the fixed pipeline code, and stuff like texture2DProj with textureProj, but I was wondering if perhaps there's some advanced technique that thanks to the latest GL capabilities is substantially, architecturally different.
06-13-2010, 03:58 AM
I don't think there is a ogl 3.2 way. The way you would do shadow mapping doesn't really differ from the ogl 2.1 method (other than glsl functions being different). I can only think of one and that has to do with shadow mapping with point lights were you use the geometry shader other than that the way shadow mapping is done is no different between the versions from what I've seen.
06-13-2010, 08:35 PM
I was wondering if perhaps there's some advanced technique that thanks to the latest GL capabilities is substantially, architecturally different.
If you're talking about basic hardware shadow map comparison shadow maps (PCF or no filtering), then no. It's the same stuff, just slightly different syntax.
If you're talking faster and higher quality shadow map filtering techniques than that such as VSM, ESM, and variants, then yeah those're out there, but there's not any "secret sauce" added to OpenGL/GLSL to make those possible (they just "are" possible), except support for rendering to and reading from floating point textures.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.