Sunday, October 2, 2011

Adding ground texture's to the CC (Part 4)

Now that RW3 is live, I can pick up where I left off in Part 3, and revisit a couple features which are now working properly. None of the features I am going to talk about are new to RW3, however, they have been given a breath of new life with the updated rendering engine.

My shadow is larger than yours... This all related to the Time Of Day files which control the position of the Sun, Moon, Fog, and their luminosity during each of the four seasons. Though this has little to do with texturing it does affect the quality of how your route looks and indirectly how the ground textures look. I recommend you first read the scant information found on the RSC wiki so you have an understanding of the parameters I will altering, and for those that are modeling prototypical routes, I recommend that you observe how fog works in real life for the area you are working on, because as you will soon see you will be able to make adjustments for different parts of the day.

The first thing I will do is make a private copy of the TimeOfDay BIN files for my route. I will copy the existing ones found in the TimeOfDay folder under Kuju\RailSimulatorCore to my DMV\CC_Route folder (so I will have my own TimeOfDay folder in my route folder). Next I will make a backup of my 'Route blueprint000.bin' file so I can revert my changes if SBHH. Using RW_Tools I will open my 'Route blueprint000.bin' and look for the section called "Skies". Replace any reference of Kuju with DMV, and RailSimulatorCore with CC_Route. Now I can reference my new TimeOfDay files and any changes I make will not affect any other routes base on the Kuju files.

Original:

	
		
			
				
					
						Kuju
						RailSimulatorCore
					
				
				TimeOfDay\Core_Spring.xml
			
		
Updated:

	
		
			
				
					
						DMV
						CC_Route
					
				
				TimeOfDay\Core_Spring.xml
			
		
In this example I will only show edits for the Summer season TimeOfDay file 'Core_Summer.bin'. Don't worry the process will be the same for the other three seasons. Once again there is a lot going in this file, and I will only be changing a few of the features in here, specifically the position of the Sun, Moon and Fog. Lets dig in.

The first alteration will be the path of the Sun. This will make our shadows more realistic as the day progresses in game. We need to set the time when the Sun rises and sets. To find this information I Googled a bit and found this handy site: http://www.timeanddate.com/worldclock/astronomy.html?n=224&month=7&year=2011&obj=sun&afl=-11&day=1

Please see the update following after this code example.

I dialed in July 1st since that is the longest day in the year, and thus mid-summer.

	
		
			
				<_iHour d:type="sInt32">5
				<_iMinute d:type="sInt32">51
				<_iSeconds d:type="sInt32">0
			
		
		
			
				<_iHour d:type="sInt32">20
				<_iMinute d:type="sInt32">36
				<_iSeconds d:type="sInt32">0
			
		
		-0.57
	

I followed the same process for the rise and set of the Moon.


	
		
			
				<_iHour d:type="sInt32">6
				<_iMinute d:type="sInt32">13
				<_iSeconds d:type="sInt32">0
			
		
		
			
				<_iHour d:type="sInt32">20
				<_iMinute d:type="sInt32">58
				<_iSeconds d:type="sInt32">0
			
		
		-0.5
	

What is interesting, and what some of us (including myself) take for granted is that the Moon does not have to be up at night. It can be a "day time" visitor. I found it neat that it ended up this way for summer.

There is one parameter here which is crutial. This is the AzimuthAngle. This value is not easy to come by as its in a strange negative decimal format. In fact according to Hack of 3DTrains its bugged. He explains that since we are in North America the number should not be negative at all... but we have to live with it or it will break all existing routes... yuck. So how do we come by this number? Again Hack had some advice on this.
Even in the summer, the sun should just be off from directly overhead. I believe the sun azimuth (backwards since the release of RS) would be somewhere in the -0.6 to -0.65 neighborhood (NY, PA, WA, etc.). Further north, say into New England, would be around -0.7, and So Cal (San Bernardino) would be about -0.5.
Looking at Google Maps San Francisco is a bit lower than Pennsylvania so I went with -0.57, and guessed at the Moon's value by comparing it to the Sun's value. The results provided a much improved experience.

Update Oct 5, 2011:

A few of us on RWA have been digging further into this and found a method to set AzimuthAngle more accurately.

First visit this site and dial in your route location: http://www.solarplots.info/Default.aspx
Again I will use July 1, 2011 and I get this plot for the sun.

Note that in the RW Dev Wiki is spoke about having a value between 0 and 1.5. From what this chart tells me the max is ±150. After some experimentation it was not a simple matter of moving the decimal over by two, and it was after listening to others play with the numbers I came up with an equation which seems to work rather well.

Take the starting sunrise number -120 and subtract it from -150, which gives you -30, then move the decimal over by two places which produces -0.30 and use this number for the AzimuthAngle.

(Max Angle Sunrise) - (Sunrise) / 100

You still need to make sure that the result is in the negative if you are in northern hemisphere. Unfortunately for the moon, RW does not honor a true lunar cycle, so we will all need to give its AzimuthAngle our "best guess" for now.

Special thanks to Paragon from RWA for verifying my equation, and the RWA community for pushing for the best experience the game can offer.

Before Changing the Sun
Revised Sun at Noon

Fog and smog should not be confused and are easily separated by color.
~Chuck Jones
Not that you would really want smog on your route... unless you really want to add that touch of realism, but lets talk about fog and soon you will understand how to make smog. If you have seen the Horseshoe Curve videos on YouTube, or have the route you will see that an unmistakable feature has been removed (or moved as you will soon see). The in game fog has been lifted and the mountains are clearly seen. The time has come for me to do the same, but first lets recall that in my previous post on terrain I mentioned that DistantTerrainColour is not functioning. I may have made this statement in error, as it may have been the fog that was always in the way of seeing my changes take affect. Unfortunatly I cannot test this since there is no simple way to revert back to RW2 (why would I anyway?). To find the settings for Fog we need to look at several sections starting with 'BreakOfDawnTOD'. In this section and all the other TOD sections I find these parameters of adjusting the fog.

Original values:

	
		0.6314
		0.6667
		0.6745
		1.0000
	

1100.0000
2000.0000
This controls where the fog should start (relative to where the camera is), and what the density of the fog should be, controlled by where it should end. The further apart you make these values the thinner the fog will be. I need to stress that you need some fog to occur in game, as it happens all over the world at different parts of the day, and it provides a way to give us some depth to our landscape as closer terrain will be clear, and terrain just beyond could be ever so slightly obscured. In this example I will be pushing the fog back just beyond the first set of hill so that Mission Peak is clearly visible, and anything beyond it (which will be left to another tutorial about far distant objects) will be obscured. I will also change the color of the fog since there is too much of a blue haze (at least for noon time). As you can tell, by changing the color you could indeed make smog very easily, however it will affect the entire route, and in my case where the CC spans over 180 miles, the smog would not cover this area.

New settings for NoonTOD
			

	
		0.7922
		0.8118
		0.8157
		1.0000
	

17000.0000
25000.0000
Without Fog
With Fog
With the fog gone I can now adjust my DistantTerrainColour which found in my Texturing.bin file in my DMV\CC_Route\Environment\Terrain\ folder (please refer back to my first post in this series on how to make your own private Texture BIN file). Something you should note is that you need to account for the fog altering your distant terrain color (usually by darkening it). I found that I need to use a slightly lighter color to achieve a satisfactory (meaning I will likely tweak it in a day or two) affect.
			

	
		0.6314
		0.5529
		0.4824
		0.0000
	

Note the Alpha. I have adjusted this from 0.0 to 1.0 (0 being black, and 1 being white, all other values in between like 0.521 is a shade of gray), and it does not appear to make any difference in game. However, it is being used in the Horseshoe Curve, and even more interesting it can be changed with the season (something I wanted to do when de-winterizing my route in earlier parts):

Horseshoe Curve:
			

	
		0.7647
		0.7843
		0.7216
		0.0000
	

Just for fun I wanted to test this out so I used the default DistantTerrainColour for winter to see how it works. I also tested to see if autumn and spring would work and just plugged in some test numbers to get a reaction from the simulator.

			

	
		0.6314
		0.5529
		0.4824
		0.0000
	


	
		0.5
		0.5529
		0.4824
		0.0000
	


	
		0.7
		0.5529
		0.4824
		0.0000
	

Here are the results:

Original Winter

New Test Winter

New Test Autumn
New Test Spring
A word of warning however. DistantTerrainColor is based on where your camera is standing. So if you are looking down from at top the mountain... Well, it appears I live in a desert.


Part 1 | Part 2 | Part 3 | Part 4

No comments:

Post a Comment