[No] Native Scene Warping

Moderator: GZDoom Developers

Native Scene Warping

Postby Pixel Eater » Wed Aug 22, 2018 7:17 pm

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
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: Native Scene Warping

Postby Marisa Kirisame » Thu Aug 23, 2018 4:21 am

I'm betting this would require major changes to the renderer.
User avatar
Marisa Kirisame
ZScript Magician
 
 
 
Joined: 08 Feb 2008
Location: Vigo, Galicia
Discord: Marisa Kirisame#4689
Twitch ID: magusmarisa
Github ID: OrdinaryMagician
Operating System: Other Linux 64-bit
Graphics Processor: nVidia with Vulkan support

Re: Native Scene Warping

Postby Graf Zahl » Thu Aug 23, 2018 5:47 am

You are betting correctly.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Native Scene Warping

Postby Pixel Eater » Thu Aug 23, 2018 7:01 am

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

Just curious- what kind of changes?
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: Native Scene Warping

Postby dpJudas » Thu Aug 23, 2018 7:13 am

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.
dpJudas
 
 
 
Joined: 28 May 2016

Re: Native Scene Warping

Postby Graf Zahl » Thu Aug 23, 2018 7:17 am

And let's not forget that on lower end hardware, even if this can be done, will cause some performance issues.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Native Scene Warping

Postby dpJudas » Thu Aug 23, 2018 7:29 am

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..
dpJudas
 
 
 
Joined: 28 May 2016

Re: Native Scene Warping

Postby Pixel Eater » Thu Aug 23, 2018 7:55 am

Ah, G buffers again. It seems they are my enemy.
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.

Re: Native Scene Warping

Postby Graf Zahl » Thu Aug 23, 2018 9:37 am

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

Re: Native Scene Warping

Postby Nash » Fri Aug 24, 2018 3:22 am

This would have allowed that displaced water effect Enjay loves so much from that one legacy map... ;)
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Native Scene Warping

Postby Pixel Eater » Fri Aug 24, 2018 9:10 pm

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-)
User avatar
Pixel Eater
I sense evil I fear it here today, Like a bad dream that never goes away -MBerry
 
 
 
Joined: 02 Aug 2017
Location: In between the Moon and you, between the buried and me.


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: MSN [Bot] and 1 guest