0
votes

I am working on a terrain in XNA/C#. My intention is to be able to render multiple textures on the ground across the terrain. However, all tutorials like this are only capable of doing it with about 3-4 textures.

My idea is currently that I create a texture map in TGA that has different colors (RGBA) where each color represent a particular texture. The amount of Alpha in the color describes how much alpha the vertex on the position should have. And there would be a base texture.

However, I am a newbie in this area so I really need some getting started guides. So far I've managed to found none. All tutorials and resources are limited in terms of how many textures they support even though all modern games have many.

1
You may find our fine friends at GameDev are better able to help you with this.user7116
Be careful as texture sampling is a very costly operation, I think getting four textures on a terrain is plenty for most if any effects. What sort of graphical effect are you looking to implement?meds
Are you looking at adding decals?Neil Knight
You should maybe consider using a Texture Atlas. This will allow you to use 'more' textures while keeping to the fewer number using in the tutorials you have seen.3nixios

1 Answers

1
votes

Be sure you get your hands on this book: http://my.safaribooksonline.com/book/-/9781849690041/environmental-effects/ch07lvl1sec02

Sean describes a method here on defining a texture based on a colormap (i think this is what you're looking for). It's also illustrated with 4 textures or so, but once you figured this out, you'll be able to extend this to your requirements. Just define more colors, and more textures assigned to them. The problem with riemers' approach is that it's based on heights. It's a lot more difficult to render a path for example, especially when you're new to HLSL and XNA.

Let me know if this is the information you're looking for. It's a good book, even-though the sample don't always comply with each other.