Faked lighting / blend modes
by WesTT · in Torque Game Builder · 08/22/2008 (10:18 pm) · 12 replies
Hello again all. I am currently working on an area in a game that would look really great with some faked lighting, so I checked out an older tutorial that came with 1.1.3 to see how best to do this. I got some good results, provided I only want to blend one image with the "light area" (grey scaled and alpha) image.
I simply place the torchlight cone image I have behind the object I want to be lit, and set the blend modes as follows: DST_COLOR, ONE_MINUS_SRC_ALPHA, which makes sense as it blends the torch and the background image pretty well. I found I can get more satisfactory results by setting the destination factor to source colour.
Now, the problem I have is having game entities also over that background image, as using the same blend mode causes these entities to blend with the background image as well as the grey scale "torch" image, causing them to be blended with a wall. This would be fine perhaps if my entities were chameleons, but they are not. :P
I think what would be preferable is if I could find a way to make the entities blend only against the torch light and not the back ground element, but I don't see a way of being able to do this (without dipping into soruce) in TGB as all layers are drawn and blended at once.
Has anyone had an experience with faking lighting in TGB that could give me some pointers? That'd really be helpful, thanks.
I simply place the torchlight cone image I have behind the object I want to be lit, and set the blend modes as follows: DST_COLOR, ONE_MINUS_SRC_ALPHA, which makes sense as it blends the torch and the background image pretty well. I found I can get more satisfactory results by setting the destination factor to source colour.
Now, the problem I have is having game entities also over that background image, as using the same blend mode causes these entities to blend with the background image as well as the grey scale "torch" image, causing them to be blended with a wall. This would be fine perhaps if my entities were chameleons, but they are not. :P
I think what would be preferable is if I could find a way to make the entities blend only against the torch light and not the back ground element, but I don't see a way of being able to do this (without dipping into soruce) in TGB as all layers are drawn and blended at once.
Has anyone had an experience with faking lighting in TGB that could give me some pointers? That'd really be helpful, thanks.
#2
09/11/2008 (6:41 am)
Hi Conor. That works, but if the higher (layer below the light cone) layer is close to be black, then the blending does not result in a particularly visible image, because we are blending a nearly black or black colour.
#3
www.garagegames.com/products/torque/tgb/
09/20/2008 (10:10 pm)
I gave this idea a rest for a while, but recently saw "Larva Mortus" on the TGB product page. The torch effect in it sports is pretty much the effect I am going for.www.garagegames.com/products/torque/tgb/
#4
09/20/2008 (10:42 pm)
That video/game looks pretty sweet. Soon as I saw it the first thing I thought was "wonder how they did the lighting effects". It could be something as simple as discussed above, or maybe something more, I'd love to know though.
#5
09/21/2008 (7:04 am)
Hi James. It's certainly something I want to implement properly, but at this point I don't have the time to fiddle with TGB. I can't get exactly the the effect I want at the moment so I will be giving it a rest again. It may be that I have to do some source mods to get a similar effect, as there are certain layers of objects that I do not want to have blending with the background.
#6
03/05/2009 (12:26 am)
Wes: I'm actually writing a blog about this exact thing as we speak. Once I get my screen caps done and everything, I'll post it and send you a link to it. I'll even throw in a sample of how they do the flashlight effect. :)
#7
03/05/2009 (6:40 pm)
my guess is that it's simply an image overlay. Using the alpha channel and a black image. There isn't the notion of masking in TGB so unless they hacked the engine, that's how it's probably done.
#8
03/18/2009 (6:32 pm)
Hi guys. Yeah, I actually tried the image overlay method and while it worked to a degree it did not look as bright as we would have liked. It was hard to get suitable results using the standard features. Eventually I figured I'd hack the engine but didn't have enough time. Though I'd love to hear how you did it David.
#9
03/18/2009 (7:09 pm)
any skilled graphics person that knows what they are doing with photoshop can duplicate the larva mortis effects in tgb and if you are using tgb its a 2d sprite engine its not 3d so you are not going to get lighting effects rendered in from a ambient light source. a clue to a simple version of lighting is in the fish demo but you can do alot more.
#10
03/18/2009 (7:43 pm)
Who said anything about an ambient light source? At any rate, the fish demo you mentioned looks interesting, and the animated particle effect is pretty cool. We certainly did try that approach, but again, *we* didn't get a solution that we found acceptable. I actually haven't touched this since September last year and have moved on from TGB for the time being.
#11
03/18/2009 (8:04 pm)
you should fiddle with tgb, on down time its pretty fun. i was just using ambient as an example. my rpg is looking more like 3d then 2d and im using quite a few sneaky bits lol.. btw if you ever would like help on this and i have time i will show you. < 14years in graphics and programming in 7 languagees 8 with torque script :)
#12
03/24/2009 (9:57 pm)
I actually used an image overlay as well. In photoshop it takes about 30 seconds to create a layer, select the gradient tool and have it go from transparent to black. From there you can set up whatever shape you want, but if you use the radial gradient, you get a general lighting circle around the player. My guess is that in Larva Mortus they made a cone shaped cutout for their overlay and mount the image to the player, making it look like a flashlight. It's pretty dang simple in the end.
Torque Owner Conor O Kane