Open marcarneg opened 1 year ago
I don't think this method works. However, doing the rough equivalent in script works.
Not sure what exactly you mean by that- I was able to use this method on another project (where I encountered the bug initially). I successfully projected 2d controls on a 3d plane with exactly this method- it worked, I was able to change the texture via script (via setter on a @exported resource file-variable) until it suddenly broke.
I've encountered various iterations of this issue myself, though in a slightly different form. There's something screwy going on with the way viewport textures are linked in the editor. I think you can do it at runtime through code by calling get_texture on the subviewport, and I think you might be able to do that in the editor using a tool script, but this is definitely a recurring issue with viewport textures in the editor.
Similar to #68088, see https://github.com/godotengine/godot/issues/68088#issuecomment-1321067723.
Godot version
4 beta 17
System information
Windows 10, GTX 970
Issue description
When rendering a instanced 2D scene as a child of a SubViewport, there are conditions when either the SubViewport-texture stays pink (in my case: on a MeshInstance3D/PlaneMesh/LocalMaterial/Albedo), or won't update changes in the "LocalMaterial"s material (like metallic or roughness).
Trees:
Some bugs seem to be related to the "Viewport Texture must be set to use it."- error- but not always in consistent ways.
The bugs are occuring on the "Mobile" renderer, independently of the SubViewports "Clear Mode" and "Update Mode".
Steps to reproduce
`@tool extends Control
@export var thing_to_write : String = "Test" : set = set_thing_to_write func set_thing_to_write(str : String) -> void: thing_to_write = str $Panel/Label.text = thing_to_write `
Create scene 3D
add SubViewport
add 2d scene as instance (child of SubViewport)
add MeshInstance3D
new PlaneMesh
new Material
make Material local to scene
set Albedo to "NewViewportTexture"
set Viewport Path to "SubViewport"
Minimal reproduction project
RenderingportBug.zip