Game Development Community

Do Lighting effects exist in T2D?

by Jason Swearingen · in Torque Game Builder · 08/08/2005 (1:09 pm) · 9 replies

I am wondering if lighting levels and things like spotlight (radius lighting) effects currently exist in t2d?

If not, is there a plan for this to be encorporated before Retail?


I am thinking it would be a nice way to add things like "fog of war" or emphasizing certain areas of the screen during tutorials, etc.

-Jason

#1
08/08/2005 (4:01 pm)
Quote:I am wondering if lighting levels and things like spotlight (radius lighting) effects currently exist in t2d?

No.

Lighting in a 2D game isn't like lighting in a 3D game. Lighting in 3D is, for the vast majority of cases, based on various approximations of how light interacts with a surface defined by a series of triangles, so it's easy enough to generalize the process such that you can provide a reasonable solution that works for most cases. There is no analog to 2D lighting. All 2D lighting would be is darkenning (darken the areas that aren't in the light) one or more regions by blitting some kind of sprite or tile ontop of them using an appropriate OpenGL blending function to do the blitting. This is all done purely arbitrarily, and therefore it defies a general-purpose solution.

It is certainly possible to create a varity of lighting effects through GL blending. However, each implementation would be special case, so there is little point in trying to add such a thing to T2D.

BTW, this has nothing to do with the core. This is a T2D specific feature, as Torque's core has no concept of rendering (except possibly the GUI).
#2
08/08/2005 (4:34 pm)
Thanks for the post Smaug,

I posted this in this "Torque Core questions" fourm because there doesnt seem to be a better place for it... (maybe "General discussion")

It seems to me that a lighting effect would actually be very useful in an "all purpose solution"... though for people who are thinking about lighting in a 3d graphics sense, this is definatly not the same.

I posted this suggestion for adding lighting effects in t2d based off of this.


Consider this post closed!
#3
08/08/2005 (4:43 pm)
Quote Smaug "It is certainly possible to create a varity of lighting effects through GL blending. However, each implementation would be special case, so there is little point in trying to add such a thing to T2D."

If T2D had a standard color pallete (it probably pseudo does with hex or something I'm not familiar with) that could be referenced could there be a particle effect for a "light" that would increment the gradation of a sprite's color values with parameters such as hue, distance, and intensity?

@Jason: I'm a dope who doesn't really understand what specifically should be posted in the Core forum, so you're not alone in posting the wrong threads here.

Edit: Man, it took me a long time to post this. I'm late to the party. Nice suggestion, Jason.
#4
08/08/2005 (5:18 pm)
I have seen games with lighting effects in 2D. For example I believe that Gish does that. I know it can be done, and I believe it uses (abuses) the built in OpenGL lighting. I think the implementation of that kind of lighting is pretty game specific though.

What you could do in a stock T2D, is create another layer in front of all the other layers on the screen, with different levels of alpha transparency, to emulate a lighting effect. You could even use this kind of technique to create fake 2D HDR and such ;).
#5
08/08/2005 (6:03 pm)
@Ray right on
This was the method i was going to use for my dark lil shooter
#6
10/30/2005 (5:32 pm)
Doing "fog of war" style effects is trivial with blending, but the real trick is how to cast shadows (a la Gish). If there were a way to distort shapes, one could make an overlay for the shadow and then just do some math (ray-casting and such) to figure out what the shape needed to be.

Simple quads that could be distorted ought to be sufficient in most cases -- you can make sure that the shadow goes all the way up to the edge of the object casting the shadow by putting the casting object on a higher layer...

So if I could redefine the geometry of a sprite, one could potentially work up a fairly nifty system for handling lights... It could even be generalized if there's a way to determine every sprite in a given layer...

-JF
#7
10/30/2005 (7:54 pm)
Ultratorque ... TSE with T2d built in.

(fantasy)
#8
11/04/2005 (3:08 am)
For 2D Light /shadow I would visit www.gamedev.net/reference/articles/article2032.asp

Great article on this specific topic.
Think Gish used this as well.

With actual cards there are even more possibilities, as todays card reached the point where the regular built in support accumulation buffer. (I take FX5200 as regular. Onboard are always their own story ...)
#9
11/04/2005 (8:46 am)
Hey that's a cool article marc, gives a lot of good ideas.

thanks for posting it.