[No] Let custom shaders apply top/bottom glows to things

Moderator: GZDoom Developers

Let custom shaders apply top/bottom glows to things

Postby Diode » Fri Jul 27, 2018 9:53 pm

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.
Diode
 
Joined: 29 Feb 2016

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

Postby Graf Zahl » Sat Jul 28, 2018 1:30 am

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.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

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

Postby Diode » Sat Jul 28, 2018 8:49 am

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?
Diode
 
Joined: 29 Feb 2016

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

Postby Graf Zahl » Sat Jul 28, 2018 9:01 am

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
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

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

Postby Rachael » Sat Jul 28, 2018 9:43 am

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.
User avatar
Rachael
Webmaster
 
Joined: 13 Jan 2004
Discord: Rachael#3767
Twitch ID: madamerachelle
Github ID: madame-rachelle

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

Postby Diode » Sat Jul 28, 2018 10:11 am

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?
Diode
 
Joined: 29 Feb 2016


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: Yandex [Bot] and 3 guests