Godot Version
Godot 4.4.1
Question
Hello everyone, I use a Quest 3 and try to create a fluid transition between my 3D scene and the Quest camera (like meta’s Guardian).
For the moment I’m using Godot’s XR settings all the time to keep the camera rendering and when I want to make my transition, I make all the objects in my scene progressively transparent (which displays the camera rendering hidden behind).
However, this solution doesn’t satisfy me at all: there’s a difference in rendering between an opaque and a slightly transparent object, and I’m also having problems with lighting.
Here without the transition
And here with the transition on
In both pics, the transparency is set to 1 so it’s supposed to be the same
And finally what it look like during the transition.
#In the ready, I fetch all the material I need for the transition
func find_mesh_mat(root,first = true):
if(first):
_map_material.append(_mat_transp)
#print("Entre dans ", root)
for child in root.get_children():
# print("Parcours ", child)
if child is MeshInstance3D:
if(child.get_active_material(0) != null):
#child.set_surface_override_material(0,StandardMaterial3D)
child.get_active_material(0).transparency = 1
child.get_active_material(0).blend_mode = BaseMaterial3D.BLEND_MODE_ADD
child.get_active_material(0).depth_draw_mode = BaseMaterial3D.DEPTH_DRAW_ALWAYS
child.get_active_material(0).shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
_map_material.append(child.get_active_material(0))
else:
child.set_surface_override_material(0,_mat_transp)
# print("Applique a", child)
find_mesh_mat(child,false)
#In the process
func apply_mat_transp(alpha : float):
for mat in _map_material:
mat.albedo_color.a = alpha
func process():
var dist_to_wall : float = _camera.get_distance_to_wall()
#print(dist_to_wall)
if(dist_to_wall < 0.5):
apply_mat_transp(dist_to_wall*2)
if(dist_to_wall < 0):
apply_mat_transp(0)
else:
apply_mat_transp(1)
Any help is welcome to find a way for displaying the camera rendering progressively on top of the scene rendering (and keeping certain objects, such as the ray, visible). I personally think that using the material and playing with the transparency is a bad idea but others methods doesn’t seems to work at all.