Terrain heightmap to texture scale

Hey Dudes, I'm trying to do some cliche retro terrain effects to get a Tron-like texture that's kind of wireframe and kind of not. I've got a texture that looks like what the dudes at Introversion did for Darwinia (http://www.codinghorror.com/blog/2006/02/darwinia.html top screenshot) but I can't figure out the scale and offset for the texture so it will match up with the edges of the terrain polygons. I've just been playing around with the x and y scale and offsets trying to get a raised square to look right in one area and then checking a similar raised square in a different place, but they never both match up.

I've got the texture set to a scale of 32 and the texture resolutions on the terrain set to 32 and everything I can think of set to 32 and I still can't get anything to match up. Does anyone know any math-fu that'll get it all lined up? I really just want an effect like on the Darwinia terrain I linked above without having to just go do the terrain in a modeling application.

Thankyou so much for commenting this. i had to scale my textures to 1.953125 x 1.953125 when i wanted to do a digging system in a game im working on. This is a very helpful post dude, even though you didnt actually get an answer. You saved me a lot of time!

Thanks again!

I realize that this is a really old question, but to add in my own findings…

Look at the terrain size (Terrain Settings → Terrain Length & Terrain Width) and the Texture Size (in the Add Texture popup window, where you assign the texture)…

To have the texture scaled across the terrain once, set the X for the texture to be the same as the Terrain Width. Set the Y of the texture to be the same as the Terrain Length. You can also divide the Terrain Width & Terrain Length values by a number of times that you want the texture to tile, and that is the values that you would use for the texture itself.

For example… if your terrain is a nice, square terrain of 1000 x 1000, to get the texture to show up in a 10x10 grid you would set it’s X & Y values to 100…

The terrain part of Unity will scale the texture to fit. When using multiple terrains together, mapping the textures correctly is very important, as if you don’t the seams are annoyingly obvious. Because of that, setting your textures to be evenly distributed across the terrain is important. Also, I believe that it’s important to keep the number of times the texture is replicated across the terrain less than the Control Texture value…

So, in the example if you set the texture XY values to 10… ie, 100x100, your control texture should be at least 100 in size so that you can paint it correctly. Others can correct me if I am wrong on this, but it’s worked well for me so far. :smiley: