Game Development Community

Different Shaders on Same Material?

by James Dunmow · in Torque Game Engine Advanced · 04/27/2005 (6:48 pm) · 7 replies

I'm not sure if this just isn't supposed to be working as yet, or if I'm just missing something simple...

Trying to find a way to apply a -different- shader to a material depending on circumstances but can't quite see how I'd do it with the current system.

eg. to apply a different colour-filter to the SpaceOrk's armour depending if they're on the green team or the blue team, etc...but without having to swap in a different material on the model.

#1
04/28/2005 (1:25 pm)
There isn't a good way to do this currently. To get around it, you could create 2 models though, the Green Team model and the Blue team model. Not great, but it'll work until there's something better.
#2
04/28/2005 (6:09 pm)
Yeah. I know...sorta defeats the purpose of using the shader to save space though ;)

But it's okay. For now, it'll work great the way you suggest..I'm just getting a prototype working. Would I be assuming too much to hope for the ability to do this in the future?
#3
04/29/2005 (10:35 am)
You could use a spare color channel (like alpha!) to control a filter mask...
#4
04/30/2005 (4:22 pm)
I hope there's at least support for switching materials/shaders on certain objects when TSE comes out of EA. I'd be cool to combine emissive glow with dynamic lights for lights that can be toggled on/off.
#5
05/01/2005 (12:49 am)
There already is support, if you're willing to write a few lines of C++. I'm assuming you're going to have to anyway for the light part of it (since TGE doesn't ship with such a feature and TSE's planning on having a shaderized version of TGE's featureset).
#6
05/01/2005 (1:03 am)
From the TSE product page:
Quote: Dynamic Lighting - The TSE will support mobile lights that attenuate over distance and shade bumpmaps.

I'd think that you could spawn/delete dynamic lights.....
#7
05/02/2005 (5:09 pm)
Another thing you could do - you're artists will shudder at this idea. Color your player models white/gray, and then pass in the team color to a pixel shader constant . Use the pixel shader to change the color of the textures.

A better approach would be to multitexture the players such that the base layer can be full color whatever, but the second layer is the pixel shader modifed "jersey" that is overlaid over the first.