Do not assume shaders without a stage is fog#1806
Conversation
- Do not assume shaders without a stage is fog. - Do not ignore shaders without a stage, it's a valid use case for a transparent surface. - Mark shaders without a stage as BLEND0.
|
@slipher do you know if that can be rewritten without a stage? What that textures/common/portal
{
qer_editorImage textures/common_src/portal_p
surfaceparm nolightmap
portal
{
map textures/shared_colors_src/transparent_d
blendfunc GL_ONE GL_ONE_MINUS_SRC_ALPHA
depthWrite
}
} |
That stage does do something: the Similarly you could make an opaque black stage without actually needing a black image for example: or alternatively |
OK, that's good enough. Thanks. |
|
Can it be done with |
Well, it seems to behave the same. |
|
If I'm not mistaken, the first commit would change the sort type from SS_FOG to SS_OPAQUE for an empty shader. SS_OPAQUE seems more wrong if anything, so I don't think this commit brings any benefit. The second commit LGTM. |
|
With this branch the transparent shader is listed this way: Yes it's listed as What would be the drawback of being opaque while not having any stage? Is there some code that would not render behind or so? |
|
So what I did is that such shader are now Before ( After (this branch): |
src/engine/renderer/tr_shader.cpp
Outdated
| { | ||
| // fogonly shaders don't have any stage passes | ||
| if ( numStages == 0 && !shader.isSky ) | ||
| if ( shader.isFog && !shader.isSky ) |
There was a problem hiding this comment.
I think you could just remove this whole if statement and remove isFog. In the place where isFog is set, it already puts SS_FOG.
There was a problem hiding this comment.
Also fog shaders are supposed to have surfaceparm fog, so shader.contentFlags & CONTENTS_FOG.
|
Actually, there is a shader keyword that does what that PR first did before I set It made sure the shader was not disabled if there was no stage, and then the sorting was keeping the Is is used in no shader of no game I have grepped, it only exists in XreaL renderers like Dæmon and etlegacy renderer2. |
|
The I don't know what it is for. But we don't need that to keep the shader when there is no stage, and we better set |
16cef91 to
c3e37e0
Compare
|
LGTM |
It makes possible to do this: