Trilight lighting model
by Bryan Morgan · in Torque 3D Professional · 11/15/2009 (3:25 pm) · 6 replies
What all would be involved in adding the trilight lighting model mentioned here into Torque 3D properly? Is it just a case of implementing the lightInfo->getAltColor(); bit which is commented out and then adding cases for the other light types, or is there also shader code and other stuff missing? I would love to get to use this lighting model because I find the shading tends to be overly dark, especially with HDRR enabled, so even if there's a great deal of code missing, I may still work on it as long as someone can point me towards what needs done.
#2
11/15/2009 (9:16 pm)
The trilight model may be predominately used for just lighting the character in games that use it, but from your screenshots of it being used with the sun directional light, I really really liked the look of it, and was only just recently reminded about it. If you could e-mail me the code or post it here that would be great. Also, if one were wanting to just light the character with it, wouldn't it be simple enough to render the scene with the character hidden using the standard lighting model, and then render the character over top using the trilight model similar to how translucent objects are handled in AL already?
#3
We're in the middle of preparing for 1.1, but i'll take some time this week to post it here.
11/16/2009 (4:21 am)
While you could do that... it causes a second lighting pass... so its not ideal. So its more complex than that.We're in the middle of preparing for 1.1, but i'll take some time this week to post it here.
#4
This of course may not be ideal depending on exactly how AL's lighting pass is performed, but being able to separate the character render from render passes can be very important to many affects, such as in the case of water shaders you often see your character or weapon outlined by it's color contribution to the rippling waves, even though from that angle your character shouldn't be visible in any sort of reflections so there should not be any contribution. Though separating the character from the main render could cause more problems then it solves so it is probably best to not have this functionality at all then have it over-complicate the render process.
11/16/2009 (12:30 pm)
I'll take your word for it. I've been sifting through the source slowly and still only understand a small amount of it enough to really do any major functionality changes or additions. I would think separating the character from the main scene render would be as simple as:- G-Buffer w/o character
- create stencil buffer using character mesh
- scene lighting pass using stencil buffer so as not to light where the character will be occluding
- render character using trilight lighting pass
- combine resulting render targets
This of course may not be ideal depending on exactly how AL's lighting pass is performed, but being able to separate the character render from render passes can be very important to many affects, such as in the case of water shaders you often see your character or weapon outlined by it's color contribution to the rippling waves, even though from that angle your character shouldn't be visible in any sort of reflections so there should not be any contribution. Though separating the character from the main render could cause more problems then it solves so it is probably best to not have this functionality at all then have it over-complicate the render process.
#5
Bryan, check out the pre pass render bin. It already applies stencil masks for opacity, and lightmapped objects. adding another bit to draw characters wouldn't be too tough.
11/16/2009 (12:54 pm)
Bryan, check out the pre pass render bin. It already applies stencil masks for opacity, and lightmapped objects. adding another bit to draw characters wouldn't be too tough.
#6
11/16/2009 (1:59 pm)
I don't actually have any need for separating the character from the main render pass, except perhaps cleaning up a few shader effects like the water ripples which probably aren't too important since most people don't seem to notice it. I was simply offering up a fairly straight forward means to do so in the unlikely event that one of you working on Torque3D hadn't thought of it already. As of now I'm simply waiting patiently for Tom's posting of his trilight lighting model experiment so I can see if I can use it for what I'm wanting to.
Associate Tom Spilman
Sickhead Games
Also saw people talk about how trilight is really only for character lighting and not the rest of the scene... something which at the moment we don't have control over.
So i decided to focus on the basics for 1.0 and wait and see.
If you wanted to get it working i can drop you the code i have which probably needs some porting to the latest T3D. Its mostly plumming code for adding the key and fill light colors and the shaders for vector, point, and spotlight which uses them.