Cull transparent geometry

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
Post Reply
Ezerg
Gnoblar
Posts: 14
Joined: Wed Oct 26, 2016 4:14 pm
Location: Rosario, Argentina
x 1

Cull transparent geometry

Post 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!
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Cull transparent geometry

Post 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.
paroj
OGRE Team Member
OGRE Team Member
Posts: 1994
Joined: Sun Mar 30, 2014 2:51 pm
x 1074
Contact:

Re: Cull transparent geometry

Post 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
Ezerg
Gnoblar
Posts: 14
Joined: Wed Oct 26, 2016 4:14 pm
Location: Rosario, Argentina
x 1

Re: Cull transparent geometry

Post 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?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Cull transparent geometry

Post 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.
Ezerg
Gnoblar
Posts: 14
Joined: Wed Oct 26, 2016 4:14 pm
Location: Rosario, Argentina
x 1

Re: Cull transparent geometry

Post by Ezerg »

All cleared out then, thanks!
Post Reply