添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

v4.1.2.stable.official [399c9dc39]

Question

I am trying to follow this tutorial to implement water shader ripple effects: https://www.youtube.com/watch?v=VSwVwIYEypY

The tutorial is for Godot 3D so I am trying to translate it to 2D, and I run into an issue when he starts using cull masks. In 3D cull masks are handled by cameras, but in 2D it seems they have to be set up using viewports instead. But the root viewport is not accessible in the editor as far as I can tell.

So for example, if I want to have a sprite in my 2D scene which is visible to a viewport but invisible to the main camera, how would I accomplish that?

You can do it via script
if you hover over the cull layer you want to exclude it’ll tell you the bit value that you have to remove, so for example to have the main viewport exclude layer 3
put this in in a script somewhere

func _ready():
get_tree().root.get_viewport().canvas_cull_mask = get_tree().root.get_viewport().canvas_cull_mask -4