|
Author Topic:   Generating texture coords for ROAM based terrain
JamesC
Member
posted June 18, 2000 03:00 PM            
Anyone want to throw me a bone as to how to do this? In Bryan's implementation, he uses OpenGL's auto generated texture coords... I've never messed with auto generated coords and I'm also rendering in D3D, so I'm afraid his wonderful example won't help me much in this case. Because of ROAM's recursive triangle generation, is using auto texture coords the way to go? It seems trying to set them by hand would be a real headache being that the x/y vertices change positions as you recurse into the variance tree. I know D3D has some type of support for auto texture generation, but I've never messed with it.

IP:

JamesC
Member
posted June 19, 2000 12:39 AM            
Actually, I figured out howto do it without using auto texture generation... and it was stupidly simple If anyone else stumbles onto this problem, all you have to do is take the vertex x and z position and div that by the max size of your terrain, that will give you a texture coord between 0 and 1... and this is an easy way to tile textures across terrain

IP:

Cthulhu
Member
posted June 19, 2000 06:10 PM            
I have no problem generating texture coordinates in ROAM, but there is another, tougher one.

I want to limit single texture size to 256x256 because of 3dfx restrictions. I need an efficient method to put triangles into correct vertex buffers, since I want to render terrain with one call per texture.

Recently I had one triangle pool for each tribintree, two of them forming a texture sized part of the terrain. Now that I moved for one triangle pool, I would need to store 'owner tree' in triangle class or something similar..

IP:

JamesC
Member
posted June 19, 2000 09:59 PM            
I'm not sure I follow what your asking... do you want to sort your triangles based on the texture they use? As for the 256x256 limit, IMHO it would be best to keep the textures whatever size you want them, then shrink or split the texture into 256x256 textures on the Voodoo cards, don't make people with cards that can handle bigger textures suffer for 3dfx's bad design

IP:

Bryan T
Member
posted June 20, 2000 12:15 AM            
I'm not sure I follow the problem either. If you have one patch per texture (ie: two bin tri trees), then when you call a render on that patch it could bind it's texture, then render the triangles contained in that patch.

Even if your pool is shared between patches, the trees only reference the triangles in their heirarchy, not triangles of a different patch. (this is what my demo does)

Are you using a two-pass split-only engine, or some other?

--Bryan

IP:

Cthulhu
Member
posted June 20, 2000 11:27 AM            
I mean that I want to sort my triangles based on texture they use, which in my case is same as which square part of the terrain they are in. My textures are bitmaps covering all the terrain (like in Tread Marks).

My engine is currently split-only (though I'm going to make it split-merge). Currently I use only one pass trough trees (magic ). I don't want to recurse all the trees again just to find out which buffer I should put the triangles in.

I just figured out just need some index stored in each triangle. That wouldn't eat much memory. That way I don't have to calculate it from vertex coordinates.

Sorry, this message is propably even more messed that the last one.

IP: