Sign in to follow this  
RealMarkP

Shader Subsystem Design Help

Recommended Posts

RealMarkP    216
I've been thinking about this a lot lately. I cannot decide on how to design my shader subsystem of my engine. Assume that my engine has the capability to support Shaders. What I am stuck on is how to design my objects (Shader, state, program, Compiler, Etc). Could anyone here give me an example of how they might ahve implemented a shader system or point me to some resources? Thanks in advance.

Share this post


Link to post
Share on other sites
Ashkan    451
Take a look at the infamous Material/Shader implmentation thread if you have not already. There are also quite a few threads that bring up some questions regarding some of the points that's discussed in the aforementioned thread which you can find using the search feature. Anyway, that thread is somehow outdated and I'd argue that there are more flexible ways to implement such a system in 2008.

For one thing, I strongly advise you to leverage the power of effects* instead of the lower-level shaders since the former allows all pipeline configurations to be set inside one file so there's no need to have distinct State objects. Not only is it simpler to use, but it also makes a one-man team more productive. I can hardly imagine how separate shaders can be superior in any way.

Having said that, if you're really planning to overlook all the benefits of an effect framework and go down the shader route, take a look at XEngine's documentations as a guiding example of how this can be done.

* Microsoft HLSL effect framework if you're planning to target Direct3D only or NVIDIA CgFX if you're looking for an API-agnostic solution

Share this post


Link to post
Share on other sites
RealMarkP    216
Thanks for the link. I stumbled upon that page just after posting. The only issue I find with it is that OpenGL does not support FX files natively, therefore making a shader based subsystem a nice solution. With that said, the thread does talk about using 3rd party libraries (ie. CgFX). I am still debating on using them.

The XEngine has a nice shader structure, I actually might go ahead and use theirs or design my system similar to what they have. Thanks, great find!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this