Good way to convert Sprite2D to Sprite3D?

Godot Version

4.2.2

Question

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.

2024-05-04-182628_260x309_scrot

Then put all of the 2D background stuff under a CanvasLayer node and set it’s layer to -1.

1 Like

as you said
It works by using a canvas as the background.

However, the property of WorldEnvironment’s Background Mode Canvas is
Canvas Max Layer works even if it is not set to -1.

I don’t know what Canvas Max Layer means.

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.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.