godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.03k stars 21.18k forks source link

QuadMesh Shader technique in XR #89834

Open RiddleMajor opened 7 months ago

RiddleMajor commented 7 months ago

Tested versions

Godot 4.2.1, 4.2.2.rc2

System information

Using Quest 3 + Sidequest

Issue description

I am using a Quad Mesh placed in front of the camera with a shader material applied. It works correctly inside Godot preview editor and on a windows exe file, but when loading the game on quest, the mesh turns to black, obscuring my vision. I can tell it's the mesh causing the issue because 1. I can put my hands slightly through the mesh and see them 2. If I delete the mesh, it works, just without the shader.

Steps to reproduce

  1. Open XR
  2. Quad Mesh in front of camera with shader material applied
  3. Export to Quest
  4. Launch

Minimal reproduction project (MRP)

This would take a while, but the specific shader I'm using is in this zip file. psx_camera_shader.zip

AThousandShips commented 7 months ago

Can you please try with 4.2.1 or 4.2.2.rc2?

RiddleMajor commented 7 months ago

I am completely unable to export the project on 4.2.2.rc2, I get the error [Export]: Unable to copy and rename export file:

Configure project: WARNING: The option setting 'android.override Path Check=true' is experimental. The current default is 'false'. Task :copyAndRename DebugApk FAILED FAILURE: Build failed with an exception. *What went wrong: Execution failed for task ':copyAndRenameDebugApk'. Cannot access a file in the destination directory. Copying to a directory which contains unreadable content is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.2/userguide/incremental_build.html#disable-state-tracking in the Gradle documentation. > Failed to create MD5 hash for file content.

RiddleMajor commented 7 months ago

4.2.1 Will let me export, but shader still not working.

ferminLR commented 7 months ago

@RiddleMajor I have not been able to replicate your issue with a Quest 2 in 4.2.1, but I noticed something: your shader seems to work properly in the areas of the screen where there are objects, but the area of the viewport covered by the background appears black.

Maybe that gives you a hint to solve your issue. Could it be the draw distance is shorter on your Quest so there isn't geometry visible in the background?

RiddleMajor commented 7 months ago

I might be miss interpreting your comment, but my game is in an inclosed space, so there is no background being seen.

ferminLR commented 7 months ago

Ah gotcha, in that case yeah, the shader should work.

RiddleMajor commented 7 months ago

If it helps I'm using the start scene in this: https://github.com/GodotVR/godot-xr-template as a basis for my game.