Super cool video and great use of viewports! The last example is my favorite, it's a simple trick but a huge improvements. I also like to use viewports to display anything inside a particles2D. It's especially useful if you want to display text inside particles!
As a web developer for a living I especially like the second example of easily rearranging complex UI elements by simply repositioning the viewport in the node tree, because that's something that's somwhow cumbersome in HMTL (at least it is for me as a backend/server-side programmer of web applications 😉). I personally only used viewports once to try out rendering 3D meshes in a 2D scene (which was surprisingly easy and workd out very well). As of watching this video (especially the first example) I could even imagine creating some art-ish stuff by recursively rendering viewport textures into other viewports that are themselves only used as textures for yet another viewport container, maybe it's even possible to create a cyclic dependencies somehow. Could be interesting to find out. (I'd do myself, but I have too many other things on my own desk unfortunately.) However, great video. Instantly subscribed. 👍
@@dueddel Thanks! I think there are checks in the engine code preventing such cyclic dependencies. I vaguely remember removing those checks for a pull request, only to obtain crazy visual results (tearing everywhere) ^^
One other great thing about viewports is that you can toggle input events on or off. E.g. when you have a fullscreen gui overlapping other things that receive inputs. Great video and examples!
Your explanations are concise, logical, sequential and have, overall, a harmonious quality which renders a heavy impression upon mind and memory. Thankyou
so whats the actual Performance cost of viewports ? if been thinking about alot of uses for them but havent implemented any. how many can you get away with since they basically all render at the same time ?
hi, do anyone get this error -render scene: can't use canvas background mode in a render target configured without sampling my main scene have `WorldEnvironment` mode canvas, = for glowing effect. my viewport, i just put usage = 2d without sampling and transparentBG = true, if i take other than 2d without sampling i will get black bg. how can i fix this?
For the 3rd use case, you use a Sprite2D to represent the foliage, by using the texture generated by a Viewport and an AnimatedSprite2D. But what about if instead of a simple/static animated entity, it were a more dynamic/complex one? Like Actors that can have multiple animations and so. There exists any cool tricks to reduce the overhead when having many actors on screen, with different animations per action? (walk, attack, idle, etc)
The trick here is that we display several times exactly the same sprite, which is the same for all the flowers at, for example, frame 256. If the animation of the flowers were not synchronised, we could not use this trick. So unless your actors are doing exactly the same thing at the same frame, I don't think that this will work in you case. The only optimisation that I can think of in that case is batch rendering, which Godot can do automatically in some cases. I suggest you look into that! :)
Thank you for these examples Excuse me but I would like to use a lot of subviewport at the same time in a 3d scene to take advantage of 2d nodes (anomationplayer, etc) to make a 3d tilemap. Could this cause a slowdown problem if I use a lot of them?
Not to put you down, but the voice recording sounds very "bassy", its hard to hear even at higher volume. Otherwise the content is very good and keep it up
I do not understand Viewport in Godot 4.* Aspecialy because of this new SubViewportContainer, and Subviewport... no Tutorial about Viewport of Godot 3 dosnt work anymore. I got it to work to create a viewport with multiple moving sprites as child, but when i tried to use the vieport as texture the FPS of the texture (only of texture not of the rest of the game) was so bad oO to be clear, there where moving fireflys in this viewport and i wanted to use them in one texture as waterreflection but the viewport texture looked so laggy... like 5FPS movement. And there is way to much settings, for example you kann disable 3d and 2d and its possible to do both but nothing happen there.. this node is so not self explaining and the documentation dosnt help me.