#prerendered backgrounds and depth buffer question

25 messages · Page 1 of 1 (latest)

half shale
#

hi i recently saw this video and i wonder if its possible to do in godot.
https://youtu.be/OdlQMwFJuwA?t=811

so i have in godot my prerendered bg and depth image for it. how now i can i draw this background parts above (in front of) character if the character is behind some object on this image.

People have asked in my past video how this stuff works. Here's how you do it in Unreal. The goal of this video was to explain the main material and the core of the system works.

I will make a separate video how to export the meshes and cameras and sync them up and explain a bit on the blueprints I created.

Project repository (sorry for the de...

▶ Play video
versed basin
versed basin
half shale
versed basin
#

That shows a technique using VisualShaders.

half shale
#

Okay thank you brother. Its called alpha masking. I could google it if i knew it ealier

versed basin
#

No problem. 😉
Good luck with your project

half shale
#

this is my example prerendered background, i setup cameras to match perspective and when i move character over this it looks very good, like its 3d enviorment

#

but when i go behind the car then you know, it does not look like character is behind it

#

i learned to do it i need depth buffer image so i made one

#

it looks like this:

#

its basically a heightmap but can be used to determine depth in this case

#

soooo, i have no idea how to make a shader that will do the thing, it must know position of character in 3d space and somehow figure out if character is behind or in front od car

#

so i guess its not so simple

half shale
#

btw this is how it looks like if i use second image as heighmap and put first image as texture

#

well discord messed quality but u can see its 3d

versed basin
#

I have never done what you are asking and don't have shader experience myself. However, have a look at this in case it helps you to achieve what you want:
https://youtu.be/x1dIJdz8Uj8

A video in which I talk about what a depth buffer is and how to use it in a some shaders in the Godot game engine.

I'm using Godot version 3.5, and OpenGL ES 3.0 for this tutorial.

Godot Reference Documentation: https://docs.godotengine.org/en/stable/tutorials/shaders/advanced_postprocessing.html

Find the Sci-Fi pulse shader on Godot Shaders:...

▶ Play video
#

It shows how you can get the depth-buffer of your game at runtime. With that and the depth-buffer of your scenario it seems possible to hide pixels from your character with a darkest color than the scenario depth texture (further away) but maybe I'm wrong and it doesn't work like that

#

On top of that, I can't imagine how you can handle believable collisions using this approach though.