godotengine / godot

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

2D in 3D on Oculus Quest Not Working #42209

Closed SoapSpangledGames closed 4 years ago

SoapSpangledGames commented 4 years ago

I am developing a game in parallel for the PC (Kubuntu 18.04, if that matters) and the Oculus Quest. Part of the game shows 2D AnimatedSprite's for the menus. It is working correctly on my PC, but the 2D menus don't show up on the quest. I've made a couple videos on YouTube showing this.

This is everything working correctly on the PC: https://www.youtube.com/watch?v=7nnvixH1Wew

This is the menus not showing up at all on the Quest: https://www.youtube.com/watch?v=PhYInEulCV0

The node layout within the 3D viewport is a Node2D with the following structure:

Node2D
    ViewportContainer
        Viewport set to 2D
            Node2D
            Node2D
            Node2D

Every line should be indented to show that it is a child of the line above, except for the last three Node2D's, which are all children of the Viewport set to 2D. I'm not sure how to indicate leading spaces in markdown.

Is this a known issue with the Quest?

Calinou commented 4 years ago

I'm not sure how to indicate leading spaces in markdown.

Use a multi-line code block (surround text by ```) :slightly_smiling_face: I edited your post accordingly.

SoapSpangledGames commented 4 years ago

I'm not sure how to indicate leading spaces in markdown.

Use a multi-line code block (surround text by ```) slightly_smiling_face I edited your post accordingly.

Thanks!

lawnjelly commented 4 years ago

I know pretty much zero about the Quest, but to attempt to pin it down, are you using GLES2, GLES3 or vulkan, and also is this with or without batching?

SoapSpangledGames commented 4 years ago

It happens with both GLES2 and GLES3, though I haven't thought of trying Vulcan since I didn't think it was Quest-ready. I'm using 3.2.stable.official, which doesn't appear to have any batching options.

Zireael07 commented 4 years ago

cc'ing @BastiaanOlij who did the VR support IIRC

BastiaanOlij commented 4 years ago

You can't render 2D objects in VR, now I am surprised there is no output at all, someone else pointed this out to me on Discord as well, but even if it had drawn your 2D objects there is no way for the system to know how to render 2D objects properly as you need a distance to make it look right in a stereoscopic environment so there isn't really any point in fixing it.

If you want a 2D UI inside of your 3D environment you will need to render this to a viewport and then show the viewport texture on a 3D object like a quadmesh or planemesh. I actually have a setup in my xr-tools that you can use as is for this: https://github.com/GodotVR/godot-xr-tools/blob/master/addons/godot-xr-tools/objects/Viewport_2D_in_3D.tscn Note there there is an accompanying pointer feature in xr-tools you can add to a controller to interact with the 2D scene: https://github.com/GodotVR/godot-xr-tools/blob/master/addons/godot-xr-tools/functions/Function_pointer.tscn

In your UI you are spinning 3D text around. That's going to totally break the illusion in VR as you're brain will immediately recognize the lack of depth. You might want to consider actually having that text rendered as a 3D object instead of doing this in 2D.

SoapSpangledGames commented 4 years ago

Thank you very much for your suggestions. I'm looking forward to trying them.

SoapSpangledGames commented 4 years ago

I'm closing this, as the general question was answered. Thanks.