Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewportTexture doesn't update (either pink or unresponsive to changes in it's material) #72616

Open
marcarneg opened this issue Feb 2, 2023 · 4 comments

Comments

@marcarneg
Copy link

marcarneg commented Feb 2, 2023

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).

grafik

Trees:
grafik
grafik

Some bugs seem to be related to the "Viewport Texture must be set to use it."- error- but not always in consistent ways.
grafik

The bugs are occuring on the "Mobile" renderer, independently of the SubViewports "Clear Mode" and "Update Mode".

Steps to reproduce

  1. Create scene 2D
  2. add label-control to it
  3. (optional: -> add naive @tool-script, which live-updates a rendered string on the label. The one in the example project is naively written, but the editor should handle it nevertheless.)

`@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
`

  1. Create scene 3D

  2. add SubViewport

  3. add 2d scene as instance (child of SubViewport)

  4. add MeshInstance3D

  5. new PlaneMesh

  6. new Material

  7. make Material local to scene

  8. set Albedo to "NewViewportTexture"

  9. set Viewport Path to "SubViewport"

Minimal reproduction project

RenderingportBug.zip

@Zireael07
Copy link
Contributor

I don't think this method works. However, doing the rough equivalent in script works.

@marcarneg
Copy link
Author

marcarneg commented Feb 2, 2023

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.

@vpellen
Copy link

vpellen commented Feb 2, 2023

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.

@Rindbee
Copy link
Contributor

Rindbee commented Feb 5, 2023

Similar to #68088, see #68088 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants