Godot: CanvasLayerTexture || CanvasItemMaskedTexture

Created on 27 Jun 2016  Â·  7Comments  Â·  Source: godotengine/godot

When working with 2D Shaders sometimes you need a sample ob objects in the screen, but not all of them, for example when working with reflections: not all object will be reflectible.
Right now the only way to do the work is using different viewports for every layer and use a ViewportSprite to render them on screen, this is an unconfortable workflow, since the user has to take into acount of game resolution, scrolling and everything itself, and also make sure your objects belongs to the same viewport.

Some solutions i have thought of are:

  • Use a CanvasLayer to get a rendered texture
  • Have a CanvasItemMask property on viewports, this would allow to have many viewports share the same world and render specific masks. Another option would be to use a CanvasLayer mask, but since CanvasLayers are indexed instead of masked, i can't think in a way to have a proper way to define the layers other than an IntArray with would not be so straightforward.
discussion enhancement core rendering

Most helpful comment

Bump, just making sure this won't be missed for 3.0/3.1 changes.

All 7 comments

We'll see how to make this more flexible after 2.1 with the GLES3 API

On Sun, Jun 26, 2016 at 8:12 PM, Mariano Javier Suligoy <
[email protected]> wrote:

When working with 2D Shaders sometimes you need a sample ob objects in the
screen, but not all of them, for example when working with reflections: not
all object will be reflectible.
Right now the only way to do the work is using different viewports for
every layer and use a ViewportSprite to render them on screen, this is an
unconfortable workflow, since the user has to take into acount of game
resolution, scrolling and everything itself, and also make sure your
objects belongs to the same viewport.

Some solutions i have thought of are:

  • Use a CanvasLayer to get a rendered texture
  • Have a CanvasItemMask property on viewports, this would allow to
    have many viewports share the same world and render specific masks. Another
    option would be to use a CanvasLayer mask, but since CanvasLayers are
    indexed instead of masked, i can't think in a way to have a proper way to
    define the layers other than an IntArray with would not be so
    straightforward.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/godotengine/godot/issues/5441, or mute the thread
https://github.com/notifications/unsubscribe/AF-Z2zH-ZD81COF8sTDDqzJhJ3-Gxr71ks5qPwd5gaJpZM4I-qsJ
.

i Think adding a RenderMask to CanvasItems and Viewports is enought to make it work

Bump, just making sure this won't be missed for 3.0/3.1 changes.

kicking to 3.1, together with all missing 2D stuff

bump

I think this feature or the one linked #31312 will become in demand once people start to use the recent feature added by reduz for pseudo 3D: 19a6a6286a73ed2e95a00f92994851c817d21401.

From the news article:

In the above screenshots, a few CanvasLayer nodes were created. Aftwerwards, the TileMap from the 2D Platformer demo was brute-duplicated and put in every single of them.
Finally, the "Follow Viewport" option was enabled together with a a scale value. This enables the pseudo 3D effect in each layer.

Emphasis on brute-duplicated, so this definitely should be implemented, perhaps with some Vulkan voodoo magic. 🎎

Added ##31877 to (hopefully) fix this issue

Was this page helpful?
0 / 5 - 0 ratings