Game Development Community

Spot Lights / Spotlights in TX2D [SOLVED]

by Aaron Scovel · in Torque X 2D · 10/02/2010 (5:34 pm) · 74 replies

I'm trying to create Spotlights in my game and cant seem to achieve this with the T2DLightComponent

mke3.net/blender/devel/rendering/volumetrics/vol_directlighting01.jpglibx3d.sourceforge.net/ISO-IEC-19775-X3DAbstractSpecification/Images/spotlight.gif
Has anyone achieved this type of light affect with the T2DLightComponent?

PointLight and SpotLight2DAdv both give me the same type of circular/sun/glowing light effect. SpotLight2DAdv has InnerAngel and OuterAngle variables, but I cant get them to do anything. Added Note: SpotLight2DAdv is part of the CEV (Community Enhanced Version)

About the author

Previously a PHP/MySQL Programmer/Web Developer of 10 years. In Aug 2010 I decided to change careers, and this is were I landed! I also parent 3 kids full time. TopNotched.com

Page «Previous 1 2 3 4 Last »
#1
10/02/2010 (7:01 pm)
What settings are you using for the T2DLightCompnent and spot light?

The following settings should give you something similar to what's shown in the video (the light attached to the ship)

T2DLightComponent

UseAlternateLighting = Checked

SpotLight2Dadv
InnerAngle = 15
OuterAngle = 25
RotationOffset = 270.0 (Only had to set this because of how I made my graphic)
Ambient = 1.0, 1.0, 1.0
Diffuse = 1.0, 1.0, 1.0
ConstantAttenuation = 0.000
LinearAttenuation = 0.010
PositionOffset = 0.0, 0.0, 0.0


#2
10/02/2010 (7:22 pm)
Where are you seeing the spotlight? I can't see it.
#3
10/02/2010 (7:31 pm)
The white light in the video is the spot light

if the video doesn't show up in the previous post here's the direct link
http://www.youtube.com/watch?v=E_Xo69p7Xpw
#4
10/02/2010 (7:33 pm)
I can't see the spotlight in TXB. Is it apart of the SVN?
#5
10/02/2010 (7:38 pm)
Yes it was added to the SVN
#6
10/02/2010 (8:08 pm)
Im totally thread jacking but Im interested in this too. IS the one in the SVN the Light Component. Or is that at 3d component.

Anyway I get this error when I intergrate.


Error 7 'GarageGames.Torque.PlatformerDemo.LightComponent._OnRegister(GarageGames.Torque.Core.TorqueObject)': cannot change access modifiers when overriding 'protected' inherited member 'GarageGames.Torque.Core.TorqueComponent._OnRegister(GarageGames.Torque.Core.TorqueObject)' E:\My Documents\TorqueXProjects\LevelTest\LevelTest\Game\LightComponent.cs 113 42 Game
#7
10/02/2010 (8:27 pm)
@Alex: That's the same thing I tried and its Its not working for me :-( Here is what I just tried:

SpotLight2DAdv
InnerAngle = 15
OuterAngle = 25
RotationOffset = 0
Ambient = 0.0, 0.0, 0.0
Diffuse = 1.0, 1.0, 1.0
ConstantAttenuation = 0.000
LinearAttenuation = 0.010
PositionOffset = 0.0, 0.0, 0.0

Result:
img641.imageshack.us/img641/9591/spotlight.jpg
Besides the problem, it also turns off the PointLight attached to my player (the ball) :-(. From looking at your video it appears you have lights in the corners as well. Are you using point lights for those?

If I add the ambient 1.0 1.0 1.0 It becomes a super bright light and still going in all directions similar to PointLight.

In the Material Builder I have Enable Lighting on all the materials used in the background, I also have Normal Maps for each material. I am using the Default Specular values. Is there something I am doing wrong?

@John: Not a 3D component, SpotLight2DAdv is a new option of T2DLightComponent in the SVN.
#8
10/02/2010 (8:31 pm)
@ John
The lighting changes are only for Torque X 2D and were added in Commit 25, back in August, to Pino's Community Enhanced Version. Changes were made in the T2DLightComponent and several other files, but those changes will be ignored, and the stock 2D lighting used, if you don't check UseAlternateLighting in the T2DLightComponent

I made changes to following files
Lights.cs
LightComponent.cs
LightComponent2D.cs
T2DTileLayer.cs
T2DAnimatedSprite.cs
T2DStaticSprite.cs
T2DScroller.cs

and added
Lights2DAdv.cs
LightingMaterial2DAdv.cs
LightingEffect2DAdv.fx
#9
10/02/2010 (8:39 pm)
@ Aaron
Yes the lights in the corners are point lights (blank SceneObjects with a T2DLightComponent attached) and all have UseAlternateLighting Checked and UseObjectLayerForLightDepth checked in their T2DLightComponents

What layer is light, the wall and the ball on?
I made it so object (for example) an object on layer 31 can be lit less by an object on layer 0 since the object on layer 31 is further away, to turn off that distance attenuation effect just set DepthScale to 1

Also using the alternate lighting if there is a light on layer 31 and an object on layer 0, the object on layer 0 is not lit, since it is in front of the light
#10
10/02/2010 (8:45 pm)
@Alex: Does SpotLight require UseObjectLayerForLightDepth? Do you think having UseAlternateLighting uncheck on my other lights is causeing the SpotLight not to work?
#11
10/02/2010 (8:49 pm)
Update: Adding UseObjectLayerForLightDepth and UseAlternateLighting did not fix the issue :-( Still no functional Spot Light. Has anyone other than Alex (the creator) been able to get spot light to work? Just wondering if something got left out on the CEV.

@Alex:Here is a screen shot using the settings for SpotLight2DAdv exactly as you suggest

img541.imageshack.us/img541/4806/withambiant.jpg
#12
10/02/2010 (8:53 pm)
@ Aaron

I'll write up instructions on how to get it all working, and post a sample project, just need a few hours (have something else I need to finish up real quick)
#13
10/02/2010 (8:58 pm)
Alex

Unfortunately I cannot see the new options in T2D lighting. I just made a new project with the SVN. Do I need to do anything else :)
#14
10/02/2010 (9:00 pm)
@Alex: Thanks, I was just going to ask if there was any documentation
#15
10/02/2010 (9:02 pm)
@John (aka:Thread Jacker): Do you see any other SVN components? (Farseer for example) .... :-)
#16
10/02/2010 (9:09 pm)
Haha, sorry Aaron..

I do not see the Farseer or other components.
#17
10/02/2010 (9:13 pm)
@John: Uhh Ohh! :-) You sure you have the SVN setup correctly? You need to delete Torque2D and TorqueCore, then add them back (add existing project) from the SVN folder (finally make sure to add their references to your Game project).
#18
10/02/2010 (9:14 pm)
Hmm I have already done that. Im going to try and do it again and see if it works :P
#19
10/02/2010 (9:24 pm)
Yep tried it again, Im running this with PSK demo. Do you think that would make a difference?

Edit - this is weird. I tried it with just a normal game and it also didn't work. Hmmm..

So All im doing is downloading the SVN Torque core and T2d Files, replacing them then refrencing them but still there are only two options in the

T2DLightComponent

Directional and
Point

Interesting.
#20
10/02/2010 (9:56 pm)
@John: The PSK doesn't make a dif. In C# click on the Lighting folder under Torque2D do you see "Lights2DAdv.cs" ? If you dont see this, then you havnt replaced Torque2D with the SVN correctly.

You Should download the whole SVN (make a new folder, locate it in your Projects folder .. call it something like "TorqueX 3.1.5 SVN" Mine directory looks like this ..."Visual Studio 2008ProjectsTorque SVN 3.1.5"). If you want, send me an email and I will reply with detailed instructions. I have had a few other people follow them and they havnt had any issues.

@Alex: I created a new project to test the lighting without any additional lighting from my game. Everything I try with SpotLight2DAdv still only gives a PointLight effect. Are you using a local copy of your SpotLight2DAdv or the SVN SpotLight2DAdv?
Page «Previous 1 2 3 4 Last »