I plan to create a game using a 3D model on a 2D background.
I think there are two ways to mix these two.
Basically, it is made with Sprite2D, but it appears to be a way to output the 3D model in 2D using SubViewport.
(However, creating and processing dozens of SubViewports does not seem ideal.)
The other is to make it entirely in 3D and use Sprite3D to create the background.
In short, I plan to use Sprite3D as a 2D background through orthogonal projection.
(Question about orthogonal projection of camera in this link)
I can use Sprite3D as a 2D coordinate system by using orthogonal projection as shown in the link above.
However, since the background is 2D, I want to write it in Sprite2D using the 2D function of the Godot 4 editor.
I want to create a background using Sprite2D with Godot 4 editor and convert it to Sprite3D⌠Is there any source code I can refer to?
I think it would be a good idea to specify the Z value of Sprite3D as âSprite2Dâs Order Z Indexâ.
If there is a better way to do what Iâm trying to do, please let me know.
Not totally sure what you are imagining, but I would stick to 3D rendering with a 2D background.
Set the 3D world environment background mode to âCanvasâ. I would also set the canvas max layer to -1 so it doesnât steal any default placed 2D objects.
Then put all of the 2D background stuff under a CanvasLayer node and set itâs layer to -1.
Yes it works if not set to -1. It will use every layer at or below Canvas Max Layer as the background. The default layer is 0 so everything in 2D will be used as the background. If you have user interface that you do not want in the background, itâs layer value must be more than the Canvas Max Layer.