PostFX is tricky.
by Bryce · in Torque 3D Professional · 01/02/2012 (8:16 pm) · 16 replies
Howdy folks.
I haven't found a whole lot of information on the subject of PostFX, so I figured I'd ask here and see what I can find.
I'm trying to build a shader for thermal vision. At the moment, I have this:

Basically, bright things = red/yellow, and dark things = blue. This obviously isn't truly thermal vision, but it's mainly there to accentuate the screen while the player is using his googles.
However, what I'm aiming for is a bit more advanced. I'm trying to get the player models to glow so that they stand out more in thermal vision. So far, I don't know of any way to tell the post effects system to draw a specific material differently than the others. Any thoughts from you kind people?
Cheers,
-Bryce
I haven't found a whole lot of information on the subject of PostFX, so I figured I'd ask here and see what I can find.
I'm trying to build a shader for thermal vision. At the moment, I have this:

Basically, bright things = red/yellow, and dark things = blue. This obviously isn't truly thermal vision, but it's mainly there to accentuate the screen while the player is using his googles.
However, what I'm aiming for is a bit more advanced. I'm trying to get the player models to glow so that they stand out more in thermal vision. So far, I don't know of any way to tell the post effects system to draw a specific material differently than the others. Any thoughts from you kind people?
Cheers,
-Bryce
#2
This tutorial has some good info on modifying materials with object properties, which you could use to link heat into the system... but it's not about PostFX materials, unfortunately.
01/03/2012 (7:03 am)
When I was thinking of implementing heat vision, I imagined rendering the entire scene without materials, just rendering colours according to an object's temperature. Although then you lose any sort of surface detail in the materials, and I'm not even sure if PostFX can change object's materials.This tutorial has some good info on modifying materials with object properties, which you could use to link heat into the system... but it's not about PostFX materials, unfortunately.
#3
What you have there is really cool looking. If you can make the objects stand out in some way I think you will have some fun imaging for your game.
01/03/2012 (3:36 pm)
Or just make up some kind of name for this kind of imaging.What you have there is really cool looking. If you can make the objects stand out in some way I think you will have some fun imaging for your game.
#4
Thanks everyone, I'll report back with (hopefully positive) results.
01/03/2012 (7:34 pm)
Hmm...I wonder if I can use what Daniel posted. That tutorial can be used to brighten selected materials when thermal vision is activated. With my current shader, bright = hot, so that would make hot things stand out like they should.Thanks everyone, I'll report back with (hopefully positive) results.
#5
01/03/2012 (9:06 pm)
Ah. I see what you meant. That tutorial's way outdated. This just got a bit more difficult.
#6

This is just by enabling "Emissive" and "Glow" on the player materials through the material editor. My shader then interprets that new brightness as heat, which oranges everything up.
So now, my question: any way to enable the glow and emissive flags in real time? Something like an if Con::GetBoolVariable("$thermalvision") == true) { RENDERGLOW,ETC(); } in the rendering code that I can work in with client commands? I don't know my way around there just yet.
01/04/2012 (7:48 am)
Here's where I am so far:
This is just by enabling "Emissive" and "Glow" on the player materials through the material editor. My shader then interprets that new brightness as heat, which oranges everything up.
So now, my question: any way to enable the glow and emissive flags in real time? Something like an if Con::GetBoolVariable("$thermalvision") == true) { RENDERGLOW,ETC(); } in the rendering code that I can work in with client commands? I don't know my way around there just yet.
#7
01/04/2012 (8:17 am)
Just a non-thought-out idea, but have you considered using the skinswap function? Obviously messing with materials wouldn't network well as all player's would see the changes but it'd be okay fo SP.
#8
That effect looks fantastic so far, though... I'm really cheering for you to get this figured out ;P.
EDIT: Maybe Steve's got the right idea - could you do some sort of client-side skinswap based on a global bool? You could swap materials out to something emissive, or even define entire new materials for thermal vision so that if you REALLY wanted to you could have fine control over an object's appearance in thermal vision (i.e. hot skin and cold armour, or what-have-you).
01/04/2012 (8:29 am)
Sorry - didn't realise the tutorial was outdated. I confess I never actually implemented it myself - though I did read it through thoroughly - it just seemed to be on the right track.That effect looks fantastic so far, though... I'm really cheering for you to get this figured out ;P.
EDIT: Maybe Steve's got the right idea - could you do some sort of client-side skinswap based on a global bool? You could swap materials out to something emissive, or even define entire new materials for thermal vision so that if you REALLY wanted to you could have fine control over an object's appearance in thermal vision (i.e. hot skin and cold armour, or what-have-you).
#9
try this...
that'll do what you need
01/04/2012 (9:41 am)
@Brycetry this...
if Con::GetBoolVariable("$thermalvision") == true)
{
if (isObject(%obj))
{
dude_body.diffuseMap[0]= "art/shapes/players/dude/dude_body_hot.dds";
dude_body.glow[0] = true;
dude_body.emissive[0] = true;
dude_body.reload();
}
}that'll do what you need
#10
01/04/2012 (12:25 pm)
As Steve pointed out, the skin-swap will effect every client, as AFAIK will the glow and emissive too. This is the reason why I suggested making a custom shader for this, it would work for client only. Of course, if you plan using SP only, not a problem. It would be a shame to not use one of the main selling points of Torque.
#11
I don't get what you feel you're missing though. Is it a more animated glow you're after? Would good ol' film grain do the trick? Maybe a touch of radial blur? I don't know, I'm just "Wu Wei"ing it here.
01/07/2012 (11:01 am)
I'm really enjoying this shader of yours Bryce. reminds me of Splinter Cell's thermal vision.I don't get what you feel you're missing though. Is it a more animated glow you're after? Would good ol' film grain do the trick? Maybe a touch of radial blur? I don't know, I'm just "Wu Wei"ing it here.
#12
01/07/2012 (5:01 pm)
I'm pretty content with the way the effect is, but the icing on the cake would be having "hot" things show up more prominently. I do have noise grain set up with this post effect, but it's pretty light to keep it from being too distracting.
#13
01/08/2012 (3:33 am)
Quote:This is just by enabling "Emissive" and "Glow" on the player materials through the material editor. My shader then interprets that new brightness as heat, which oranges everything up.Wait... if you can do that, can't you add another flag to each material for 'hot' or something? It wouldn't affect normal renders, only your IR postFX. You could even make a discrete heat variable a member of the material for better control. Not as good as a per-object heat member but pretty close.
#14
01/08/2012 (8:16 am)
That's exactly where I'm lost. I'm not sure how to get the HLSL file and the Torque materials to communicate. Something like that would be ideal though, a simple "hot" flag on the hot materials that will cause it to glow when thermal vision is on.
#15
01/08/2012 (8:35 am)
I just realised after looking through how glow and emissive are defined and used that I have no idea how graphics work :P.
#16
I just remember in Oblivion you can apply ghost shaders to an object, but then again that is not a networked game. I don't know how it is implemented in Torque.
01/08/2012 (11:42 am)
Okay, I don't know anything about the shader stuff or the graphics, but I gotta ask this question: Aren't there existing shaders applied to objects in game? Or can be applied? Are those client side only? Can those shaders be applied on a per object basis? Can the shaders be made to be client side only if they are not currently? If you can then just apply shaders to objects that are hot or have a parameter that adjusts the intensity based on how hot the object is. Or am I making this too simple?I just remember in Oblivion you can apply ghost shaders to an object, but then again that is not a networked game. I don't know how it is implemented in Torque.
Torque 3D Owner Tuomas Kaukoranta
1. Keep that post-processing shader there.
2. Make a custom shader for the "hot objects" that behaves like normal when the thermal vision is off, but makes them a lot brighter when it is on, so that the PostFx shader does the rest.
3. ???
4. Profit.
This probably isn't the best solution, it came from the top of my head, but it might just work.