how lighting work in T2D
by Trancy Lou · in Torque 2D Beginner · 04/16/2013 (6:28 am) · 5 replies
There are some games with amazing lighting,its kind of the 3D lighting but in a 2D way,like when our character walking around in a dark enviroment with a candle in his hand and the enviroment near him get brighted and others are stay in dark,how to do that?use some kind of effect?
#2
but is there any tutorial about it?
I am kind of lost in the new engine
04/16/2013 (7:46 am)
thanks richard!but is there any tutorial about it?
I am kind of lost in the new engine
#3

If you're looking for pixel shaders, T2D doesn't have that yet.
Example:

You might be able to achieve a similar look by rotating shadow sprites away from light source sprites but it obviously won't look as realistic.
04/16/2013 (9:57 pm)
What Richard suggested was using a sprite who's image has an alpha channel and has been edited in an image editor to have some parts more translucent than others. T2D will automatically use the alpha channel and blend the image. If you put it on scene layer 0 and another sprite on scene layer 1, the translucent image on layer 0 will be on top of the layer 1 image. Kinda like what this image shows:
If you're looking for pixel shaders, T2D doesn't have that yet.
Example:

You might be able to achieve a similar look by rotating shadow sprites away from light source sprites but it obviously won't look as realistic.
#4
04/17/2013 (5:03 am)
Thanks!i think what i am looking for is pixel shaders,does TGB have this functions?or its just never shown up in Torque
#5
This TDN article has some older code for TGB (as opposed to the current T2D) that might help get you moving in the right direction. It looks like it creates dynamic drop shadow sprites - or something like that.
04/17/2013 (8:01 am)
No, Torque 2D does not support pixel shaders. Torque 3D does, though.This TDN article has some older code for TGB (as opposed to the current T2D) that might help get you moving in the right direction. It looks like it creates dynamic drop shadow sprites - or something like that.
Torque Owner Richard Ranft
Roostertail Games