alpha clipping Topic is solved

Problems building or running the engine, queries about how to use features etc.
slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

alpha clipping

Post by slapin »

Hi all! For details in one of my glb models I see that alpha clipping does not work, i.e. I see black or white color where should be nothing. In Blender everything looks fine. I don't want to enable transparency for performance reasons. Is there some way to fix alpha clipping on glb model from code? Thanks a lot for any suggestions.

User avatar
sercero
Bronze Sponsor
Bronze Sponsor
Posts: 513
Joined: Sun Jan 18, 2015 4:20 pm
Location: Buenos Aires, Argentina
x 188

Re: alpha clipping

Post by sercero »

Hello, what ogre version are you using?

Can you provide screenshots and material definitions?

paroj
OGRE Team Member
OGRE Team Member
Posts: 2180
Joined: Sun Mar 30, 2014 2:51 pm
x 1168

Re: alpha clipping

Post by paroj »

in meshviewer you can hover the submeshes to highlight them and find the according material name:

Image

you can also play around with the assimp API to find a way to determine the presence of alpha testing.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: alpha clipping

Post by slapin »

The above screenshot by @paroj is exactly the one I'd provide as he has my model.
I'd appreciate the example with meddling with materials inside glb. When I export it to Godot it shows ok so glb itself should be fine. With gltf+bin export the result is the same. I need to somehow make the alpha scissoring work with this model as it heavily depends on it.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: alpha clipping

Post by slapin »

paroj wrote: Tue May 27, 2025 1:05 pm

in meshviewer you can hover the submeshes to highlight them and find the according material name:

Image

you can also play around with the assimp API to find a way to determine the presence of alpha testing.

At current stage of affairs' I'd go with
hardcoding the scissoring but for some reason I was unable to find how yet :(
Also I don't quite understand at which stage I can meddle with mesh materials so to be sure it uses modified materials and not original ones.

paroj
OGRE Team Member
OGRE Team Member
Posts: 2180
Joined: Sun Mar 30, 2014 2:51 pm
x 1168

Re: alpha clipping

Post by paroj »

slapin wrote: Tue May 27, 2025 2:34 pm

The above screenshot by @paroj is exactly the one I'd provide as he has my model.
I'd appreciate the example with meddling with materials inside glb. When I export it to Godot it shows ok so glb itself should be fine. With gltf+bin export the result is the same. I need to somehow make the alpha scissoring work with this model as it heavily depends on it.

DeepSeek tells me to check for AI_MATKEY_GLTF_ALPHACUTOFF around here:
https://github.com/OGRECave/ogre/blob/e ... r.cpp#L975

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: alpha clipping

Post by slapin »

Alas, found nothing like that. Also I found no texture transparency even. Only color transparency...

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: alpha clipping

Post by slapin »

here https://github.com/assimp/assimp/blob/4 ... r.cpp#L284 is code in assimp direct importer and it works (sets material property).

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: alpha clipping

Post by slapin »

I even bundled custom static version of assimp (the one with debugging added) into OGRE_DIR and it works there,
but the images are still not clipped. So I guess I need to manually change materials at run time, for which I need help how to get material from glb, modify it and put back so Orge will pick it up instead of original material...

paroj
OGRE Team Member
OGRE Team Member
Posts: 2180
Joined: Sun Mar 30, 2014 2:51 pm
x 1168

Re: alpha clipping

Post by paroj »

what I meant is that the bits on the Ogre side are missing. This should do the job:
https://github.com/OGRECave/ogre/pull/3353

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 77
Joined: Fri May 23, 2025 5:04 pm
x 2

Re: alpha clipping

Post by slapin »

Aw, thanks a lot for this!