MODELDEF flag to forcefully ENABLE backface culling

Moderator: GZDoom Developers

Post Reply
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

MODELDEF flag to forcefully ENABLE backface culling

Post 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.
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: MODELDEF flag to forcefully ENABLE backface culling

Post 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 :oops:
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: MODELDEF flag to forcefully ENABLE backface culling

Post 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).
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: MODELDEF flag to forcefully ENABLE backface culling

Post 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.
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: MODELDEF flag to forcefully ENABLE backface culling

Post 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.
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: MODELDEF flag to forcefully ENABLE backface culling

Post 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. :shrug: 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 :P) 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. :P
User avatar
Cherno
Posts: 1309
Joined: Tue Dec 06, 2016 11:25 am

Re: MODELDEF flag to forcefully ENABLE backface culling

Post by Cherno »

Nash wrote:DONTCULLBACKFACES
Speaking of which, why does this flag exists if backfaces are not culled by default? :geek:
User avatar
Nash
 
 
Posts: 17434
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: MODELDEF flag to forcefully ENABLE backface culling

Post 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.
Jupiter3D

Re: MODELDEF flag to forcefully ENABLE backface culling

Post 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
User avatar
Rachael
Posts: 13531
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: MODELDEF flag to forcefully ENABLE backface culling

Post by Rachael »

Post Reply

Return to “Closed Feature Suggestions [GZDoom]”