As an experiment, I’m trying to create a Viewport of a 3D scene, to be rendered on a ViewportTexture, which will be displayed in a 2D scene. (Specifically, it’ll be displayed as a scene tile that’s part of a TileSet.)

As of yet, it works fine. (In the graphic, that’s a 3D torus at the center left, in the red area, and it’s animating. Great so far.)

However, the background is imprinting over anything I have in a lower tile layer. This is not good, it limits me to a rectangular shape.

I attempt to set transparent_bg to true for the SubViewport, but after I do that, all 3D objects in the scene become transparent, not just the background. All that’s left is the little microscopic Godot icon at the top left, which is a Sprite2D; the MeshInstance and the Sprite3D disappear. However, I can see the green tile that’s placed beneath it.

Is this a bug in the program, or a bug in my understanding? It’s version 4.1.

UPDATE: It seems that if I’m working with an ordinary 2D scene, without a TileMap, simply selecting “Transparent BG” works fine. Interesting.

3 points

OK, I seem to have figured it out. It was me.

I created a second scene, which had a Node2D root. Its children were, in order, a TextureRect2D set to a noise texture (just to test this as I work), a SubViewport with with a MeshInstance3D torus and a Camera3D as children, and then finally a TextureRect2D with a ViewportTexture, set to that SubViewport. The camera was of course aligned to look straight down at the MeshInstance3D.

The viewport’s transparent_bg was toggled to on, and I can see the TextureRect2D right beneath it. Importing it as a scene tile worked fine, I can see the grassy green underneath the tile now.

It seems likely that I may have messed up my blending mode somewhere in the old one, which is fine; apparently I don’t really need to worry much about that.

permalink
report
reply
1 point

I’m new to Godot, so I can’t help you, but I just wanted to say how cool your approach sounds. I’m looking forward to knowing how to do that kind of thing, it sounds like you’re mixing 2D and 3D in a clever way!

permalink
report
reply
2 points

God, it works great. Read through the tutorial and it will give you an idea of just how powerful the tile editor is.

The only downside to scene types is that they are effectively instanced at every placement in the scene, so they’re more demanding; but most of the time that’s not that big a deal.

permalink
report
parent
reply
1 point

Cool that it works but why would one do such a thing.

I assume you could render 3D stuff over a 2D viewport? Not really understood your setup maybe this is exactly what you’re doing.

permalink
report
reply
3 points

I’m hacking together a demo game, and I can save enormous amounts of animation time if I can simply use an armature in the middle of my otherwise JRPG-like game. That way i don’t have to worry about individual frames, and can almost go directly from Krita/Blender to Godot.

Scene tiles allow me to do that.

Later on, I can try replacing these with animated tiles selectively, if overhead becomes an issue.

I’ll post a link when things start coming together!

permalink
report
parent
reply

Godot

!godot@programming.dev

Create post

Welcome to the programming.dev Godot community!

This is a place where you can discuss about anything relating to the Godot game engine. Feel free to ask questions, post tutorials, show off your godot game, etc.

Make sure to follow the Godot CoC while chatting

We have a matrix room that can be used for chatting with other members of the community here

Links

Other Communities

Rules

  • Posts need to be in english
  • Posts with explicit content must be tagged with nsfw
  • We do not condone harassment inside the community as well as trolling or equivalent behaviour
  • Do not post illegal materials or post things encouraging actions such as pirating games

We have a four strike system in this community where you get warned the first time you break a rule, then given a week ban, then given a year ban, then a permanent ban. Certain actions may bypass this and go straight to permanent ban if severe enough and done with malicious intent

Wormhole

!roguelikedev@programming.dev

Credits

  • The icon is a modified version of the official godot engine logo (changing the colors to a gradient and black background)
  • The banner is from Godot Design

Community stats

  • 1

    Monthly active users

  • 246

    Posts

  • 190

    Comments