Sign in to follow this  
relsoft

Octrees and textures

Recommended Posts

Hi, I have a working octree based render but so far it's limited to one texture per terrain. I would want to use multiple textures for the terrain though. Anyone know of a good way to use multiple textures on an octree subdivided terrain? ie. How do you manage meshes with multiple textures? I mean if a big mesh has lots of different textures, say grass, rock, soil, bark, etc. Right now I only use one hell of a big texture to limit texture binding. Thanks in advance. Edit: I think I found a good solution. 1. for every node, I assign a list of textureids 2. then sort the triangles to render according to texture id 3. Build the list So if I have like 3 texturesids in a node, I only bind 3 times instead of a per triangle binding. Is that a good solution? [Edited by - relsoft on March 20, 2007 10:14:22 PM]

Share this post


Link to post
Share on other sites
I dont think sorting would be necessary because you never know which node you're going to be in at any given time. You'd end up doing a linear search through all the nodes simply to get the the right texture id's. Just render your octtree as usual but during the creation process assign id's to the nodes that will have multiple texture id's. This way when you're going through the tree you simple have to check some variable like (numberOfIds) and if its greater than 0 you bind the proper Id's and render those textures.

EDIT:

This assumes that each node has its own list of Id's like you stated.

Share this post


Link to post
Share on other sites
By not batching your tris according to texture would mean a texture bind per triangle and that's really not very good. So I need to be able to batch my tris according to texture id's to limit render state changes.

NVM. I got it to work. 216k+ tris and it does not slow down at all.
750 duron, NV gf2mx 400 64 mb.

:*)


Share this post


Link to post
Share on other sites
I sorted. I just batched my renders according to textureID so that I limit the texture binds. The sorting itself is done at creation time so there are no speed hits at all.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this