[Closed] +SHADOW flag

Moderator: GZDoom Developers

+SHADOW flag

Postby Major Cooke » Wed Jun 10, 2020 7:49 am

Seeing this is becoming a thing, something I wanted to bring up is a way to enable shadows on things, as an opt-in measure rather than opt-out.

But perhaps an opt-out flag too for those who want to just give everything a shadow in the event it's easier might help.
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: +SHADOW flag

Postby Graf Zahl » Wed Jun 10, 2020 8:00 am

We already have a SHADOW flag, so it'd need another name. I'm not sure yet about "that thing", it looks like software rendering only right now so we first need some info what dpJudas is up to.
That said, I had plans to add Build-engine-style shadows anyway, they may be fake but may be a workable option.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: +SHADOW flag

Postby Nash » Wed Jun 10, 2020 8:29 am

Hi, I was the one who started this endeavour, sorry for not bringing it up here, this initially started as my desire to deprecate my own mod and have the engine do it.

With the mod sitting at almost 4k downloads (not counting old versions which also had 4 digit downloads) I think it's clear that players enjoy this small eye candy, and it inspired me to bring it into the engine, because let's be honest, doing it from the scripting side is just crappy. :-)

(Not to mention the actor spam from my mod version makes it unbearable for slaughtermaps)

So about that commit, yeah, dpJudas went ahead and ninja'd it before I got a chance to propose it formally here - not that I'm complaining, he did a much better job than I did in my proof-of-concept branch. :P

The plan was - and I'm currently committing a fix PR as we speak - is to make it default to render only for monsters and the player pawn - just like in Build. But allow modder overrides (CASTSPRITESHADOW and NOSPRITESHADOW - feel free to suggest better names)

And yes, these are the fake Build-style shadows - I have gotten a lot of remarks on social media about how they are not physically correct in terms of the projection angle and what-not - well, it never was meant to be. It's meant to be a carbon copy of Build's cheap way of doing "fake shadows", nothing more than that. Hope I get this clear. Basically, whatever Build engine is doing - and by extension - whatever SpriteShadow.pk3 is doing - it's the same thing here, just this time, the engine is doing it directly.

And yeah, hardware renderer support isn't added yet.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: +SHADOW flag

Postby dpJudas » Wed Jun 10, 2020 8:37 am

My commit was basically just the result of Nash asking me guidance on how to implement this feature. Then after talking with him and thinking about it a bit, I figured it would be easier to add my adjusted nash version as a baseline for discussion and to build the final implementation on.

I wanted to make sure the feature rendered the shadows before all normal sprites, because the worst visual artifact from this kind of effect is when the shadows overlap other actor sprites. (*) Incidentally, it also adds a natural place for flat sprites to be rendered, if anyone should ever add that to the software renderer.

*) Of course this doesn't fix the other artifacts, such as not projecting correctly from the player viewpoint or on walls. But I think even with its limitations it adds a lot of depth to a scene that is otherwise not there.
dpJudas
 
 
 
Joined: 28 May 2016

Re: +SHADOW flag

Postby Redneckerz » Wed Jun 10, 2020 8:42 am

Sort of related (But far less advanced): TDRR's GShadow Resurrected.

Both of these projects make it quite clear that these shadows add a lot to the visual flair. Except TDRR's version does not absolutely require GZ and is more or less an advanced hack, whereas Nash's implemention is a lot more accurate.

The shadowpack idea presented by TDRR is an interesting one though, but i am not sure how useful it could be.

Btw Nash - The whole spiel that you are getting about physically correct shadows - Honestly, what are the critics saying? Its a feature for GZDoom, not Unreal Engine 4.

But any form of shadows in-engine rather than in-scripting is a good one. Even if nothing pans out, it could be very useful to have around, whether as a patch or a custom build.
User avatar
Redneckerz
To it's ports i may have seen
Spotlight Team
 
Joined: 25 Nov 2019
Discord: Redneckerz#8399
Operating System: Windows Vista/7/2008 64-bit
Graphics Processor: nVidia (Legacy GZDoom)

Re: +SHADOW flag

Postby Graf Zahl » Wed Jun 10, 2020 8:44 am

Nash wrote: Hope I get this clear. Basically, whatever Build engine is doing - and by extension - whatever SpriteShadow.pk3 is doing - it's the same thing here, just this time, the engine is doing it directly.


I haven't checked this yet, but all Build does is, take the sprite, reduce its height to 1/4th, I believe, set y to its floor height, and render it with a black stencil as a normal sprite. It's so ridiculously simple and all these years I was asking myself how it was pulled off.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: +SHADOW flag

Postby Nash » Wed Jun 10, 2020 8:54 am

Graf Zahl wrote:I haven't checked this yet, but all Build does is, take the sprite, reduce its height to 1/4th, I believe, set y to its floor height, and render it with a black stencil as a normal sprite. It's so ridiculously simple and all these years I was asking myself how it was pulled off.


It's kind of inconsistent across the Build games - the shadows in Duke3D appear to be squashed much shorter than Blood and Shadow Warrior, based on observation.

I settled with a Y scale of 0.1 that makes the shadows still visible but not so forced and in-your-face.

Yeah, I took care of the floor Z positioning and the black stencil render style already. Just like the mod version. :)

Just sent a PR for the modder-exposed flag overrides.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: +SHADOW flag

Postby Graf Zahl » Wed Jun 10, 2020 10:02 am

The shadows are created by the game code in the sprite preparation pass, not by the engine, so they are different between games. In Exhumed they are just oval for anything.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: +SHADOW flag

Postby Major Cooke » Wed Jun 10, 2020 12:54 pm

dpJudas: Hearing of that idea makes me think of floor/ceiling decals that can appropriately clip over geometry (like explosions in a corner applying to both walls and floor). If such a system were to ever come to light... I can't help but wonder if it could be used for GL light masking too?
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: +SHADOW flag

Postby Graf Zahl » Wed Jun 10, 2020 1:08 pm

For Raze I'll eventually need proper floor decal code, so once this works it will of course be backported to GZDoom as well. No timetable on that, though.
But how should that work for lights? Lights aren't textures they are just some illumination added to rendered pixels.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: +SHADOW flag

Postby Major Cooke » Wed Jun 10, 2020 1:53 pm

Ah damn. I forgot. The engine doesn't apply the texture anymore, so there's no way to apply a stencil'd mask over it?
User avatar
Major Cooke
QZDoom Maintenance Team
 
Joined: 28 Jan 2007

Re: +SHADOW flag

Postby Graf Zahl » Wed Jun 10, 2020 2:18 pm

No.
Unless a cubemap light stencil was implemented but that's a tricky and costly thing because it requires a texture access for each pixel hit by a stenciled light.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest