Game Development Community

A different approach

by Guilherme Santos · in Torque Game Engine Advanced · 02/18/2005 (10:46 am) · 3 replies

Hi,

I want to create some new global effects that may require a new pass of the entire scene.

I looked at the glow buffer implementation.
Correct me if I'm wrong, but to make the glow effect work, each object must detect that the current pass is a GlowPass and then disable/enable the correct render states.

So, if I want to add a new effect like this I must change all objects so they could detect the new effect pass and set the correct render states.


I'm thinking to change the way the objects decide what render states they can enable/disable. Instead of telling what pass I'm rendering, I tell what render states they can change.
For example, for the glowPass I want that all objects disable the ZWrite. So, instead of each object detect the type of the current pass, they only check if they could write to z-buffer.

I think that this new approach allows the architecture to be more flexible. If I want to add a new effect like glow buffer, I only have to set what render states the objects can use in the new pass.

What do you think of this approach? I would like to receive some feedback before I change anything.

#1
02/18/2005 (2:53 pm)
Sounds like a nightmare in the making...what happens when each object has to worry about 20+ different states and combinations of them?
#2
02/19/2005 (1:34 am)
Yes I know... but I don't like either to change all the architecture just to add a new different pass...
If I have many different effects, the render code of an object will be "if glowPass { blah blah; } else if (otherPass) { blah blah;} etc etc" :)

But I think I can select only a couple of options. To me the most important option is to disable the use of shaders. If I want that a single shader will be used in the entire scene, I must disallow objects to change this.

I have to think a little more about this idea.
Thanks for your opinion :)
#3
02/19/2005 (1:17 pm)
Can't you just assign all object the same custom shader?