[Resolved] Flat Terrain No Lighting
by Steve Acaster · in Torque 3D Professional · 06/26/2009 (9:03 am) · 20 replies

Caused when terrain area is absolutely flat horizontally or vertically. No direct lighting on flat areas, just ambient. Me suspects it might have something to do with a similar issue on Ground Plain Objects I just reported here, due to the fact that both issues involve flatness. (hey, what do I look like Detective Kojak? It's the best guess I got!)
GPU = 7900GS.
Who loves ya, baby.
edit:shifted to B4 forum
Shifted to Resolved
About the author
One Bloke ... In His Bedroom ... Making Indie Games ...
#2
angle = 0 - multiply by anything and you get nothing
result? no light, perfect darkness
good logic but, if it was i would be able to reproduce this in my ATI machine and i can't
on my machine flat terrain looks....... well....... flat
On the other hand if i try to flatten more the terrain it all goes weird and i get out of the blue a mountain with max height
06/26/2009 (9:54 am)
hmmmm you could be right with the beeing flat theoryangle = 0 - multiply by anything and you get nothing
result? no light, perfect darkness
good logic but, if it was i would be able to reproduce this in my ATI machine and i can't
on my machine flat terrain looks....... well....... flat
On the other hand if i try to flatten more the terrain it all goes weird and i get out of the blue a mountain with max height
#3
06/26/2009 (10:01 am)
I was thinking it might be an Nvidia problem, I've noticed a few other B3 threads reporting issues with the 8 series.
#4
06/26/2009 (2:18 pm)
I saw this when I had parallax mapping turned on on at least one of my terrain materials and at least one of my terrain materials didn't have a normal map.
#5
Yep, without a NM on the material in Advanced Lighting a perfectly horizontal/vertical area of terrain will not show light. However sticking a nm over the material only fixes the issue out to the range of mipmaps, so the flat terrain in the distance is still unlit.
06/26/2009 (3:54 pm)
Thanks for that pointer Andy, it was in the right direction.Yep, without a NM on the material in Advanced Lighting a perfectly horizontal/vertical area of terrain will not show light. However sticking a nm over the material only fixes the issue out to the range of mipmaps, so the flat terrain in the distance is still unlit.
#6
06/26/2009 (4:02 pm)
Okay -- got a workaround. The range is controlled by the detail object, slapping that way up high (300 seems to do fine with my fog settings) sorts this out -- or at least prevents it from being noticeable.
#7
06/26/2009 (7:17 pm)
Hmmm, still happens if I have more than 4 terrain materials - but only to the numbers after 3.
#8
06/27/2009 (1:10 am)
@Steve - Is that with or without normal maps? With or without parallax?
#9
In the pic it's no normal maps too. And there is only a single texture.
However, even with normal maps, if I have 5 or more terrain textures (all with detail and normal maps) in the "terrain painter list" using the 4th material and downwards on the list causes the issue again, but not to the first 3 textures on the list, just the others.
edit
When using Parallax, the detail texture fails to load/show on the first 3 terrain materials in the "terrain painter list", whilst the remainder are fine (the ones that would be affected by the no-lighting without parallax)
double edit
Just tried a new terrain from scratch, with normals and parallax. Everything seems fine until I add a fourth texture on the, then it gets the no-lighting issue again.
It looks like it has something to do with having 4 or more textures on a terrain split, rather than the order/number of textures in the "terrain painter list".
Of course regardless of all these combinations, beyond the range of the detail texture, or with no normal map at all, flat terrain will not light.
06/27/2009 (7:29 am)
No Parallax.In the pic it's no normal maps too. And there is only a single texture.
However, even with normal maps, if I have 5 or more terrain textures (all with detail and normal maps) in the "terrain painter list" using the 4th material and downwards on the list causes the issue again, but not to the first 3 textures on the list, just the others.
edit
When using Parallax, the detail texture fails to load/show on the first 3 terrain materials in the "terrain painter list", whilst the remainder are fine (the ones that would be affected by the no-lighting without parallax)
double edit
Just tried a new terrain from scratch, with normals and parallax. Everything seems fine until I add a fourth texture on the, then it gets the no-lighting issue again.
It looks like it has something to do with having 4 or more textures on a terrain split, rather than the order/number of textures in the "terrain painter list".
Of course regardless of all these combinations, beyond the range of the detail texture, or with no normal map at all, flat terrain will not light.
#11
Ok... i'm on it. I'll post a fix as soon as i got one.
06/28/2009 (11:41 pm)
Funny how none of this stuff crops up when i test... i need better test maps. :(Ok... i'm on it. I'll post a fix as soon as i got one.
#13
Stock simple.mis showing it's totally flat area unlit.
07/17/2009 (5:33 pm)
Still in beta4 for terrain and ground plane, but you probably knew that.
Stock simple.mis showing it's totally flat area unlit.
#15
07/26/2009 (8:22 pm)
Alas, nay, it wasn't.
#16
I'm debugging it now.
07/28/2009 (5:40 pm)
Good news... i've reproduced it... seems like its only on Geforce 7xxx cards.I'm debugging it now.
#17
07/28/2009 (5:43 pm)
@Tom, sounds right - I'm seeing the bug and I'm running a GeForce Go 7900 GS.
#18
Think I'll get a decent rig after Win7 comes out, and use this one as a low spec tester.
07/28/2009 (5:44 pm)
Great, figured it was the older GPU, as most of the graphical issues I report are.Think I'll get a decent rig after Win7 comes out, and use this one as a low spec tester.
#19
In in lighting\advanced\hlsl\gBufferConditionerHLSL.cpp function GBufferConditionerHLSL::_conditionOutput() around line 243:
We hope to have a better fix by 1.0 final... but this does work.
07/30/2009 (4:57 pm)
Ok... real fix here... but it will probably be temporary until we find a cheaper way to solve it.In in lighting\advanced\hlsl\gBufferConditionerHLSL.cpp function GBufferConditionerHLSL::_conditionOutput() around line 243:
case Spherical:
meta->addStatement( new GenOp( " // g-buffer conditioner: float4(normal.theta, normal.phi, depth Hi, depth Lo)\r\n" ) );
meta->addStatement( new GenOp( " @ = float4(@, 0.0, @.a);\r\n", outputDecl,
_posnegEncode(new GenOp("float2(atan2(@.y, @.x) / 3.14159265358979323846f, @.z)", unconditionedOutput, unconditionedOutput, unconditionedOutput ) ),
unconditionedOutput ) );
// ADDED!
meta->addStatement( new GenOp( " if ( abs( dot( @.xyz, float3( 0.0, 0.0, 1.0 ) ) ) > 0.999f ) @ = float4( 0, 1 * sign( @.z ), 0, @.a );\r\n",
unconditionedOutput, retVar, unconditionedOutput, unconditionedOutput ) );
break;We hope to have a better fix by 1.0 final... but this does work.

Associate Steve Acaster
[YorkshireRifles.com]