🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

glsl shader management

Started by
0 comments, last by lc_overlord 18 years, 3 months ago
I'm currently developing an engine more for a portfolio than anything, but in my shader development I've run into a slight snag. Let's say I want to use uniform perpixel lighting on dynamic lights (shader one), and I want to use parallax mapping(shader two). Is there any way of combining different shaders but not make them the same like, can I have separate shaders for my different effects and just use a few of them, or do I have to have them all in one big shader and just have multiple versions for different settings from the user. So let's say the user keeps parallax mapping but turns off all shadowing which I'm going to use glsl for both. Is there a way to have those two different shaders be separate and just use the ones that apply?
Douglas Eugene Reisinger II
Projects/Profile Site
Advertisement
no there is no easy way to combine two shaders just like that.
However there are a few ways around this, you could use something called deferred shading.
In it you first render all the normals, textures, specularity and so on to separate textures, during this pass you could use your paralax mapping (witch is really only a perpixel uv coordinate deformation based on height).
After that you use the textures as an input for the ppl shader instead of the vertex shader.
some references
http://www.google.com/search?q=deferred+shading

Aleternatively if you have a sm3.0 capable card you could combine them into a few big shaders.
But the best thing (if not using deferred shading) would be to write a new shader for every material.

This topic is closed to new replies.

Advertisement