Elvas Tower: Forests and Cruciform Objects Don't Get Shaded? - Elvas Tower

Jump to content

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Forests and Cruciform Objects Don't Get Shaded? Appear same brightness whether in a shadow or full sunlight Rate Topic: -----

#1 User is offline   PerryPlatypus 

  • Fireman
  • PipPipPip
  • Group: Access 1 Open Rails Forums
  • Posts: 194
  • Joined: 13-January 10
  • Gender:Male
  • Location:Post Falls, ID
  • Simulator:Open Rails
  • Country:

Posted 01 December 2016 - 11:11 PM

Is there a reason why forest regions (or it seems, any objects with cruciform lighting?) do not allow shadows to be cast onto them? It makes sense for cruciform objects to not cast shadows onto themselves, but other objects, or even the terrain, do not seem to have any shadow effect on them. See the screenshot below:
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 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,490
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 14 December 2016 - 05:46 AM

View PostPerryPlatypus, on 01 December 2016 - 11:11 PM, said:

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?

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 User is offline   Goku 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,785
  • Joined: 12-December 13
  • Gender:Male
  • Simulator:my own
  • Country:

Posted 14 December 2016 - 05:53 AM

Prevent self shadowing using shadow maps is impossible. Or, it would be possible, but it would require more than one shadow map which is very expensive (one shadow map for cruciforms, second for other objects).
In TSRE I use shadows on cruciforms because grass looks amazing with shadows.

#4 User is offline   wacampbell 

  • Member since Nov. 2003
  • Group: Fan: Traction Nuts
  • Posts: 2,345
  • Joined: 22-November 03
  • Gender:Male
  • Location:British Columbia, Canada
  • Country:

Posted 14 December 2016 - 06:20 AM

Yes, the original discussion here was that cruciform trees look bad with shadows, but as Goku says, cruciform grass looks good with shadows. Since cruciform is used mostly for trees in many routes, we elected to disable shadows on cruciform material. Lets face it, the cruciform technique is meant to fake a shape using flat panels, and the self shadowing reveals the deception.

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 User is offline   wacampbell 

  • Member since Nov. 2003
  • Group: Fan: Traction Nuts
  • Posts: 2,345
  • Joined: 22-November 03
  • Gender:Male
  • Location:British Columbia, Canada
  • Country:

Posted 14 December 2016 - 08:27 AM

I'll just add, if this issue needs to be revisited, I support the management team's decision on the best way forward.

#6 User is offline   PerryPlatypus 

  • Fireman
  • PipPipPip
  • Group: Access 1 Open Rails Forums
  • Posts: 194
  • Joined: 13-January 10
  • Gender:Male
  • Location:Post Falls, ID
  • Simulator:Open Rails
  • Country:

Posted 14 December 2016 - 10:24 AM

Thanks for the input, guys. For whatever reason, none of the links to that thread are working. I wonder if the thread is in a section of the forum that only members of the Open Rails team can view? I would probably understand the situation more if I could see the thread.

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 User is offline   Goku 

  • Superintendant
  • Group: Status: Elite Member
  • Posts: 1,785
  • Joined: 12-December 13
  • Gender:Male
  • Simulator:my own
  • Country:

Posted 14 December 2016 - 10:27 AM

View PostPerryPlatypus, on 14 December 2016 - 10:24 AM, said:

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).

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 User is offline   SP 0-6-0 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 985
  • Joined: 12-November 05
  • Gender:Not Telling
  • Location:Another planet.
  • Simulator:MSTS/ORTS
  • Country:

Posted 14 December 2016 - 10:44 AM

I for one would like to see the feature be re-enabled as what Perry points out on his desert route also affects my desert mountainous route as well. It should be an option available as the end out come of what looks good or not is more up to the route builders to control.

Robert

#9 User is offline   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,490
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 14 December 2016 - 11:12 AM

View PostGoku, on 14 December 2016 - 10:27 AM, said:

If OR can use MRT it is possible without huge performance loss, but xna probably doesn't support MRT.

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 User is offline   disc 

  • Foreman Of Engines
  • Group: Private - Open Rails Developer
  • Posts: 818
  • Joined: 07-October 12
  • Gender:Male
  • Simulator:OpenRails
  • Country:

Posted 14 December 2016 - 01:51 PM

What about just adding support of forest regions with 3D objects? That's the way sooner or later. However as OR supports instancing, placing 3d object one by one is the same for performance, but forest regions would be easier for route editors.

  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users