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 » Wed Aug 01, 2018 2:28 pm

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!
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3776
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 134
Contact:

Re: Cull transparent geometry

Post by dark_sylinc » Sat Aug 04, 2018 12:25 am

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.
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 620
Joined: Sun Mar 30, 2014 2:51 pm
x 86
Contact:

Re: Cull transparent geometry

Post by paroj » Sat Aug 04, 2018 1:09 am

you could also implement your own LodStrategy to integrate with the Ogre LOD system:
https://ogrecave.github.io/ogre/api/1.1 ... ategy.html
0 x

Ezerg
Gnoblar
Posts: 14
Joined: Wed Oct 26, 2016 4:14 pm
Location: Rosario, Argentina
x 1

Re: Cull transparent geometry

Post by Ezerg » Mon Aug 06, 2018 3:10 pm

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?
0 x

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 3776
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 134
Contact:

Re: Cull transparent geometry

Post by dark_sylinc » Mon Aug 06, 2018 6:14 pm

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.
0 x

Ezerg
Gnoblar
Posts: 14
Joined: Wed Oct 26, 2016 4:14 pm
Location: Rosario, Argentina
x 1

Re: Cull transparent geometry

Post by Ezerg » Mon Aug 06, 2018 6:56 pm

All cleared out then, thanks!
0 x

Post Reply