T2D Lighting Component and Tilemaps.
by John Bura · in Torque X 2D · 10/22/2010 (10:25 pm) · 10 replies
I have been trying to get the T2DLighting component to work with tile maps. But I just cannot seem to get it to work. Basically the texture is black and no lighting. Here is what I have done so far.
- Have a tilemap with T2DLighting and lighting enabled.
- have enabled lighting on the material
- Have added a normal map to the material.
- Have added a blank scene object with T2DLighting component added a light and have it enabled.
Im missing something but I don't know what.
- Have a tilemap with T2DLighting and lighting enabled.
- have enabled lighting on the material
- Have added a normal map to the material.
- Have added a blank scene object with T2DLighting component added a light and have it enabled.
Im missing something but I don't know what.
#2
10/25/2010 (12:59 pm)
Sadly I have not. But Ive been trying :P
#3
10/25/2010 (3:20 pm)
Right now Im making the lights in Photoshop and putting them in manually. It looks okay but not what I am used to seeing in the 3D stuff I am doing.
#4
We've been busy fiddling with animation :-S I'm putting together a level now using tilemaps and was hoping to use lighting with them!
I'll give it a go and let yopu know how I get on!
Cheers
10/26/2010 (4:46 pm)
Sorry for the late reply John! We've been busy fiddling with animation :-S I'm putting together a level now using tilemaps and was hoping to use lighting with them!
I'll give it a go and let yopu know how I get on!
Cheers
#5
10/26/2010 (5:03 pm)
For sure, basically lighting takes a game from looking amateurish to looking fairly professional. What would be cool is if you could put animations within a tile map ;)
#6
10/27/2010 (3:11 am)
@John: Do you have to use tilemaps? Tilemaps uses a different ObjectType and probably wasnt programed to work with the lighting component. You might check the Light Components source code and see if you can find anything regarding tilemaps.
#7
If you're just getting a black texture I would check to make sure diffuse light values are greater than zero and not greater than one, and if you want it brighter then adjust ambient light values to something greater than zero. Also if it is a point light you're adding make sure the the linear attenuation is greater than zero and not greater than one, otherwise the attenuation gets so great you may not see any light.
For directional lights do the same as with the point lights for diffuse and ambient values. You can ignore linear attenuation and leave it at zero. If you want to attenuate a directional light set Constant Attenuation to something greater than one.
Then there are the small things like making sure you add the light to the light list, with the green button, and IsEnabled is checked. If it still isn't working, I'd check the level XML file to make sure the builder is actually saving your changes.
10/27/2010 (4:24 am)
Lighting works with tilemaps if the material you are using has Enable Lighting checked in its material properties, each tile type within a tile layer has its own material and they pretty much render the same way as the other sprite types. If you're just getting a black texture I would check to make sure diffuse light values are greater than zero and not greater than one, and if you want it brighter then adjust ambient light values to something greater than zero. Also if it is a point light you're adding make sure the the linear attenuation is greater than zero and not greater than one, otherwise the attenuation gets so great you may not see any light.
For directional lights do the same as with the point lights for diffuse and ambient values. You can ignore linear attenuation and leave it at zero. If you want to attenuate a directional light set Constant Attenuation to something greater than one.
Then there are the small things like making sure you add the light to the light list, with the green button, and IsEnabled is checked. If it still isn't working, I'd check the level XML file to make sure the builder is actually saving your changes.
#8
It worked! The problem was that it wasn't saving the isEnabled to the XML file. Im not sure if this is a bug. But if it is we should probably fix it at some point.
So I now have lights in my game! It is going to make my game look way better than it currently does. Thanks again Alex :)
10/27/2010 (1:39 pm)
@ Alex It worked! The problem was that it wasn't saving the isEnabled to the XML file. Im not sure if this is a bug. But if it is we should probably fix it at some point.
So I now have lights in my game! It is going to make my game look way better than it currently does. Thanks again Alex :)
#9
10/27/2010 (3:41 pm)
Good to know! Glad its working for you - what genre you working on this round?
#10
10/27/2010 (6:06 pm)
I have a few projects on the go but this one is a Two person top down shooter thriller. :)
Torque 3D Owner Tim Newsome-Ward
Desktop Daydreams
Did you get any further on this?