Friday, July 8, 2011

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

In my previous post on this topic I explained how I added new textures to my route's private texture BIN. Now its time to explore what I discovered while looking through the rest of the BIN file, make some adjustments for the CC for the spring and winter seasons, and make use of some of the automated texturing features available. I will start at the top of the BIN and work down, but you will see me jump around when it gets to adjusting the procedural flora. Don't worry, it will come together nicely when its all done.

It snows here once every 3 years... on the hill tops... like confetti. My wife who is from the East Coast scoffs at it. Getting rid of the snow is the first change I want make. When looking at each ground texture listed in the BIN, I see entries in each texture all four seasons. Most of these textures use the base texture and then add a winter texture. I am interested in changing Winter textures so I will re-path them to the spring, or the default (Summer) as needed.

Original:
<cMixTexDescriptor d:id="15900888">
   <BaseTextureName d:type="cDeltaString">Kuju\RailSimulator\Environment\Terrain\Grass\Grass000</BaseTextureName>
   <BaseSpringTextureName d:type="cDeltaString"></BaseSpringTextureName>
   <BaseSummerTextureName d:type="cDeltaString"></BaseSummerTextureName>
   <BaseAutumnTextureName d:type="cDeltaString"></BaseAutumnTextureName>
   <BaseWinterTextureName d:type="cDeltaString">Kuju\RailSimulator\Environment\Terrain\Grass\Grass000_Wi</BaseWinterTextureName>
   <DisplayName d:type="cDeltaString">Green Grass</DisplayName>
   <LocalisedDisplayName>
...
Revised:
<cMixTexDescriptor d:id="15900888">
   <BaseTextureName d:type="cDeltaString">Kuju\RailSimulator\Environment\Terrain\Grass\Grass000</BaseTextureName>
   <BaseSpringTextureName d:type="cDeltaString"></BaseSpringTextureName>
   <BaseSummerTextureName d:type="cDeltaString"></BaseSummerTextureName>
   <BaseAutumnTextureName d:type="cDeltaString"></BaseAutumnTextureName>
   <BaseWinterTextureName d:type="cDeltaString"></BaseWinterTextureName>
   <DisplayName d:type="cDeltaString">Green Grass</DisplayName>
   <LocalisedDisplayName>
...
There is a attribute for which procedural flora the texture should use, its density. I will get into this further down, but one last note before I move to the next section. Getting rid of snow is not as simple as overriding the settings in the Texturing.bin file. I will need to crack open the track BIN and make alterations there as well. I'll leave this for another post, as I need to figure out if I am allowed to do this because I use the 3DTrains SP/SF ScaleRail which is licensed and may not be allowed to alter it.


The hills are alive... but tan. This is annoying me to no end. I look out at the his from the cab and I see green (and gray Winter!), and as I near the hills they turn tan. The hills are green in the Bay Area during Winter and Spring, or if you get a week worth of rain in Summer or Autumn, otherwise its tan. I should be able to change that color in the DistantTerrainColour section, or so I thought. Here are the settings I used to make a dark tan color.
<DistantTerrainColour>
 <cHcColour>
  <Red d:type="sFloat32" d:alt_encoding="00000020D49ADA3F" d:precision="string">0.4157</Red>
  <Green d:type="sFloat32" d:alt_encoding="000000A03E57D73F" d:precision="string">0.3647</Green>
  <Blue d:type="sFloat32" d:alt_encoding="000000C00E9CCB3F" d:precision="string">0.2157</Blue>
  <Alpha d:type="sFloat32" d:alt_encoding="000000000000F03F" d:precision="string">1.0000</Alpha>
 </cHcColour>
</DistantTerrainColour>
This was tricky to figure out. 1.0 is the same as 255 in RGB format. Instead of doing the math I was able to sample a screen shot, get the RBG from MS Paint, and then use the blueprint editior to get these unusal values.


As I eluded to, this is not working the way I expected. Instead of painting the distant hills it fringed the area between the 'here' and distant hills. To better illustrate how this section works I changed the color to red.


From the mountains, to the prairies, To the oceans, white with foam... OK, hold the foam, that's a different object from the Project Platform anyway. Here we come to a handy way to automate your terrain. You can set the textures for three distinct elevations, and then it will blend them for you. Here are the default values:
<LowGroundTextureIndex d:type="sUInt32">1</LowGroundTextureIndex>
<MidGroundTextureIndex d:type="sUInt32">2</MidGroundTextureIndex>
<HighGroundTextureIndex d:type="sUInt32">16</HighGroundTextureIndex>
The Developer Wiki gives a clue how to set these, but it should have spelled it out. The index is the list of textures you have, the first texture being 1 not 0. Looking at my list I see the first indexed texture as:
<BaseTextureName d:type="cDeltaString">Kuju\RailSimulator\Environment\Terrain\Grass\Grass000</BaseTextureName>
The second is:
<BaseTextureName d:type="cDeltaString">Kuju\RailSimulator\Environment\Terrain\Grass\Grass001</BaseTextureName>
The 16th is:
<BaseTextureName d:type="cDeltaString">Kuju\RailSimulator\Environment\Terrain\Snow\Snow000_A</BaseTextureName>

Then a little below this we have:
<LowToMidHeightPoint d:type="sFloat32" d:alt_encoding="0000000000008940" d:precision="string">800.0000</LowToMidHeightPoint>
<LowToMidThreshold d:type="sFloat32" d:alt_encoding="0000000000C06240" d:precision="string">150.0000</LowToMidThreshold>
<MidToHighHeightPoint d:type="sFloat32" d:alt_encoding="0000000000C09240" d:precision="string">1200.0000</MidToHighHeightPoint>
<MidToHighThreshold d:type="sFloat32" d:alt_encoding="0000000000C06240" d:precision="string">150.0000</MidToHighThreshold>
These settings will adjust at what altitudes these textures will be used. Here is what I changed mine to:
<LowGroundTextureIndex d:type="sUInt32">1</LowGroundTextureIndex>
<MidGroundTextureIndex d:type="sUInt32">40</MidGroundTextureIndex>
<HighGroundTextureIndex d:type="sUInt32">4</HighGroundTextureIndex>
and:
<LowToMidHeightPoint d:type="sFloat32" d:alt_encoding="0000000000008940" d:precision="string">100.0000</LowToMidHeightPoint>
You might be thinking... 'Index 40?' well what I did here was clone index 4 which was 'Very Dry Grass' and to 'Very Dry Grass (Hills)' and increase FloraDensity to .5000 (I may adjust this higher!). This will give my hill areas more body. As for the number 40, that was pure coincidence. More on this below.


How to better grow your... rocks? There is a section for that.
<RockTextureIndex d:type="sUInt32">1</RockTextureIndex>
the line above specifies which rock texture index you would like to use.
<RockGradient d:type="sFloat32" d:alt_encoding="0000000000002440" d:precision="string">10.0000</RockGradient>
<RockThreshold d:type="sFloat32" d:alt_encoding="0000006066661A40" d:precision="string">6.6000</RockThreshold>
The gradient and threshold adjust when the rock texture will be used. I've played around with these settings and decided to leave them be. The effects, even after adjusting them don't match the reality of the route which does have some rock faces, so I will paint over them with my new handy 'Texture 40', and then paint back the rocky areas back as needed. I will say that in the examples I have seen this used it was fairly impressive, but it looks more like shadows than rocky facings.


My weeds are imported from Spain... I kid you not. When the conquistadors came to California they brought over all sorts of new seeds for corps and their weeds. In this case I am looking for false brome (or Brachypodium distachyon). This plant eventually became the dominate species of grass for the area, and covers all the hills and flat lands in the greater part of California. There are a few in the EU flora textures in the grass*.TxDc that look close, and unfortunately the US textures only have one season. To change the procedural flora, you need to know the index of the vegetation you want. Here the wiki proved useful. Please read for your reference:
http://www.railsimdownloads.com/wiki/tiki-index.php?page=procedural+flora

Unfortunately I cannot reference an existing flora index. If I did then would end up adding the flowers from the meadow texture for the default seasons (Summer and Winter), so I will need to clone the textures to my provider/product folder and repaint each season's texture. This is not rocket science and there are plenty of open indexes to use, so I will copy and past the plant I want into the open index (I will use 15 since its at the end). I will also clone the default grass texture into Winter so I can add the Spring grass item to it. One thing to remember, you need to also include a color dropout on the alpha layer or it will not show in game.


Now that this step is complete I can go now back to my ground textures and change the flora index to 15 to my 'Texture 40'.
<cMixTexDescriptor d:id="15900888">
  <BaseTextureName d:type="cDeltaString">Kuju\RailSimulator\Environment\Terrain\Grass\Grass003</BaseTextureName>
  <BaseSpringTextureName d:type="cDeltaString"></BaseSpringTextureName>
  <BaseSummerTextureName d:type="cDeltaString"></BaseSummerTextureName>
  <BaseAutumnTextureName d:type="cDeltaString"></BaseAutumnTextureName>
  <BaseWinterTextureName d:type="cDeltaString"></BaseWinterTextureName>
  <DisplayName d:type="cDeltaString">Very Dry Grass (Hills)</DisplayName>
  <LocalisedDisplayName>
   <Localisation-cUserLocalisedString>
    <English d:type="cDeltaString">Very Dry Grass (Hills)</English>
    <French d:type="cDeltaString"></French>
    <Italian d:type="cDeltaString"></Italian>
    <German d:type="cDeltaString"></German>
    <Spanish d:type="cDeltaString">Hierba verde</Spanish>
    <Dutch d:type="cDeltaString"></Dutch>
    <Polish d:type="cDeltaString"></Polish>
    <Russian d:type="cDeltaString"></Russian>
    <Other/>
    <Key d:type="cDeltaString"></Key>
   </Localisation-cUserLocalisedString>
  </LocalisedDisplayName>
  <Wang d:type="cDeltaString">eTrue</Wang>
  <FloraIndex d:type="sUInt32">15</FloraIndex>
  <FloraDensity d:type="sFloat32" d:alt_encoding="000000000000E03F" d:precision="string">0.5000</FloraDensity>
  <Category d:type="cDeltaString">eGrass</Category>
</cMixTexDescriptor>


There is something missing from all this automation. RSC should have added a section to have either the north or south face of the hills/mountains get their own blended texture. In the hills around here vegetation grows more on the north face, and I really could have used it even if as a guide for placing large areas of small growth.

I did not invent this wheel, but I had to figure out how change it's tire. It took time to crawl the web for some of these settings and I know that others have already used them for their routes. Now that I have all of this information I would have started my route differently, beginning with adjusting the terrain before laying any track, or painting on ground textures, or setting decals. Having done so would have saved some time, because now I have more than half the mainline covered up with objects. I am confounded as to why this information is not more readily available or I am just not finding it? I hope I can help to fill this hole. I think there is still one more part I can write about texturing to finish this series on how I will create some of my own ground textures. This will happen later than sooner since I will make on an 'as needed' basis.

Now, to give credit where it is due. There were two major sources I referred to for clues on how to make these alterations. The first is Derek's The Art of RailWorks blog, and the second is the RSC Developer wiki on terrain (which is sadly incomplete). And not to be left out I did run across a tool (which I did not use) called KRSTool2 which apparently helps adjust your route and terrain.

Part 1 | Part 2 | Part 3 | Part 4

No comments:

Post a Comment