Native Scene Warping
Moderator: GZDoom Developers
-
-
- 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
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 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
I can't begin to describe how terrible an explainer I am 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
-
- 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
Re: Native Scene Warping
I'm betting this would require major changes to the renderer.
-
- Lead GZDoom+Raze Developer
- Posts: 49190
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Native Scene Warping
You are betting correctly.
-
-
- 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
I knew it would be a tall order but I had to ask
Just curious- what kind of changes?
Just curious- what kind of changes?
-
-
- Posts: 3145
- Joined: Sat May 28, 2016 1:01 pm
Re: Native Scene Warping
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.
-
- Lead GZDoom+Raze Developer
- Posts: 49190
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Native Scene Warping
And let's not forget that on lower end hardware, even if this can be done, will cause some performance issues.
-
-
- Posts: 3145
- Joined: Sat May 28, 2016 1:01 pm
Re: Native Scene Warping
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..
-
-
- 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
Ah, G buffers again. It seems they are my enemy.
-
- Lead GZDoom+Raze Developer
- Posts: 49190
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: Native Scene Warping
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.
-
-
- Posts: 17468
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: Native Scene Warping
This would have allowed that displaced water effect Enjay loves so much from that one legacy map... ;)
-
-
- 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
Managed to dig up the thread you're referencing: Over hereNash wrote:This would have allowed that displaced water effect Enjay loves so much from that one legacy map...
That'd be super cool. And being done by a sample texture accessible to all modders, anyone could customise it to their own taste