T3D 1.1 - 2.0 groundCover with incorrect normals
by Nils Eikelenboom · in Torque 3D Professional · 04/19/2013 (12:12 am) · 7 replies
T3D 1.1, 1.2 and 2.0
For a long time I have used the default "1 0" windDirection for groundCover (billboards!). While scripting a weather system and finally changing the wind direction of groundCover objects; I notice 'shadows' (normals) appearing that I believe shouldn't be there...
North (default): groundCover.windDirection = "1 0";
South: groundCover.windDirection = "-1 0";
Shadows are OK as long as those are correctly influenced by lighting. But in the example above, the billboards are facing the sun object and the camera is facing North. So in the 2nd image, where the objects are turing away from the camera(Southern wind), the shadows appear while it should be the other way around.
The biggest issue is that the normals aren't updated when you rotate the camera. So in case of a "-1 0" wind direction, everything remains dark.
Left & Right: Bending away from the light object | Center: Bending towards the light object
As you can see in the image above; the center billboard should be dark and the right billboard should be light.
___
Edit: Changed the title, it was unclear in what version (4/22/03)
For a long time I have used the default "1 0" windDirection for groundCover (billboards!). While scripting a weather system and finally changing the wind direction of groundCover objects; I notice 'shadows' (normals) appearing that I believe shouldn't be there...
North (default): groundCover.windDirection = "1 0";
South: groundCover.windDirection = "-1 0";
Shadows are OK as long as those are correctly influenced by lighting. But in the example above, the billboards are facing the sun object and the camera is facing North. So in the 2nd image, where the objects are turing away from the camera(Southern wind), the shadows appear while it should be the other way around.
The biggest issue is that the normals aren't updated when you rotate the camera. So in case of a "-1 0" wind direction, everything remains dark.
Left & Right: Bending away from the light object | Center: Bending towards the light object
As you can see in the image above; the center billboard should be dark and the right billboard should be light.
___
Edit: Changed the title, it was unclear in what version (4/22/03)
#2
04/20/2013 (3:15 am)
@Duion; In this case the normals are always incorrect with a different windDirection then default ("1 0")
#3
04/20/2013 (4:56 am)
Easiest solution would be to disable the face normals or make the normals point upward, so that the plant is either lit or not, this "shape" is pretty much fake anyway, so you will not notice a real difference, maybe someone knows how to do that.
#4
I went through the code of groundCover.cpp and even ShaderFeatureHLSL.cpp but couldn't pinpoint it (I'm still a noob in coding). Any help would be very welcome!
04/20/2013 (7:54 am)
If I understand correctly; the groundCover billboards show 2 different normals. That of the shape and the normal map (if defined). The shape (billboard) normals could, in my opinion, be removed without much notice (since not a lot of users did after all this time). I also think that the groundCover without the shape normals just looks better, and the normal maps (material) give more then enough freedom to make it look great. This could also apply to the groundCover 3d shapes; I'm still not using those that much because of the too dark appearing shape normals, and always ending up with adding a (too) strong 'Sub Surface' effect.I went through the code of groundCover.cpp and even ShaderFeatureHLSL.cpp but couldn't pinpoint it (I'm still a noob in coding). Any help would be very welcome!
#5
So, having the normal facing upwards all the time, makes the lighting independent from the camera vs light position, and improves the situation a lot.
So, applying this patch (to game\shaders\common\foliage.hlsl) turns the billboard normals all upwards:
upload.beamng.com/patches/foliage.hlsl.patch
It should improve the lighting changing depending on the camera vs light position, however, the downside is, that you need to have a big angle towards the ground to light up the grass.
07/19/2013 (4:16 pm)
Just had the same problem and tracked it down. It is indeed the billboard having a non-well normal for that purpose. (the wind normals kind of broke it)So, having the normal facing upwards all the time, makes the lighting independent from the camera vs light position, and improves the situation a lot.
So, applying this patch (to game\shaders\common\foliage.hlsl) turns the billboard normals all upwards:
upload.beamng.com/patches/foliage.hlsl.patch
It should improve the lighting changing depending on the camera vs light position, however, the downside is, that you need to have a big angle towards the ground to light up the grass.
#7
It fixed this issue very well :)
Many thanks for sharing this @tdev !!!
07/20/2013 (1:17 am)
This is simply great!It fixed this issue very well :)
Many thanks for sharing this @tdev !!!
Duion