Jump to content
  • Advertisement
Sign in to follow this  
Ncyphe

Need help with Game engine programming . . .

This topic is 2950 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

in particular, with use of shaders.

Basically, I'm looking for any resources, even books.


Basically, I'm trying to figure out how to develop a practical dynamic shader engine to work side by side with graphics. I can't find any resources online, and most of the books are so expensive that I can't risk buying one just to find it doesn't help me at all.

I need all the help I can get.

Edit: Let me go into a little more detail.

I'm in a senior level Engine Development class where I've been tasked with programming a Dynamic Shader class that will accept any .fx file passed in.

This is driving me crazy as I've already rewritten my code several times over from incompatibilities. I've got it into a usable state for the final project in the class, but I already need to reprogram it again for the senior project.

I need all the help I can get guys, creating a dynamic shader class is just driving me mad.

[Edited by - Ncyphe on August 24, 2010 12:29:32 AM]

Share this post


Link to post
Share on other sites
Advertisement
I would find it hard to create one single shader class for all applications. Shaders are used for lots of things.

First off, it would be advantageous to have easy invocation of a shader, I like XNA's method of having begin () and end () calls surrounding your geometry. You get the same thing with DirectX LPD3DXEFFECT easily does this, OpenGL doesn't have the same luxury. Either way I usually wrap things up in case I decide to switch.

After you cover that level, theres not really one class that should handle everything. Shaders are used in lots of things like Post Processing and Materials. Sometimes you have shaders that work together like Deferred Rendering. So making one giant "Dynamic Shader" class is unrealistic. Even if you jammed all the functionality into one class, it would be quite ugly.

So separate them...

Materials, when you go to render something they obviously have some sort of appearance usually with a shader involved. So what does a material shader need? Usually textures (Diffuse colors, Normal Maps) and values (Specular Intensity, Specular Power, Roughness, Outline thickness for toon shaders) So create an easy way to simply have all that junk passed to the shader. You could also automatically handle passing in your World, View, and Projection matrices. Typing those in for every material gets troublesome.

Post processing... Usually you do some a full screen quad, and pass in the buffers needed for the effect. (I haven't done much post processing) Making a post process class with easy access to the information it needs would make it easy to turn on and off effects. Not every computer can run SSAO, Depth of Field, Sepia, Film Grain, and Motion blur at the same time. Separating these types of things into separate classes would make turning them on and off quite easy.

Anyhow, I'm no expert but that is how I'd do things. Classes usually should only have one use, it keeps your code from cluttering up and being generally unreadable. It also simplifies design, and consequently... usage.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!