Ogre 16bit limit issue

Everything related to 3D programming
Ampli
User
User
Posts: 51
Joined: Sun Jul 29, 2007 7:05 pm
Location: Sweden

Ogre 16bit limit issue

Post by Ampli »

Hi, I have issues with 3d models from Blender to PureBasic. Small objects with texutes is no problem but more complex models reach the 16bit vertex index limit fast.

Blender Report says:
Orginal Vertices: 9324
Exported Vertices: 40308

it's not over 65536, or do the shadows add to vertex count?

The model loads and shows in purebasic but I can't use any shadows.

I use:
Blender 3.0
PureBasic 5.73 and 6.0
windows 11
i9 9940x
64gb ram
rtx 2080 super

/Mikael
User avatar
yuki
Enthusiast
Enthusiast
Posts: 101
Joined: Sat Mar 31, 2018 9:09 pm

Re: Ogre 16bit limit issue

Post by yuki »

PureBasic's OGRE configuration does make use of stencil shadowing, which will have geometry generated. It does seem odd to have the 16-bit limit reached given the conditions you've mentioned though...

What sort of error message, if any, are you seeing exactly ? (and is there any possibility of sharing the model in question ?)

I'm hoping we can get shadow mapping in the future (with an updated version of OGRE under-the-hood) since this should solve a number of little funk points (especially self-shadowing, shading objects with alpha textures, ...) and make things more robust in general.
Ampli
User
User
Posts: 51
Joined: Sun Jul 29, 2007 7:05 pm
Location: Sweden

Re: Ogre 16bit limit issue

Post by Ampli »

If I make a tree with sapling tree gen in blender and want some more branches and splits it will exceed the vertex index limit even without leaves.
Does the ogre xml converter convert quads to tres? If so then I understand why the vertex count is added after convert.

/Mikael
User avatar
yuki
Enthusiast
Enthusiast
Posts: 101
Joined: Sat Mar 31, 2018 9:09 pm

Re: Ogre 16bit limit issue

Post by yuki »

Ampli wrote: Sat Dec 11, 2021 8:34 pmDoes the ogre xml converter convert quads to tres? If so then I understand why the vertex count is added after convert.
That's correct; most engines will want to work with triangles and I'm fairly certain that OGRE automatically converts quads to triangles.
Ampli wrote: Sat Dec 11, 2021 8:34 pmIf I make a tree with sapling tree gen in blender and want some more branches and splits it will exceed the vertex index limit even without leaves.
I'm not familiar with Sapling though it sounds like that's generating very fine geometry to breach the limit. From a quick look, it seems to be pretty greedy in terms of polys (some configurations taking several polys per leaf, which will quickly eat up available vertex count).

That said, using a 16-bit index buffer has been a fairly common restriction across many engines (though 32-bit support where needed is more common now), so it should be possible to workaround that one way or another.

If a super high level of detail is necessary, things could be broken up into multiple different meshes. Otherwise, I might suggest seeing if Sapling has some sort of adjustable quality OR decimating your models to reduce poly count (this might cause problems with leaves or certain trees...).

I've always personally struggled to get trees looking well with PB's OGRE since I like using few polygons for bunches of leaves, with an alpha texture containing many leaves together. AFAIK, none of the shadowing methods available mind the alpha level, and so each leaf would have to be composed of distinct polys to produce accurate shadows. If someone knows better (or a decent workaround), please correct me!

EDIT: another thread, [Casting Receiving Shadows], kind of relates the problem I encountered in the past with a visual aid. (it's nearly 10 years old so something may have changed since then)
User avatar
Samuel
Enthusiast
Enthusiast
Posts: 755
Joined: Sun Jul 29, 2012 10:33 pm
Location: United States

Re: Ogre 16bit limit issue

Post by Samuel »

Yeah, it's definitely the stencil shadows pushing you over the stencil limit. The more complex the mesh, the more complex the stencil.
Back in the day, I would alter the xml files manually, before generating the ogre mesh file. Should just have to change use32bitindexes="false" to "true".
Ampli
User
User
Posts: 51
Joined: Sun Jul 29, 2007 7:05 pm
Location: Sweden

Re: Ogre 16bit limit issue

Post by Ampli »

It Works better now with use32bitindexes="true"

Many thanks
Post Reply