.dts shading changing with viewing angle
by Luis Anton · in Torque Game Engine · 04/27/2004 (4:52 am) · 6 replies
Why do .dts shapes shading change depending on the player's viewing angle? It shouldn't... well, it shouldn't if the player doesn't have a torch! There are no more lights in the scene than the mission's sun.
I created a simple .dts sphere with 3DStudio and placed it in the starter.fps demo (HEAD). Depending on where it is in the player's view, its shadows change! :m
So, it looks like this if you leave it on the left part of the screen (THIS is ASCII art). The #'s are shaded polygons:
I created a simple .dts sphere with 3DStudio and placed it in the starter.fps demo (HEAD). Depending on where it is in the player's view, its shadows change! :m
So, it looks like this if you leave it on the left part of the screen (THIS is ASCII art). The #'s are shaded polygons:
/..#\ |...##| Right side is shaded while left side isn't, ok. \._#/while if you look directly to the center of the sphere it's all shaded:
/###\ |#####| All the polygons in view are shaded... why? \###/Well, sun light is suposed to keep coming from the same point... so this shading shoud not depend on player's viewing angle. Where is the code that creates the shading in .dts shapes?
#2
I have tried saving and reloading too :(
Are you sure your sphere's lighting doesn't change? Mine does... Well, what is more: if you fly around the sphere, you will find that light changes with your movement too, so no matter where you look the sphere from, its shading always looks the same (as if light always came from the viewer's right)!
Here you'll find a .zip with some images of the sphere I'm talking about. Notice how the shading changes on the sphere, when it shouldn't...
04/27/2004 (7:32 am)
Well, I don't really now how to add environment mapping to a 3DStudio object, so I guess I am not using it... unless it's being used by default. Does it matter? It's a matter of shades, not textures...I have tried saving and reloading too :(
Are you sure your sphere's lighting doesn't change? Mine does... Well, what is more: if you fly around the sphere, you will find that light changes with your movement too, so no matter where you look the sphere from, its shading always looks the same (as if light always came from the viewer's right)!
Here you'll find a .zip with some images of the sphere I'm talking about. Notice how the shading changes on the sphere, when it shouldn't...
#3
When did you last get the HEAD, have you done any modifications at all, and what video card do you have?
Do you notice the lighting doing the same thing on the orc character?
And if you shoot at the sphere, do you see the dynamic lights and are they in the correct spot?
Try adding one of the stock DTS shapes, like maybe the buggy, and see if it does the same.
It sounds like one of 2 things to me... either some matrix is being fudged in the pipeline, or something is screwy with your OpenGL drivers. If it's a recent HEAD and you haven't done any modifications to the engine code, I would lean more towards a driver thing. There have been some pretty grotesque bugs in a lot of OpenGL drivers the last few years, since DirectX has emerged as the defacto rendering API for Windows, and more than one of those bugs had to do with the hardware lighting. Try updating your video drivers if they aren't already the latest.
Peace
04/27/2004 (8:07 am)
Hmmm. I see what you are talking about. Doesn't do it on mine though. I placed a sphere at about the same place yours is placed in those screenshots, and the lighting seems to remain consistent no matter where I move. The reason I mentioned the environment mapping is that on older revisions the emapping caused some things that kinda looked like misplaced lighting. But for a simple object like a sphere it would probably be obvious, doubt that has anything to do with it.When did you last get the HEAD, have you done any modifications at all, and what video card do you have?
Do you notice the lighting doing the same thing on the orc character?
And if you shoot at the sphere, do you see the dynamic lights and are they in the correct spot?
Try adding one of the stock DTS shapes, like maybe the buggy, and see if it does the same.
It sounds like one of 2 things to me... either some matrix is being fudged in the pipeline, or something is screwy with your OpenGL drivers. If it's a recent HEAD and you haven't done any modifications to the engine code, I would lean more towards a driver thing. There have been some pretty grotesque bugs in a lot of OpenGL drivers the last few years, since DirectX has emerged as the defacto rendering API for Windows, and more than one of those bugs had to do with the hardware lighting. Try updating your video drivers if they aren't already the latest.
Peace
#4
I don't notice the same thing on the orc. However, it's quite complex and I may be mistaken. I tried with a tree (tree3), and something there are also shading errors.
If I shoot at the sphere... well... something odd happens. First, the side of the sphere closer to the proyectile is lit properly... but for a moment you see there's another source of light, wich seems to be the sun! Then, when the proyectile dissapears, you see the sphere wrongly shaded again. I would say that the sphere is properly shaded if there's dynamic light around, which looks like a clue for solving the mistery.
I am running Torque on an ATI Mobility RADEON 9000. Everything else seems to work perfectly. I think I have the latest drivers, but I'll try anyway. I'll try it also on my GeForce FX5600.
... moments later...
and now anger and fury. It works on the GeForce, perfectly. So it seems a hardware issue. GREAT :( I have downloaded the latest drivers for my laptop (where the ATI is used) but they may be too old (feb-2003). It remains the same.
There's still hope, I guess, if it seems to work with dynamic lights...
04/27/2004 (2:46 pm)
Well, my HEAD is about two months old, or something... I'm trying it in an untouched version. Downloaded and compiled.I don't notice the same thing on the orc. However, it's quite complex and I may be mistaken. I tried with a tree (tree3), and something there are also shading errors.
If I shoot at the sphere... well... something odd happens. First, the side of the sphere closer to the proyectile is lit properly... but for a moment you see there's another source of light, wich seems to be the sun! Then, when the proyectile dissapears, you see the sphere wrongly shaded again. I would say that the sphere is properly shaded if there's dynamic light around, which looks like a clue for solving the mistery.
I am running Torque on an ATI Mobility RADEON 9000. Everything else seems to work perfectly. I think I have the latest drivers, but I'll try anyway. I'll try it also on my GeForce FX5600.
... moments later...
and now anger and fury. It works on the GeForce, perfectly. So it seems a hardware issue. GREAT :( I have downloaded the latest drivers for my laptop (where the ATI is used) but they may be too old (feb-2003). It remains the same.
There's still hope, I guess, if it seems to work with dynamic lights...
#5
The hardware lighting is something I need to address very soon in my own project, so I will poke around in the code more tonight and keep an eye out for anything suspicious that might lead to that problem.
Peace
04/27/2004 (3:09 pm)
If it seems like the sun lights it correctly when the projectile light falls on it, perhaps that card has a problem with using only one OpenGL light. Try adding another constant light to the scene, perhaps another sun, and see if it makes any difference.The hardware lighting is something I need to address very soon in my own project, so I will poke around in the code more tonight and keep an eye out for anything suspicious that might lead to that problem.
Peace
#6
05/02/2004 (11:23 pm)
Well, the Lighting Pack that has been recently released solves the problem...
Torque Owner Gerald Fishel
Development Ninja
Do you have environment mapping on the object?
And have you tried saving the mission, and reloading it with the sphere already there? Have seen some funky things stop happening by saving and re-opening the mission.
I believe the lighting is done using OpenGL lights and the lights are installed in SceneObject::installLights. Might want to step into there, and into the LightManager::installGLLights functions to see what lights are being installed.
Peace