Day / Night code working... one prob
by Sumner Mccarty · in Torque Game Engine · 10/11/2006 (9:33 am) · 9 replies
www.spinbattle.com/Video/lightingIssue.mov
This short vid shows my static meshes going black sometimes.
Any hints?... I'll start debugging soon, but hints i like... :)
Cheers!
:)
Sumner
This short vid shows my static meshes going black sometimes.
Any hints?... I'll start debugging soon, but hints i like... :)
Cheers!
:)
Sumner
#2
Are you relighting thoes diff's?
We need more infro on HOW you are doing the day night cycle before any one could even begin to help.
10/16/2006 (7:02 am)
Are you using the lighting kit?Are you relighting thoes diff's?
We need more infro on HOW you are doing the day night cycle before any one could even begin to help.
#3
I have relight everything after placing those models (they aren't difs... they are just dts's... test art)...
as you can see, they only go black at certain camera angles/distances.
Not sure if this is a render state issue or what...
But any help is appreciated.
I chatted on GG irc and a few others have seen the same issue... I've found no one that hasn't.
10/20/2006 (6:15 am)
Yes... using TLK 1.4 with RTSI have relight everything after placing those models (they aren't difs... they are just dts's... test art)...
as you can see, they only go black at certain camera angles/distances.
Not sure if this is a render state issue or what...
But any help is appreciated.
I chatted on GG irc and a few others have seen the same issue... I've found no one that hasn't.
#4
10/20/2006 (6:37 am)
What day/night resource are you using? There are many attempts at day and night cycles.
#6
There were 2 issues I saw right off the bat in my test case which contained several static shapes(of buildings mostly) and the stock RTS characters. One is the light changing on the buildings based on view angle as shown in the video above. Second is a sudden pop(jump up) in light intensity during sunrise and a corresponding pop at sunset.
Quick fix for view angle bug: remove the following from void LightManager::uninstallGLLights()
mAmbientLightColor.set(0.f, 0.f, 0.f); // this line will make the models look black if the following line in removed
mVectorLightsEnabled = true; // this is the one that caused the view angle issues
Description of fix:
I ended up setting a better test case which included 1 building(static shape) and the RTS characters. I noticed that when the RTS chars were off screen and not being drawn the lighting looked right. When the RTS chars became visible the popping occured. I dug into it and noticed that basically, the building was being drawn correctly it was without any lights - just ambient lighting, no directional.
In void Celestials::UpdateSunPosition() the following line turns off vector lights(aka, the sun)
lm->setVectorLightsEnabled(false);
but when you go to draw a model the engine installs the lights for it, draws the model and uninstalls the lights. Well...mVectorLightsEnabled = true; in uninstall lights turns this vector lighting back on...
This has several issies:
1) Only the first model drawn after the celestial object is drawn will have no vector lighting and look correct. The remaining models will have vector lighting and look incorrect.
2) Models are not drawn with directional light. Models do actually need directional light to look right...
Sunrise/sunset popping bug fix:
in void TSMesh::setMaterial(S32 matIndex, TSMaterialList* materials): remove this:
if(gCelestials) //
{
//make mesh darker at night
ColorF dn = gCelestials->mCurrentColor;
F32 i = gCelestials->GetIntensity();
if (i < 0.6 && i > 0.0005f)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(dn.red, dn.green, dn.blue , (.666668-i) +.3);
}
}
There is a comment attached to this code mentioning the popping bug and also mentions foliage replicators. I haven't used those so this may make the foliage ugly or yield some other issues...not sure. Anyone?
10/25/2006 (8:29 am)
I looked into this problem in more detail and got a few bugs fixed(and also realized other work I need to do to achieve the look I am going for).There were 2 issues I saw right off the bat in my test case which contained several static shapes(of buildings mostly) and the stock RTS characters. One is the light changing on the buildings based on view angle as shown in the video above. Second is a sudden pop(jump up) in light intensity during sunrise and a corresponding pop at sunset.
Quick fix for view angle bug: remove the following from void LightManager::uninstallGLLights()
mAmbientLightColor.set(0.f, 0.f, 0.f); // this line will make the models look black if the following line in removed
mVectorLightsEnabled = true; // this is the one that caused the view angle issues
Description of fix:
I ended up setting a better test case which included 1 building(static shape) and the RTS characters. I noticed that when the RTS chars were off screen and not being drawn the lighting looked right. When the RTS chars became visible the popping occured. I dug into it and noticed that basically, the building was being drawn correctly it was without any lights - just ambient lighting, no directional.
In void Celestials::UpdateSunPosition() the following line turns off vector lights(aka, the sun)
lm->setVectorLightsEnabled(false);
but when you go to draw a model the engine installs the lights for it, draws the model and uninstalls the lights. Well...mVectorLightsEnabled = true; in uninstall lights turns this vector lighting back on...
This has several issies:
1) Only the first model drawn after the celestial object is drawn will have no vector lighting and look correct. The remaining models will have vector lighting and look incorrect.
2) Models are not drawn with directional light. Models do actually need directional light to look right...
Sunrise/sunset popping bug fix:
in void TSMesh::setMaterial(S32 matIndex, TSMaterialList* materials): remove this:
if(gCelestials) //
{
//make mesh darker at night
ColorF dn = gCelestials->mCurrentColor;
F32 i = gCelestials->GetIntensity();
if (i < 0.6 && i > 0.0005f)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(dn.red, dn.green, dn.blue , (.666668-i) +.3);
}
}
There is a comment attached to this code mentioning the popping bug and also mentions foliage replicators. I haven't used those so this may make the foliage ugly or yield some other issues...not sure. Anyone?
#7
There were 2 issues I saw right off the bat in my test case which contained several static shapes(of buildings mostly) and the stock RTS characters. One is the light changing on the buildings based on view angle as shown in the video above. Second is a sudden pop(jump up) in light intensity during sunrise and a corresponding pop at sunset.
Quick fix for view angle bug: remove the following from void LightManager::uninstallGLLights()
mAmbientLightColor.set(0.f, 0.f, 0.f); // this line will make the models look black if the following line in removed
mVectorLightsEnabled = true; // this is the one that caused the view angle issues
Description of fix:
I ended up setting a better test case which included 1 building(static shape) and the RTS characters. I noticed that when the RTS chars were off screen and not being drawn the lighting looked right. When the RTS chars became visible the popping occured. I dug into it and noticed that basically, the building was being drawn correctly it was without any lights - just ambient lighting, no directional.
In void Celestials::UpdateSunPosition() the following line turns off vector lights(aka, the sun)
lm->setVectorLightsEnabled(false);
but when you go to draw a model the engine installs the lights for it, draws the model and uninstalls the lights. Well...mVectorLightsEnabled = true; in uninstall lights turns this vector lighting back on...
This has several issies:
1) Only the first model drawn after the celestial object is drawn will have no vector lighting and look correct. The remaining models will have vector lighting and look incorrect.
2) Models are not drawn with directional light. Models do actually need directional light to look right...
Sunrise/sunset popping bug fix:
in void TSMesh::setMaterial(S32 matIndex, TSMaterialList* materials): remove this:
if(gCelestials) //
{
//make mesh darker at night
ColorF dn = gCelestials->mCurrentColor;
F32 i = gCelestials->GetIntensity();
if (i < 0.6 && i > 0.0005f)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(dn.red, dn.green, dn.blue , (.666668-i) +.3);
}
}
There is a comment attached to this code mentioning the popping bug and also mentions foliage replicators. I haven't used those so this may make the foliage ugly or yield some other issues...not sure. Anyone?
10/25/2006 (10:38 am)
I looked into this problem in more detail and got a few bugs fixed(and also realized other work I need to do to achieve the look I am going for).There were 2 issues I saw right off the bat in my test case which contained several static shapes(of buildings mostly) and the stock RTS characters. One is the light changing on the buildings based on view angle as shown in the video above. Second is a sudden pop(jump up) in light intensity during sunrise and a corresponding pop at sunset.
Quick fix for view angle bug: remove the following from void LightManager::uninstallGLLights()
mAmbientLightColor.set(0.f, 0.f, 0.f); // this line will make the models look black if the following line in removed
mVectorLightsEnabled = true; // this is the one that caused the view angle issues
Description of fix:
I ended up setting a better test case which included 1 building(static shape) and the RTS characters. I noticed that when the RTS chars were off screen and not being drawn the lighting looked right. When the RTS chars became visible the popping occured. I dug into it and noticed that basically, the building was being drawn correctly it was without any lights - just ambient lighting, no directional.
In void Celestials::UpdateSunPosition() the following line turns off vector lights(aka, the sun)
lm->setVectorLightsEnabled(false);
but when you go to draw a model the engine installs the lights for it, draws the model and uninstalls the lights. Well...mVectorLightsEnabled = true; in uninstall lights turns this vector lighting back on...
This has several issies:
1) Only the first model drawn after the celestial object is drawn will have no vector lighting and look correct. The remaining models will have vector lighting and look incorrect.
2) Models are not drawn with directional light. Models do actually need directional light to look right...
Sunrise/sunset popping bug fix:
in void TSMesh::setMaterial(S32 matIndex, TSMaterialList* materials): remove this:
if(gCelestials) //
{
//make mesh darker at night
ColorF dn = gCelestials->mCurrentColor;
F32 i = gCelestials->GetIntensity();
if (i < 0.6 && i > 0.0005f)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(dn.red, dn.green, dn.blue , (.666668-i) +.3);
}
}
There is a comment attached to this code mentioning the popping bug and also mentions foliage replicators. I haven't used those so this may make the foliage ugly or yield some other issues...not sure. Anyone?
#8
There were 2 issues I saw right off the bat in my test case which contained several static shapes(of buildings mostly) and the stock RTS characters. One is the light changing on the buildings based on view angle as shown in the video above. Second is a sudden pop(jump up) in light intensity during sunrise and a corresponding pop at sunset.
Quick fix for view angle bug: remove the following from void LightManager::uninstallGLLights()
mAmbientLightColor.set(0.f, 0.f, 0.f); // this line will make the models look black if the following line in removed
mVectorLightsEnabled = true; // this is the one that caused the view angle issues
Description of fix:
I ended up setting a better test case which included 1 building(static shape) and the RTS characters. I noticed that when the RTS chars were off screen and not being drawn the lighting looked right. When the RTS chars became visible the popping occured. I dug into it and noticed that basically, the building was being drawn correctly it was without any lights - just ambient lighting, no directional.
In void Celestials::UpdateSunPosition() the following line turns off vector lights(aka, the sun)
lm->setVectorLightsEnabled(false);
but when you go to draw a model the engine installs the lights for it, draws the model and uninstalls the lights. Well...mVectorLightsEnabled = true; in uninstall lights turns this vector lighting back on...
This has several issies:
1) Only the first model drawn after the celestial object is drawn will have no vector lighting and look correct. The remaining models will have vector lighting and look incorrect.
2) Models are not drawn with directional light. Models do actually need directional light to look right...
Sunrise/sunset popping bug fix:
in void TSMesh::setMaterial(S32 matIndex, TSMaterialList* materials): remove this:
if(gCelestials) //
{
//make mesh darker at night
ColorF dn = gCelestials->mCurrentColor;
F32 i = gCelestials->GetIntensity();
if (i < 0.6 && i > 0.0005f)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(dn.red, dn.green, dn.blue , (.666668-i) +.3);
}
}
There is a comment attached to this code mentioning the popping bug and also mentions foliage replicators. I haven't used those so this may make the foliage ugly or yield some other issues...not sure. Anyone?
10/25/2006 (1:21 pm)
I looked into this problem in more detail and got a few bugs fixed(and also realized other work I need to do to achieve the look I am going for).There were 2 issues I saw right off the bat in my test case which contained several static shapes(of buildings mostly) and the stock RTS characters. One is the light changing on the buildings based on view angle as shown in the video above. Second is a sudden pop(jump up) in light intensity during sunrise and a corresponding pop at sunset.
Quick fix for view angle bug: remove the following from void LightManager::uninstallGLLights()
mAmbientLightColor.set(0.f, 0.f, 0.f); // this line will make the models look black if the following line in removed
mVectorLightsEnabled = true; // this is the one that caused the view angle issues
Description of fix:
I ended up setting a better test case which included 1 building(static shape) and the RTS characters. I noticed that when the RTS chars were off screen and not being drawn the lighting looked right. When the RTS chars became visible the popping occured. I dug into it and noticed that basically, the building was being drawn correctly it was without any lights - just ambient lighting, no directional.
In void Celestials::UpdateSunPosition() the following line turns off vector lights(aka, the sun)
lm->setVectorLightsEnabled(false);
but when you go to draw a model the engine installs the lights for it, draws the model and uninstalls the lights. Well...mVectorLightsEnabled = true; in uninstall lights turns this vector lighting back on...
This has several issies:
1) Only the first model drawn after the celestial object is drawn will have no vector lighting and look correct. The remaining models will have vector lighting and look incorrect.
2) Models are not drawn with directional light. Models do actually need directional light to look right...
Sunrise/sunset popping bug fix:
in void TSMesh::setMaterial(S32 matIndex, TSMaterialList* materials): remove this:
if(gCelestials) //
{
//make mesh darker at night
ColorF dn = gCelestials->mCurrentColor;
F32 i = gCelestials->GetIntensity();
if (i < 0.6 && i > 0.0005f)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(dn.red, dn.green, dn.blue , (.666668-i) +.3);
}
}
There is a comment attached to this code mentioning the popping bug and also mentions foliage replicators. I haven't used those so this may make the foliage ugly or yield some other issues...not sure. Anyone?
#9
There were 2 issues I saw right off the bat in my test case which contained several static shapes(of buildings mostly) and the stock RTS characters. One is the light changing on the buildings based on view angle as shown in the video above. Second is a sudden pop(jump up) in light intensity during sunrise and a corresponding pop at sunset.
Quick fix for view angle bug: remove the following from void LightManager::uninstallGLLights()
mAmbientLightColor.set(0.f, 0.f, 0.f); // this line will make the models look black if the following line in removed
mVectorLightsEnabled = true; // this is the one that caused the view angle issues
Description of fix:
I ended up setting a better test case which included 1 building(static shape) and the RTS characters. I noticed that when the RTS chars were off screen and not being drawn the lighting looked right. When the RTS chars became visible the popping occured. I dug into it and noticed that basically, the building was being drawn correctly it was without any lights - just ambient lighting, no directional.
In void Celestials::UpdateSunPosition() the following line turns off vector lights(aka, the sun)
lm->setVectorLightsEnabled(false);
but when you go to draw a model the engine installs the lights for it, draws the model and uninstalls the lights. Well...mVectorLightsEnabled = true; in uninstall lights turns this vector lighting back on...
This has several issies:
1) Only the first model drawn after the celestial object is drawn will have no vector lighting and look correct. The remaining models will have vector lighting and look incorrect.
2) Models are not drawn with directional light. Models do actually need directional light to look right...
Sunrise/sunset popping bug fix:
in void TSMesh::setMaterial(S32 matIndex, TSMaterialList* materials): remove this:
if(gCelestials) //
{
//make mesh darker at night
ColorF dn = gCelestials->mCurrentColor;
F32 i = gCelestials->GetIntensity();
if (i < 0.6 && i > 0.0005f)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(dn.red, dn.green, dn.blue , (.666668-i) +.3);
}
}
There is a comment attached to this code mentioning the popping bug and also mentions foliage replicators. I haven't used those so this may make the foliage ugly or yield some other issues...not sure. Anyone?
10/26/2006 (8:18 am)
I looked into this problem in more detail and got a few bugs fixed(and also realized other work I need to do to achieve the look I am going for).There were 2 issues I saw right off the bat in my test case which contained several static shapes(of buildings mostly) and the stock RTS characters. One is the light changing on the buildings based on view angle as shown in the video above. Second is a sudden pop(jump up) in light intensity during sunrise and a corresponding pop at sunset.
Quick fix for view angle bug: remove the following from void LightManager::uninstallGLLights()
mAmbientLightColor.set(0.f, 0.f, 0.f); // this line will make the models look black if the following line in removed
mVectorLightsEnabled = true; // this is the one that caused the view angle issues
Description of fix:
I ended up setting a better test case which included 1 building(static shape) and the RTS characters. I noticed that when the RTS chars were off screen and not being drawn the lighting looked right. When the RTS chars became visible the popping occured. I dug into it and noticed that basically, the building was being drawn correctly it was without any lights - just ambient lighting, no directional.
In void Celestials::UpdateSunPosition() the following line turns off vector lights(aka, the sun)
lm->setVectorLightsEnabled(false);
but when you go to draw a model the engine installs the lights for it, draws the model and uninstalls the lights. Well...mVectorLightsEnabled = true; in uninstall lights turns this vector lighting back on...
This has several issies:
1) Only the first model drawn after the celestial object is drawn will have no vector lighting and look correct. The remaining models will have vector lighting and look incorrect.
2) Models are not drawn with directional light. Models do actually need directional light to look right...
Sunrise/sunset popping bug fix:
in void TSMesh::setMaterial(S32 matIndex, TSMaterialList* materials): remove this:
if(gCelestials) //
{
//make mesh darker at night
ColorF dn = gCelestials->mCurrentColor;
F32 i = gCelestials->GetIntensity();
if (i < 0.6 && i > 0.0005f)
{
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor4f(dn.red, dn.green, dn.blue , (.666668-i) +.3);
}
}
There is a comment attached to this code mentioning the popping bug and also mentions foliage replicators. I haven't used those so this may make the foliage ugly or yield some other issues...not sure. Anyone?
Torque Owner Mark Junior
anyway dont know the prob