terrain question??

Started by
2 comments, last by XerXis 19 years, 3 months ago
im working on a 3d engine and im working on actually loading in a terrain. Now i have done it with OGL easy, but with DX, the texture system is creating a problem for me. What is the most efficient way to load in a terrain. Would it be to have a list of textures and associate the geometry based on what texture it has and the loop through them and create a VB for each texture, a global VB for everything? This also poses another issue. If i sort based on texture, what if a certain poly has multiple textures? I guess basically what im trying to figure out, is what would be the best method for loading in a bunch of geometry and be able to maintain multiple texturing. ps. when i say terrain, i mean any world environment, not necessarily a heightmap or something. I just need a world to interact with. THanks for the help
http://www.thedizzle.com
Advertisement
I made a very simple random terrain generator a little while back. What I did was iterate through and create a random height for the Y axis, in your case I think your just loading it right? Anyway load it into an array, put that array into a vertex buffer. Then to load a texture or just color to it, iterate throught he array again an put the color of that current vertex into another array, and add the color that way. That may seem general, but let me know if that helps or not.
thats fine and everything, but the problem comes when i already load the vertex buffer up but have different textures for the geometry, how is it to know which one to use. Only thing i can think of is sort geometry by texture and then render each vertex buffer(each texture being its own VB). But then the multiple texture issues comes into mind.
http://www.thedizzle.com
you could make a pixelshader which blends several textures together. you have for example a dirt and a grass texture which are present on every tile of your terrain in a combination defined by a blend texture and calculated by your pixel shader

This topic is closed to new replies.

Advertisement