RenderStyle Shadow quiestion

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
EmperorGrieferus
Posts: 127
Joined: Wed May 31, 2017 5:39 am

RenderStyle Shadow quiestion

Post by EmperorGrieferus »

This is rather self-explanatory. I want to manipulate the the level of translucency of Shadow renderstyle because it's too opaque for my taste.
User avatar
Player701
 
 
Posts: 1693
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RenderStyle Shadow quiestion

Post by Player701 »

Here is what the wiki says about the RenderStyle property (irrelevant parts omitted, emphasis mine):
ZDoom Wiki wrote:
  • 'Stencil' - actor is drawn as a single color. Use StencilColor property to set the color to use. Note that internally this sets the actor's renderstyle field to STYLE_Stencil, but if the Alpha value is set to something below 1.0, renderstyle will be set to STYLE_TranslucentStencil instead, and translucency will be enabled on the actor.
    ...
  • 'Shadow' - equivalent to black translucent stencil with an alpha of 0.3.
So, apparently, you should start with the following code:

Code: Select all

class TestShadow : Actor
{
    Default
    {
        RenderStyle "Stencil";
        StencilColor "Black";
        Alpha 0.3;
    }
    
    ...
}
and tweak the alpha value further depending on your tastes. However, the problem is that the above code is not exactly equivalent to just setting the renderstyle to shadow, as the actor will be drawn as a single color regardless of its alpha. I'm not sure that this is a bug, perhaps it's just the phrasing in the wiki that is somewhat confusing, which could also be due to English not being my first language.

And no, just setting the alpha when renderstyle is set to shadow won't work (unless it is set to 0, in which case the actor will not be drawn at all).
Professor Hastig
Posts: 256
Joined: Mon Jan 09, 2023 2:02 am
Graphics Processor: nVidia (Modern GZDoom)

Re: RenderStyle Shadow quiestion

Post by Professor Hastig »

From looking at the code it seems this was merely done as a distinct style to help keeping the CheckFuzz function clean, because it operates on a render style alone and has no access to other fields. So the only choice to keep this style of fuzz rendering working was to make a new style out of it.
EmperorGrieferus
Posts: 127
Joined: Wed May 31, 2017 5:39 am

Re: RenderStyle Shadow quiestion

Post by EmperorGrieferus »

Player701 wrote: Tue Nov 26, 2024 3:12 am Here is what the wiki says about the RenderStyle property (irrelevant parts omitted, emphasis mine):
ZDoom Wiki wrote:
  • 'Stencil' - actor is drawn as a single color. Use StencilColor property to set the color to use. Note that internally this sets the actor's renderstyle field to STYLE_Stencil, but if the Alpha value is set to something below 1.0, renderstyle will be set to STYLE_TranslucentStencil instead, and translucency will be enabled on the actor.
    ...
  • 'Shadow' - equivalent to black translucent stencil with an alpha of 0.3.
So, apparently, you should start with the following code:

Code: Select all

class TestShadow : Actor
{
    Default
    {
        RenderStyle "Stencil";
        StencilColor "Black";
        Alpha 0.3;
    }
    
    ...
}
and tweak the alpha value further depending on your tastes. However, the problem is that the above code is not exactly equivalent to just setting the renderstyle to shadow, as the actor will be drawn as a single color regardless of its alpha. I'm not sure that this is a bug, perhaps it's just the phrasing in the wiki that is somewhat confusing, which could also be due to English not being my first language.

And no, just setting the alpha when renderstyle is set to shadow won't work (unless it is set to 0, in which case the actor will not be drawn at all).
Would it work if partial invisibility is picked up?
User avatar
Player701
 
 
Posts: 1693
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RenderStyle Shadow quiestion

Post by Player701 »

EmperorGrieferus wrote: Tue Nov 26, 2024 6:22 pm Would it work if partial invisibility is picked up?
If you want to change the render style applied by partial invisibility, you will need to adjust its properties accordingly:

Code: Select all

class MyBlurSphere : BlurSphere replaces BlurSphere
{
    Default
    {
        Powerup.Mode "TranslucentStencil";
        Powerup.Strength 70;
    }
}
The alpha value in this case is calculated as 1 - Strength/100, so a Powerup.Strength of 70 is equivalent to an alpha of 0.3 (30% opaque).
EmperorGrieferus
Posts: 127
Joined: Wed May 31, 2017 5:39 am

Re: RenderStyle Shadow quiestion

Post by EmperorGrieferus »

I see. It's kinda annoying that partial invisibility for spectre and blur sphere are regulated separately.
User avatar
Player701
 
 
Posts: 1693
Joined: Wed May 13, 2009 3:15 am
Graphics Processor: nVidia with Vulkan support

Re: RenderStyle Shadow quiestion

Post by Player701 »

EmperorGrieferus wrote: Thu Nov 28, 2024 12:53 am partial invisibility for spectre and blur sphere
Actually, you can set it in the hardware renderer options (look for "fuzz style"), but I don't think it allows you to adjust the alpha...
EmperorGrieferus
Posts: 127
Joined: Wed May 31, 2017 5:39 am

Re: RenderStyle Shadow quiestion

Post by EmperorGrieferus »

Player701 wrote: Thu Nov 28, 2024 1:41 am
EmperorGrieferus wrote: Thu Nov 28, 2024 12:53 am partial invisibility for spectre and blur sphere
Actually, you can set it in the hardware renderer options (look for "fuzz style"), but I don't think it allows you to adjust the alpha...
I mean, if it allowed for alpha adjustment, I wouldn't create this topic in the first place.
I've just thought that "Shadow" fuzz style is shader-based.

Return to “Scripting”