Friday 29 June 2012

Terrain with Roads



Well this is the source post for my terrain and road map stuff. I will briefly describe what I have added and then onto where the source download is.

So all I have done is add another Vector4 to the vertex element that holds the weight of the given road texture to be drawn. This then needed a new string array to hold the asset paths and an array of Texture2D's, one for the textures and one for the normal maps. Also a new texture to hold the road map it's self.

I added code to the LoadData method to store the road map weights for the three road channels, the LoadGraphiceContent method gets altered to load the extra textures, and naturally the Draw method and constructor.

I have also added an ambient light parameter, but this was a precursor to what I am doing with the Dynamic Sky Sphere so it is not used much here.

I also intend to add a GetRoadChannel method so that you can tell if you are on a road and if so, what road you are on so if you are using it for an off roading type game then you can alter the physics when the car is on or off the road. Might even extend this to the terrain weights too as driving over grass will be different to driving over sand or stone.

GenericXNAExampleTerrain2.zip

2 comments:

  1. Hello Charles, I was searching for an example terrain much like this by tying colors to the individual texture images. I would greatly appreciate it if you could upload the source code again. The link seems to not be working. Thank you

    ReplyDelete
    Replies
    1. I should have the link up in the next couple of hours :)

      Delete