Page 1 of 1

Atlasing addon for StaticGeometry?

Posted: Wed Aug 25, 2010 8:55 am
by AshMcConnell
Hi Folks,

I'm not sure that Atlasing is a word, but anyway you know what I mean :P

I was thinking that it would be useful to combine textures in StaticGeometry if their materials were very similar except for the texture being used. This would hopefully reduce the batchcount further.

Would this be possible to do? Perhaps I'm being a little naive?

All the best,
Ash

Re: Atlasing addon for StaticGeometry?

Posted: Mon Aug 30, 2010 12:29 pm
by volca
I think this is best done offline - there are probably too many "Ifs" in my opinion - the materials have to be similar (how do I compare?), the geometry has to be unwrapped, etc. The implementation itself would not be that hard to do though (meaning if your meshes/materials are prepared properly, this should be simple). Anyway, if you'd need this without any coding, just atlas the textures in the first place where possible, merge similar materials into one. Static geometry will then use the same VBO for all those.

Re: Atlasing addon for StaticGeometry?

Posted: Tue Aug 31, 2010 4:23 pm
by AshMcConnell
Hi Volca,

Thanks for the reply. You are probably right.

Is there some standard Atlas class in Ogre? I am sure I saw a Ogre::Atlas class before, but I can't find it now in the source. Perhaps it was in Canvas. After the textures are atlased how difficult is it to modify the texture co-ords of the mesh to match up?

All the best,
Ash

Re: Atlasing addon for StaticGeometry?

Posted: Tue Aug 31, 2010 4:47 pm
by Wolfmanfx
There is a atlas class in particle universe, canvas, gorilla and vektrix. Maybe a unified atlas could unify them :)

Re: Atlasing addon for StaticGeometry?

Posted: Tue Aug 31, 2010 5:34 pm
by volca
AshMcConnell wrote:After the textures are atlased how difficult is it to modify the texture co-ords of the mesh to match up?
This depends on your meshes - if you have the meshes unwrapped (that is if the texturing coordinates never go out of 0-1.0f range), it is a simple thing to do. If not, this is not entirely trivial - you have to create new triangles to avoid the texture wrapping. This is the thing - I am not sure if it is a good idea to do this online, but it probably depends on the application.

I'd be interested to know if the unwrapping could be avoided by a vertex/pixel shader, without runtime penalization, with some careful thought (for example extra set of UV coordinates in vertex definition that would be used to describe the texture's atlas placement?) - maybe someone else will know better than me...

Writing a texture atlas seems to be popular these days I see :D

Edit: By unwrapping I of course mean to get rid of tiling. Sorry by the wrong choice of wording.