Forests and Cruciform Objects Don't Get Shaded? Appear same brightness whether in a shadow or full sunlight
#1
Posted 01 December 2016 - 11:11 PM
http://i1064.photobucket.com/albums/u380/PerryPlatypus7/MSTS/Carrizo%20Gorge/Forest%20shading%20issues_zpsiawjiejg.png
First, notice the leftmost of the pair of bushes in the bottom right corner. This is a non-cruciform shaded bush, getting sunlight as expected. The bush directly to the right of it is in a forest region, and it is shaded properly in the sunlight.
Moving to the left of these bushes, we enter a shadow cast by a mountain behind the camera. The bush in the lower center and the prickly pear cactus in the far bottom left corner are being properly shaded, but all of the bushes in the left-center of the image, which are within the shadow cast by the mountain, are fully lit, and are of equal brightness as the bushes in the top half of the photo, in full sunlight.
If this is a known issue, is there a reason it has not been dealt with? Is it too complex to code properly, or are none of the current programmers familiar with the part of the code that would deal with this sort of thing?
I hope all my explanations made sense, I can answer any questions if there is anything unclear with what I have said.
#2
Posted 14 December 2016 - 05:46 AM
PerryPlatypus, on 01 December 2016 - 11:11 PM, said:
This has been a known issue since we added dynamic shadows but an executive decision was taken at the time to not have shadows cast onto cruciform objects.
Part of the problem, as you'll see in that old thread, is that not everyone likes the same thing, and there are some technical challenges too - it's not easy to prevent objects from self-shadowing, especially when you do want it for, say, a house.
#3
Posted 14 December 2016 - 05:53 AM
In TSRE I use shadows on cruciforms because grass looks amazing with shadows.
#4
Posted 14 December 2016 - 06:20 AM
What I do on my routes for grass models, is to use conventional shading, but I force all the grass vertex normals to match the normals of the terrain underneath. You get a rolling fields type of lighting rather than perfectly flat lighting. I believe this is the proper way to light grass, and it has the advantage of not using the cruciform shader, and so it recieves shadows. It looks great.
#5
Posted 14 December 2016 - 08:27 AM
#6
Posted 14 December 2016 - 10:24 AM
Without knowing the technical details, I do believe the best thing in this case would be if it was possible for the cruciform objects to only be shaded by other objects and not themselves, but it sounds like that is not possible? If so, is it any easier to set cruciform to be shaded by only the terrain (I have a feeling it's not).
The reason I bring this up is that is a big killer of immersion for me when I am running in the mountains in an area 100% shadowed by the mountain slopes so that the terrain, the train, the track, and buildings are all fully shaded, and yet the trees all appear to be in full sunlight.
Forest regions are still a whole other matter, since they are not cruciform. I see that the individual trees in forest regions are set to always face the camera. To me, it seems the best thing would be for them to be shaded as thus:
1. As a factor of the sun angle on them, relative to your viewing angle. In other words, if you are viewing the forest with the sun directly behind you, then each 2D panel would be fully lit. If you are viewing the forest with the sun directly behind the trees, they would be fully shaded. And as you rotate the camera around, each sprite would transition between the two as a function of the viewing angle vs. the angle of sunlight.
2. As a factor of terrain shading. Whatever part of the texture is within the region shadowed by terrain would be fully shaded, and whatever part of the texture is not in the shadow of the terrain would be shaded according to what was described in the first part I wrote. Or, if it is better on performance, have the brightness of the texture gradually transition between lit and shaded, depending on what percent of the sprite is within the terrain shadow.
The good thing is that the first part would be one calculation applied to all trees, since your camera is always facing one direction, so the factor of shading based on sun angle and camera angle can be applied to all trees. Rotating the camera would require a new calculation, but it would apply to all sprites in all forest regions.
The terrain shading would most unfortunately take more computational power since a shading calculation would be made for every sprite that falls under a terrain shadow... And as I am not a programmer, I don't actually know the complexity of either of these methods.
#7
Posted 14 December 2016 - 10:27 AM
PerryPlatypus, on 14 December 2016 - 10:24 AM, said:
It is possible, but it requires two shadow maps. One that has shadows of all objects, and other that has shadow of all objects, but not cruciforms. If OR can use MRT it is possible without huge performance loss, but xna probably doesn't support MRT.
But it is not perfect solution. 2D Trees will not cast shadows on themselves, but on other cruciforms too, like 2D Grass.
#8
Posted 14 December 2016 - 10:44 AM
Robert
#9
Posted 14 December 2016 - 11:12 AM
Goku, on 14 December 2016 - 10:27 AM, said:
It seems MRT is supported in XNA 3.1 and I have been meaning to use it to do some experiments with deferred rendering, but it's not a small change to the rendering code to support.
#10
Posted 14 December 2016 - 01:51 PM