Page 1 of 1
MODELDEF flag to forcefully ENABLE backface culling
Posted: Fri Oct 05, 2018 4:38 am
by Marisa the Magician
I'm aware that there's one to disable it, but there isn't one to do the opposite, since models with normal renderstyle always have backface culling disabled and this can cause issues with models that expect culling to be on.
Re: MODELDEF flag to forcefully ENABLE backface culling
Posted: Wed Oct 16, 2019 11:55 pm
by Cherno
Old thread, but since I use a lot of models in my projects this would be a godsend since having to delete all backfaces manually before exporting for GZDoom is very cumbersome

Re: MODELDEF flag to forcefully ENABLE backface culling
Posted: Thu Oct 17, 2019 4:12 am
by Nash
Uhh, that doesn't make sense, a model should not HAVE backfaces unless you specifically went through the effort to make them in the model in the first place. Which means the model would have double the amount of vertices. What I'm saying is, there shouldn't be a need to _delete_ backfaces because you had to deliberately make them in the first place.
By the way, based on the MD3 specs, or rather, my exporter at least, double-sided faces aren't even possible; the data format's low precision will quantize the vertex coordinates and the backfaces will simply "dissolve"/disappear(the data will be lost on export).
Re: MODELDEF flag to forcefully ENABLE backface culling
Posted: Thu Oct 17, 2019 4:14 am
by Graf Zahl
That's also not what this is about - it's merely that the renderer does not cull faces that are seen from the backside.
Re: MODELDEF flag to forcefully ENABLE backface culling
Posted: Thu Oct 17, 2019 7:12 am
by Cherno
Nash wrote:Uhh, that doesn't make sense, a model should not HAVE backfaces unless you specifically went through the effort to make them in the model in the first place. Which means the model would have double the amount of vertices. What I'm saying is, there shouldn't be a need to _delete_ backfaces because you had to deliberately make them in the first place.
By the way, based on the MD3 specs, or rather, my exporter at least, double-sided faces aren't even possible; the data format's low precision will quantize the vertex coordinates and the backfaces will simply "dissolve"/disappear(the data will be lost on export).
Well, in general, most modern renderers cull backfaces for the simple reason that backfaces are not lighted properly due to their normals being adjusted to their corresponding "frontfaces". Also, how would you create a model like a flag or any other thin surface which has different uv coordinates for both sides? For GZDoom, you have to do a nasty workaround and subdivide the surface so you can let at least one vertex in the middle stick outwards a tiny bit while making the faces two-sided so therel'll be no zfighting.
Re: MODELDEF flag to forcefully ENABLE backface culling
Posted: Thu Oct 17, 2019 7:45 am
by Nash
I'm not really sure but I imagine for modern engines, objects like flags actually have volume so it's not a single plane with a backface, it's more of like a very flat rectangle with lots of subdivisions (triangle count isn't that big of a deal in modern engines, remember).
Or for single-sided faces, maybe some shader trick can be used so that backface UVs are flipped. Not sure.

At any rate, this discussion has nothing to do with OP's suggestion (which is trivial to add BTW; I'd know, because I was the one who submitted DONTCULLBACKFACES to the engine :3).
I'm currently really busy with another project however, and also due to being more enlightened with Graf Zahl's vision with regards towards user submission, I think whoever ends up adding this needs to think carefully how to add this in a way that doesn't end up making the engine sloppy code-wise...
I'm saying this because my submission forces something. The OP suggestion wants to force another thing that is in direct opposite of the previous one. There was a time where user submissions were becoming "an override to an override" (not naming names

) so yeah, anyway what I'm saying is, while this is probably a very small thing to add, and probably not even worth me writing several paragraphs like this, it still requires some careful assessment, something that I am definitely not in a convenient position to do currently.
Or maybe I'm just talking rubbish and someone could just go ahead and take all 2 minutes to implement this, who knows.

Re: MODELDEF flag to forcefully ENABLE backface culling
Posted: Thu Oct 17, 2019 8:25 am
by Cherno
Nash wrote:DONTCULLBACKFACES
Speaking of which, why does this flag exists if backfaces are not culled by default?

Re: MODELDEF flag to forcefully ENABLE backface culling
Posted: Thu Oct 17, 2019 8:35 am
by Nash
When actors are given transparency render styles, backfaces will always be culled. There were some cases where modders didn't want this behaviour.
Re: MODELDEF flag to forcefully ENABLE backface culling
Posted: Sat Oct 14, 2023 8:06 am
by Jupiter3D
Hello GZDoom community,
I'm encountering an issue with the absence of backface culling in the "normal" renderstyle. In my project, which is designed with a 1-bit style, achieving cel shading is crucial. Backface culling is essential for this style to create the desired visual effect.
As of now, GZDoom offers backface culling primarily in the "translucent" renderstyle. However, I'm looking to incorporate backface culling into the "normal" renderstyle, which would allow us to create cel shading with greater flexibility.
Is it possible to define a new renderstyle that removes backfaces like "translucent" but maintains the basic appearance of "normal"? This would be incredibly helpful for projects like mine, which aim to achieve unique visual styles.
I'm open to suggestions, guidance, or any information that can help me implement this feature in GZDoom.
Thank you for your time and assistance.
Best regards,
Brick Jove

Re: MODELDEF flag to forcefully ENABLE backface culling
Posted: Sat Oct 14, 2023 8:36 am
by Rachael