Universal Static Lights disappearing
by Julien Millet · in · 02/25/2005 (10:27 am) · 6 replies
Hello,
I'm having a strange problem with USL (globaly sgLights I suppose). It seems like at a certain limits lights tends to not be rendered.
When approx. 33 lights are instanciated all lights disappear when the latest is created.
More strange is that DTS objects keep being illuminated by sgLights.
We first noticed the problem a while ago, we didn't had that much lights instanciated but we have in-game items with light attached (hasLight = true).
I looked through the code but I didn't see such a limit to the number of light (except maxHardwareLights but increasing it doesn"t change anything), stl-kindof vectors are used so I don't expect it being a push/pop problem.
If anyone has an idea, we're in a hurry (soon finishing our game), hope to hear from you soon.
best regards.
I'm having a strange problem with USL (globaly sgLights I suppose). It seems like at a certain limits lights tends to not be rendered.
When approx. 33 lights are instanciated all lights disappear when the latest is created.
More strange is that DTS objects keep being illuminated by sgLights.
We first noticed the problem a while ago, we didn't had that much lights instanciated but we have in-game items with light attached (hasLight = true).
I looked through the code but I didn't see such a limit to the number of light (except maxHardwareLights but increasing it doesn"t change anything), stl-kindof vectors are used so I don't expect it being a push/pop problem.
If anyone has an idea, we're in a hurry (soon finishing our game), hope to hear from you soon.
best regards.
#2
It is 100% reproductible here.
I'm gonna test with the synapse pack demo as you suggested, I'm planning to fully diff our project with the Torque Synapse-1.3 version. We already did that but maybe something went wrong.
BTW here is one of our datablock that I used in my testing, can you check if it happens to you ? Thanks.
datablock sgUniversalStaticLightData(LampadaireLight) {
className = "sgUniversalStaticLightData";
LightOn = "1";
Radius = "60";
Brightness = "1";
Colour = "0.574713 0.563218 0.310345 1.000000";
FlareOn = "0";
FlareTP = "1";
FlareColour = "1.000000 1.000000 1.000000 1.000000";
ConstantSizeOn = "0";
ConstantSize = "1";
NearSize = "3";
FarSize = "0.5";
NearDistance = "10";
FarDistance = "30";
FadeTime = "0.1";
BlendMode = "0";
AnimColour = "0";
AnimBrightness = "0";
AnimRadius = "0";
AnimOffsets = "0";
AnimRotation = "0";
LinkFlare = "1";
LinkFlareSize = "0";
MinColour = "0.000000 0.000000 0.000000 1.000000";
MaxColour = "1.000000 1.000000 1.000000 1.000000";
MinBrightness = "0";
MaxBrightness = "1";
MinRadius = "0.1";
MaxRadius = "20";
StartOffset = "-5 0 0";
EndOffset = "5 0 0";
MinRotation = "0";
MaxRotation = "359";
SingleColourKeys = "1";
RedKeys = "AZA";
GreenKeys = "AZA";
BlueKeys = "AZA";
BrightnessKeys = "AZA";
RadiusKeys = "AZA";
OffsetKeys = "AZA";
RotationKeys = "AZA";
ColourTime = "5";
BrightnessTime = "5";
RadiusTime = "5";
OffsetTime = "5";
RotationTime = "5";
LerpColour = "1";
LerpBrightness = "1";
LerpRadius = "1";
LerpOffset = "1";
LerpRotation = "1";
StaticLight = "0";
SpotLight = "1";
SpotAngle = "68.5172";
AdvancedLightingModel = "1";
EffectsDTSObjects = "1";
};
02/28/2005 (4:34 am)
Hello,It is 100% reproductible here.
I'm gonna test with the synapse pack demo as you suggested, I'm planning to fully diff our project with the Torque Synapse-1.3 version. We already did that but maybe something went wrong.
BTW here is one of our datablock that I used in my testing, can you check if it happens to you ? Thanks.
datablock sgUniversalStaticLightData(LampadaireLight) {
className = "sgUniversalStaticLightData";
LightOn = "1";
Radius = "60";
Brightness = "1";
Colour = "0.574713 0.563218 0.310345 1.000000";
FlareOn = "0";
FlareTP = "1";
FlareColour = "1.000000 1.000000 1.000000 1.000000";
ConstantSizeOn = "0";
ConstantSize = "1";
NearSize = "3";
FarSize = "0.5";
NearDistance = "10";
FarDistance = "30";
FadeTime = "0.1";
BlendMode = "0";
AnimColour = "0";
AnimBrightness = "0";
AnimRadius = "0";
AnimOffsets = "0";
AnimRotation = "0";
LinkFlare = "1";
LinkFlareSize = "0";
MinColour = "0.000000 0.000000 0.000000 1.000000";
MaxColour = "1.000000 1.000000 1.000000 1.000000";
MinBrightness = "0";
MaxBrightness = "1";
MinRadius = "0.1";
MaxRadius = "20";
StartOffset = "-5 0 0";
EndOffset = "5 0 0";
MinRotation = "0";
MaxRotation = "359";
SingleColourKeys = "1";
RedKeys = "AZA";
GreenKeys = "AZA";
BlueKeys = "AZA";
BrightnessKeys = "AZA";
RadiusKeys = "AZA";
OffsetKeys = "AZA";
RotationKeys = "AZA";
ColourTime = "5";
BrightnessTime = "5";
RadiusTime = "5";
OffsetTime = "5";
RotationTime = "5";
LerpColour = "1";
LerpBrightness = "1";
LerpRadius = "1";
LerpOffset = "1";
LerpRotation = "1";
StaticLight = "0";
SpotLight = "1";
SpotAngle = "68.5172";
AdvancedLightingModel = "1";
EffectsDTSObjects = "1";
};
#3
I tested the previous datablock with the synapse1.3 release [endian test map] & the bug happened.
I created 32 USL with this datablock and all lights disappeared when the 33rd was spawned.
I'm going to check with other kind of lights, such as the basic blue & red light of the test map.
Note that I didn't remove the two lights of the test map, it seems like it happens only with datablocks of the same kind (at least the kind I'm using).
02/28/2005 (9:50 am)
Hello,I tested the previous datablock with the synapse1.3 release [endian test map] & the bug happened.
I created 32 USL with this datablock and all lights disappeared when the 33rd was spawned.
I'm going to check with other kind of lights, such as the basic blue & red light of the test map.
Note that I didn't remove the two lights of the test map, it seems like it happens only with datablocks of the same kind (at least the kind I'm using).
#4
I tested the previous datablock with the synapse1.3 release [endian test map] & the bug happened.
I created 32 USL with this datablock and all lights disappeared when the 33rd was spawned.
I'm going to check with other kind of lights, such as the basic blue & red light of the test map.
Note that I didn't remove the two lights of the test map, it seems like it happens only with datablocks of the same kind (at least the kind I'm using).
02/28/2005 (10:14 am)
Hello,I tested the previous datablock with the synapse1.3 release [endian test map] & the bug happened.
I created 32 USL with this datablock and all lights disappeared when the 33rd was spawned.
I'm going to check with other kind of lights, such as the basic blue & red light of the test map.
Note that I didn't remove the two lights of the test map, it seems like it happens only with datablocks of the same kind (at least the kind I'm using).
#5
You need to increase the visible light count, and then fix the following TGE code (terrRender.cc line 1519):
Change the '32' to MaxVisibleLights.
I recommend using static lights for higher rendering performance, better shading, and shadows. The changes outlined above are only for dynamic lights there are no limits to the number of static lights you can add to interiors and the terrain.
Hope this helps!
-John
02/28/2005 (1:03 pm)
Ok, that makes sense I didn't realize you're using dynamic lights. Check out the file 'terrRender.h' (stock TGE file) it has the following definitions:enum TerrConstants {
MaxClipPlanes = 8, ///< left, right, top, bottom - don't need far tho...
MaxTerrainMaterials = 256,
EdgeStackSize = 1024, ///< value for water/terrain edge stack size.
MaxWaves = 8,
MaxDetailLevel = 9,
MaxMipLevel = 8,
[b] MaxTerrainLights = 64,
MaxVisibleLights = 31,[/b]
ClipPlaneMask = (1 << MaxClipPlanes) - 1,
FarSphereMask = 0x80000000,
FogPlaneBoxMask = 0x40000000,
VertexBufferSize = 65 * 65 + 1000,
AllocatedTextureCount = 16 + 64 + 256 + 1024 + 4096,
TerrainTextureMipLevel = 7, ///< mip level of generated textures
TerrainTextureSize = 1 << TerrainTextureMipLevel, ///< size of generated textures
SmallMipLevel = 6
};You need to increase the visible light count, and then fix the following TGE code (terrRender.cc line 1519):
// Do dynamic lighting here...
if (mEnableTerrainDynLights && chunk->lightMask != 0) {
[b] for (U32 i = 0; i < 32; i++) {[/b]
if ((chunk->lightMask & (1 << i)) == 0)Change the '32' to MaxVisibleLights.
I recommend using static lights for higher rendering performance, better shading, and shadows. The changes outlined above are only for dynamic lights there are no limits to the number of static lights you can add to interiors and the terrain.
Hope this helps!
-John
#6
Sure this helps, thanks a lot =)
Hopefully swaping to static lights is easy. But no real perfomance increase noticed (at least on our PCs).
But that's enough for us, cool.
03/01/2005 (6:52 am)
HelloSure this helps, thanks a lot =)
Hopefully swaping to static lights is easy. But no real perfomance increase noticed (at least on our PCs).
But that's enough for us, cool.
Torque Owner John Kabus (BobTheCBuilder)
I ran a quick test using the Lighting Pack 1.3 demo, which works great. I added 36 blue static lights to the Endian test mission, all of them show up properly in the mission editor and light properly during mission lighting. Here's a quick screen shot:
Can you give me more details on when you are seeing the problem? Is this a clean Lighting Pack or was it merged into your project? Also try using the Lighting Pack demo executable to see the result.
-John