Hey guys,
So I'm a few years into my part-time game project and have been learning HLSL and DirectX as I go. I'm pretty confident in my ability to write HLSL shaders to do pretty much everything I need currently but have a question about the general architecture of shaders and how they should fit together.
For example, I have a terrain shader that handles some funky texture, tile-based lighting stuff and shadow mapping as well as some special effects, like highlighting an individual tile or drawing some special construction lines.
I also have an entity shader that I use for all the objects in my game and can also do Blinn-Phong shading.
I also have many other specific use shaders, such as a water shader, a fire shader.. etc etc...
I've realised that I now want to add the shadow mapping code to the entity shader, as I originally only implemented it in the terrain shader. But then it occurred to me that I'll probably want that feature in some of the other shaders down the track.
So my first question is, should I be implementing a given feature (eg shadow mapping) multiple times for every shader that needs it, or should I be trying to create a "it-does-everything" shader? And as a follow up, could I be writing my shaders to be more modular? I'm currently not using the ability to have multiple techniques or passes as I don't follow how they should be used.
Postie
Member Since 28 Nov 2010Offline Last Active Yesterday, 06:50 AM

Find content
Not Telling