Page 1 of 1

Cull transparent geometry

Posted: Wed Aug 01, 2018 2:28 pm
by Ezerg
Hi everyone,
I'm having the following issue:
On my game I have entities with 2 sub-meshes each, one is heavily detailed and the other is simpler. And after certain events I want to set visible just one at a time (some kind of a very custom LOD). One big detail is that when my game starts the default camera's frustum covers all entities so they are all visible at once, what I don't want to happen is that my "heavy sub-mesh" gets visible on all entities at startup.

So when I create each sub-mesh I assign each a material, for the large one I'm using this material that gives me full transparency (so its becomes invisible):

Code: Select all

    material Full_Transparent
{
        receive_shadows off
        transparency_casts_shadows off
        technique
        {
                pass
                {
                        depth_write off
                        lighting off
                        depth_func always_fail
                }
        }
}
On screen the heavy mesh is not visible and the light one is, that's ok, but polygons count is high as if all heavy meshes were visible!
I'm afraid that those pixels are still being rendered somehow, how can I cull fully transparent entities?

Thanks a lot!

Re: Cull transparent geometry

Posted: Sat Aug 04, 2018 12:25 am
by dark_sylinc
Hi!

There is no way to hide the individual submeshes like you're trying to (without wasting a lot of GPU power as you've found out).
You can split the submeshes into two meshes, so it's handled by two separate Entity pointers attached to the same scene node, and then call entity->setVisible( false ) on the one you want to hide.

Re: Cull transparent geometry

Posted: Sat Aug 04, 2018 1:09 am
by paroj
you could also implement your own LodStrategy to integrate with the Ogre LOD system:
https://ogrecave.github.io/ogre/api/1.1 ... ategy.html

Re: Cull transparent geometry

Posted: Mon Aug 06, 2018 3:10 pm
by Ezerg
Thanks Matias, Paroj for your answers,
I think that I'll have to split my entity into 2 with one sub-mesh each as Matias said.

I still have one doubt about entities visibility:
is there a way to make the same effect as Entity::setVisible() but with a material script?

Re: Cull transparent geometry

Posted: Mon Aug 06, 2018 6:14 pm
by dark_sylinc
Ezerg wrote: Mon Aug 06, 2018 3:10 pm is there a way to make the same effect as Entity::setVisible() but with a material script?
No. All possible tricks at material level like the "depth_func always_fail" one will make the object invisible, but it will still be processed by the CPU & GPU.

Re: Cull transparent geometry

Posted: Mon Aug 06, 2018 6:56 pm
by Ezerg
All cleared out then, thanks!