[3.7.0] Models with Stencil renderstyle have no textures
Moderator: GZDoom Developers
Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
[3.7.0] Models with Stencil renderstyle have no textures
We have updated The Forestale from GZDoom 3.4.1 to GZDoom 3.7.2 and some models render without textures:
[imgur]https://imgur.com/a/74E5L7j[/imgur] (the imgur tag doesn't work for some reason)
They only render without textures if they are opaque. Turns out, it is caused by the Stencil renderstyle. We use the it to give models a colored tint. The bug got introduced somewhere between GZDoom 3.6.0 and 3.7.0.
[imgur]https://imgur.com/a/74E5L7j[/imgur] (the imgur tag doesn't work for some reason)
They only render without textures if they are opaque. Turns out, it is caused by the Stencil renderstyle. We use the it to give models a colored tint. The bug got introduced somewhere between GZDoom 3.6.0 and 3.7.0.
- Attachments
-
- ModelStencilTest.pk3
- Test case
- (120.01 KiB) Downloaded 62 times
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [3.7.0] Models with Stencil renderstyle have no textures
The Stencil render style is SUPPOSED to render without texture. If you used it to tint something textured, that was actually incorrect use of it.
Re: [3.7.0] Models with Stencil renderstyle have no textures
I think you need to use AddStencil for the way older version of GZDoom used to render the Stencil renderstyle.
Last edited by Cherno on Sat Feb 16, 2019 5:58 am, edited 1 time in total.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [3.7.0] Models with Stencil renderstyle have no textures
Render style stencil is supposed to render the non-transparent parts of a texture in a solid color.
There has been a bug that this wasn't true in all situations, that got fixed a while back.
There has been a bug that this wasn't true in all situations, that got fixed a while back.
Re: [3.7.0] Models with Stencil renderstyle have no textures
AddStencil still renders without a texture, just makes the model have additive translucency. What render style should be used to colorize models without losing the texture?
Re: [3.7.0] Models with Stencil renderstyle have no textures
There is none currently supported that will do that. A new renderstyle would have to be created, and that is currently quite an involved process considering how deep the renderstyle code goes into the engine, currently.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [3.7.0] Models with Stencil renderstyle have no textures
The big problem with a new render style is that this wouldn't just need one render style, but several, considering that it can be combined with various translucency modes.
The legacy render style enum is really showing its limits here, to do this without causing too many problems, the flag based render style needs to be exposed to editing first, but that's something I always kept off because there's too much of a chance to create a bad style that doesn't work.
The legacy render style enum is really showing its limits here, to do this without causing too many problems, the flag based render style needs to be exposed to editing first, but that's something I always kept off because there's too much of a chance to create a bad style that doesn't work.
Re: [3.7.0] Models with Stencil renderstyle have no textures
If so, could you please point out which commit implements the change? Searching for "Stencil" or "RenderStyle" yields no obvious commit like "Fixed Stencil renderstyle in OpenGL renderer". Neither is there anything in the changelog.
Re: [3.7.0] Models with Stencil renderstyle have no textures
IIRC, 3.6.0 should still have the old tint-style stencil model rendering.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [3.7.0] Models with Stencil renderstyle have no textures
I can't find it either. I think this happened as part of some internal refactoring in the hardware renderer.
Re: [3.7.0] Models with Stencil renderstyle have no textures
The change was introduced by commit 4604c9379c575d6b1a9eb94b9932af55e11a044a, which is a one line change. This line got another change in some commit after that. I reverted the following line (hw_sprites.cpp:1035 in GZDoom 3.7.2):
to
and model recoloring is back and there seem to be no other bugs in the game.
Code: Select all
if ((gltexture && gltexture->tex->GetTranslucency()) || (RenderStyle.Flags & STYLEF_RedIsAlpha) || (modelframe && thing->RenderStyle != DefaultRenderStyle()))
Code: Select all
if ((gltexture && gltexture->tex->GetTranslucency()) || (RenderStyle.Flags & STYLEF_RedIsAlpha))
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49067
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: [3.7.0] Models with Stencil renderstyle have no textures
You saw no other bugs because you didn't run into what prompted the change. It'd just bring back a bug with translucent models that weren't rendered completely.
Re: [3.7.0] Models with Stencil renderstyle have no textures
That commit was done deliberately to fix a long-standing issue where models would not render texture alpha correctly.Korshun wrote:The change was introduced by commit 4604c9379c575d6b1a9eb94b9932af55e11a044a
Before/After comparison:
In the "before" shot, the translucent parts of the texture simply get quantized to either a transparent/opaque state. In the "after" shot you can clearly see the smooth translucency from the texture's alpha being applied.