Native Scene Warping

Moderator: GZDoom Developers

Post Reply
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Native Scene Warping

Post by Pixel Eater »

By this I mean Predator effects not only for Spectres, Invisiplayers and HUD weapons but also custom effects like steam leaks, heat/shock waves and warped glass or water surfaces.

I can't begin to describe how terrible an explainer I am :wink: So I'll portray my thoughts through song images using the Spectre as an example:

In this scene there are three Spectres and a Lost Soul named Goldilocks. However for this case to work the Spectres aren't being rendered to the main scene but a sample texture accessible to a post-processing shader.

Example sample texture:

It's important that all other items including level geometry be rendered black, both in front and behind of the Spectre (or other chosen sprites/textures). This basically gives the post-processing shader "hot spots" it can use to manipulate the main scene.

Photoshop re-enactment:


More advanced stuff can be done by colour encoding replacement sprites and tweaking the shader further.

This sprite sheet allows the shader to smoothly bend the sprites' edges to connect to the scene (Blue channel), give body contours to the warping (Green channel) and also center the effect on each sprite individually, giving the impression of multiple shader passes (Red channel). And with this method it opens up the possiblity for a translucent Lost Goldilocks to be able to affect the warping amount depending on it's own alpha value.

Some thoughts:
I propose that there be an option to still render the sprite into the main scene so that glass can have a texture and not just be warping air.
It would be good to have a couple destination sample textures so that modders can combine a few custom effects like warped glass and steam in one level (ooh steamed glass!).

I'm sure I've glossed over some things here but hopefully it sort of made sense :P
User avatar
Marisa the Magician
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: Native Scene Warping

Post by Marisa the Magician »

I'm betting this would require major changes to the renderer.
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: Native Scene Warping

Post by Graf Zahl »

You are betting correctly.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Native Scene Warping

Post by Pixel Eater »

I knew it would be a tall order but I had to ask ():)

Just curious- what kind of changes?
dpJudas
 
 
Posts: 3036
Joined: Sat May 28, 2016 1:01 pm

Re: Native Scene Warping

Post by dpJudas »

This requires creating custom gbuffers that the material shaders can output to. Currently there's one such in the system already: the normal vector gbuffer used by the SSAO pass.
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: Native Scene Warping

Post by Graf Zahl »

And let's not forget that on lower end hardware, even if this can be done, will cause some performance issues.
dpJudas
 
 
Posts: 3036
Joined: Sat May 28, 2016 1:01 pm

Re: Native Scene Warping

Post by dpJudas »

I'm actually not that worried about the performance implications as all games using deferred lighting, even really old games like Battlefield Bad Company 2, often have 3-4 gbuffers while we only have one or two. The additional shader variants to be managed by the shader manager on the other hand..
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Native Scene Warping

Post by Pixel Eater »

Ah, G buffers again. It seems they are my enemy.
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: Native Scene Warping

Post by Graf Zahl »

dpJudas wrote:I'm actually not that worried about the performance implications as all games using deferred lighting, even really old games like Battlefield Bad Company 2, often have 3-4 gbuffers while we only have one or two. The additional shader variants to be managed by the shader manager on the other hand..

You are clearly not thinking "old enough". ;)
When I last checked our users' hardware specs it's still roughly 40% on hardware that will start having problems - being more than 10 years old or real low end stuff that was never designed for gaming.
User avatar
Nash
 
 
Posts: 17433
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: Native Scene Warping

Post by Nash »

This would have allowed that displaced water effect Enjay loves so much from that one legacy map... ;)
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Native Scene Warping

Post by Pixel Eater »

Nash wrote:This would have allowed that displaced water effect Enjay loves so much from that one legacy map... ;)
Managed to dig up the thread you're referencing: Over here

That'd be super cool. And being done by a sample texture accessible to all modders, anyone could customise it to their own taste 8-)
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”