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.
alpha clipping Topic is solved
-
- Bronze Sponsor
- Posts: 513
- Joined: Sun Jan 18, 2015 4:20 pm
- Location: Buenos Aires, Argentina
- x 188
Re: alpha clipping
Hello, what ogre version are you using?
Can you provide screenshots and material definitions?
-
- OGRE Team Member
- Posts: 2180
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1168
Re: alpha clipping
in meshviewer you can hover the submeshes to highlight them and find the according material name:
you can also play around with the assimp API to find a way to determine the presence of alpha testing.
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: alpha clipping
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.
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: alpha clipping
paroj wrote: Tue May 27, 2025 1:05 pmin meshviewer you can hover the submeshes to highlight them and find the according material name:
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.
-
- OGRE Team Member
- Posts: 2180
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1168
Re: alpha clipping
slapin wrote: Tue May 27, 2025 2:34 pmThe 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
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: alpha clipping
Alas, found nothing like that. Also I found no texture transparency even. Only color transparency...
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: alpha clipping
here https://github.com/assimp/assimp/blob/4 ... r.cpp#L284 is code in assimp direct importer and it works (sets material property).
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: alpha clipping
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...
-
- OGRE Team Member
- Posts: 2180
- Joined: Sun Mar 30, 2014 2:51 pm
- x 1168
Re: alpha clipping
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
-
- Bronze Sponsor
- Posts: 77
- Joined: Fri May 23, 2025 5:04 pm
- x 2
Re: alpha clipping
Aw, thanks a lot for this!