Let custom shaders apply top/bottom glows to things

Moderator: GZDoom Developers

Post Reply
Diode
Posts: 53
Joined: Mon Feb 29, 2016 2:34 pm

Let custom shaders apply top/bottom glows to things

Post by Diode »

I'm not sure if this is a bug or a feature - I guess it might just be a question of whether it's intended behavior or not.

I was trying to apply them to actors, but when used on an actor uGlowTopColor, uGlowBottomColor and glowdist all return zero. Glows are a sector property, so it seems that logical that shaders for actors, floors and ceilings should be able to use them. Right now, they only seem to work on linedefs.
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: Let custom shaders apply top/bottom glows to things

Post by Graf Zahl »

You are not supposed to used these AT ALL in a custom shader! They are part of how the lighting works and will be applied outside your code if they are set. Equally importantly, they are an implementation detail that may eventually change, e.g. if this data is made a static buffer.

Let me make this abundantly clear: Any custom shader that uses internal variables of the renderer is playing with fire and not guaranteed to work if some changes need to be made. Even for the upcoming Vulkan rewrite I may have to do some alterations here due to lack of directly accessible uniform variable space.
Diode
Posts: 53
Joined: Mon Feb 29, 2016 2:34 pm

Re: Let custom shaders apply top/bottom glows to things

Post by Diode »

Graf Zahl wrote:They are part of how the lighting works and will be applied outside your code if they are set.
Well, that's the the thing: Outside my code, they *aren't* set, because the default behavior is for glows to only effect wall colors, and that's all you can do with the them in shaders too, despite them being a sector property. By default, actors aren't lit by glows at all.

So you're basically telling me that the current system only allows me to overwrite behavior you don't want me to overwrite, and doesn't allow me to add new behavior, despite new behavior presumably being the whole purpose of custom shaders in the first place?
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: Let custom shaders apply top/bottom glows to things

Post by Graf Zahl »

Diode wrote: So you're basically telling me that the current system only allows me to overwrite behavior you don't want me to overwrite, and doesn't allow me to add new behavior, despite new behavior presumably being the whole purpose of custom shaders in the first place?

What I am telling you is that you cannot muck around with variables that are used by engine-internal code to render existing effects. If you start using those it'd mean that I could no longer change the implementation if some new hardware design needs it. The glowing is rendered by the main shader, not the user portions. There also isn't any glow on sprites and flats, so these uniforms must be off so that no glow gets rendered.

In short: If you use any of the existing u... variables anywhere in your own code, prepare for trouble!
User avatar
Rachael
Posts: 13530
Joined: Tue Jan 13, 2004 1:31 pm
Preferred Pronouns: She/Her
Contact:

Re: Let custom shaders apply top/bottom glows to things

Post by Rachael »

I'll help you translate what Graf is saying in layman's terms so it's perfectly clear:

If you do anything outside the intended implementation with the shaders, your mod WILL NOT WORK in future versions of GZDoom! And mucking around with GZDoom's internals counts as part of that.

The reason is because various implementation details can change, even with shaders, that your mod will depend on, essentially locking it to that specific version of GZDoom. This breaks the forward-compatibility goals of the engine, itself, something that thus far it has been VERY good at keeping, despite minor missteps along the way.

Graf doesn't want that - he doesn't want your mod to break just because he needs to change something with the engine later. That's why he's telling you in no uncertain terms "don't do that!". He doesn't want his hands tied because of one person's mod - and trust and believe when it comes time for Vulkan implementation, he's going to say screw it and break your mod. Not maliciously, but out of pure necessity, because it's really the only way to be reasonable about this.

I hope this clears up any confusion.
Diode
Posts: 53
Joined: Mon Feb 29, 2016 2:34 pm

Re: Let custom shaders apply top/bottom glows to things

Post by Diode »

Well, that's a little saddening. I had really hoped to be able to apply glows to actors.

Is this a 'no, never' thing, or a 'definitely not before vulkan is done' thing?

Or is there any way I could reference a custom sector property in a shader?
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”