在 XNA / C# 中渲染地形上的多个纹理
我正在 XNA/C# 中处理地形。我的目的是能够在整个地形上渲染多个纹理。然而,像这样这样的所有教程都只能做它有大约 3-4 个纹理。
目前我的想法是在 TGA 中创建一个具有不同颜色 (RGBA) 的纹理贴图,其中每种颜色代表特定的纹理。颜色中的 Alpha 量描述了该位置上的顶点应具有多少 Alpha。并且会有一个基础纹理。
然而,我是这个领域的新手,所以我真的需要一些入门指南。到目前为止我还没有找到任何东西。尽管所有现代游戏都有很多纹理,但所有教程和资源在支持的纹理数量方面都是有限的。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请确保您已经拿到这本书:
http://my.safaribooksonline.com/book/-/9781849690041/environmental -effects/ch07lvl1sec02
Sean 在这里描述了一种定义基于颜色图的纹理(我认为这就是您正在寻找的)。它还用 4 个左右的纹理进行了说明,但是一旦您弄清楚了这一点,您就可以将其扩展到您的要求。只需定义更多颜色,并为其分配更多纹理即可。里默斯方法的问题在于它是基于高度的。例如,渲染路径要困难得多,尤其是当您刚接触 HLSL 和 XNA 时。
请告诉我这是否是您正在寻找的信息。这是一本好书,尽管示例并不总是相互一致。
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.