Terrain Texturing

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
maroquio
Posts: 1
Joined: Mon Oct 06, 2008 2:57 am

Terrain Texturing

Post by maroquio »

Please,
Can anyone help me with a code to texturing a BEPU Terrain?
I tried to do it reading the example, but I couldn't...
Thank you!
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Terrain Texturing

Post by Norbo »

BEPUphysics itself doesn't have any built in terrain rendering in it; the demo DisplayTerrain is just brute forcing the triangles. I don't have the code in front of me, but I'm not sure that the texture coordinates created are even usable for normal texturing. The textures used in the demos were just 1 pixel so it didn't matter if the uv's were totally wrong. If this is the case, you could try fixing them.

A more long-term solution would be to create your own terrain renderer/use a prebuilt terrain renderer. You could look at Riemer's XNA tutorials (there are a couple about terrain) or search through Ziggyware's site for some information/engines.

To match the render to the collision shape, the only requirement is to set up the triangles like they are in the engine. That is, if you tell BEPUphysics to use two triangles in each quad set up as (upper left, upper right, lower left) and (lower left, lower right, upper right), the renderer should draw in the same way to avoid the mesh being slightly different from the collision triangles.
Post Reply