-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
False error "Viewport Texture must be set to use it." #66247
Comments
I guess the |
I keep getting this too (in GDscript), but otherwise my SubViewport works fine. |
I got this same situation/error. The viewport texture does not work when exporting (it does work when executing from the editor) |
I found the solution here: #55471 I set the |
In RC2 this error seems to be happening even with the update mode set to always... or any other mode, actually |
This ... swaps error for a different one and reduces the verbosity of them slightly. godotengine/godot#60350 godotengine/godot#66247 etc
Yes, I'm having the same issue, no matter what configuration the SubViewport uses, it will act as if there's no Viewport set on debug or on the editor once the scene is reloaded. Spitting out the same "Viewport Texture must be set to use it." When already is set. |
|
Godot version4.0.1 RC2 mono System informationWindows 10 Issue descriptionScenes with viewport as a 3D texture shows errors on game startup. Mesh materials from viewport (2D) textures do not work and show up purple ingame, even though they show up in the editor. E 0:00:00:0832 get_height: Viewport Texture must be set to use it. These appear as errors, even though they work except for the mesh material option. Steps to reproduce
Minimal reproduction project |
If the node tree doesn't nest multiple Like in the MRP provided by @baschermann, enable Similar issues also include #68088, #72616, #74589. If nested |
As a workaround, set the viewport texture in the parent node of both the SubViewport and the MeshInstance3D in code: Example in C#public override void _Ready()
{
RenderingServer.FramePostDraw += OnFramePostDraw;
}
private void OnFramePostDraw()
{
SubViewport subViewport = GetNode<SubViewport>("SubViewport");
var viewportTexture = subViewport.GetTexture();
MeshInstance3D meshInstance = GetNode<MeshInstance3D>("Mesh");
StandardMaterial3D mat = new()
{
AlbedoTexture = viewportTexture
};
meshInstance.SetSurfaceOverrideMaterial(0, mat);
RenderingServer.FramePostDraw -= OnFramePostDraw;
} |
What seems to be happening is that this depends on the order of initialization. For me, the mesh was initialized first and it holds a reference to the uninitialized viewport. That issue resolves itself after a frame or so. |
This has little to do with the order of instantiation. It mainly depends on whether Currently, even if a resource has |
I followed along with the 3D https://docs.godotengine.org/en/stable/tutorials/animation/playing_videos.html#displaying-a-video-on-a-3d-surface on 4.0.3.rc1 ... my video plays well but errors when running from editor gives:
|
Fixed by #75751? |
That's likely. Please test in 4.1 dev 2 or the upcoming 4.0.3 RC 2. |
4.1 dev 2 still has the issue with |
Resources are instantiated before nodes during scene instantiation. At this point Lines 107 to 111 in 8cfa19a
These error messages are printed when setting the material's texture. godot/scene/resources/material.cpp Lines 1895 to 1896 in 8cfa19a
|
Can confirm that this is still an issue in 4.1 dev 2. |
Getting the same error on 4.1 stable |
I hasty un-merged this in our fork. https://github.com/V-Sekai/godot/tree/viewport-path-update-fix. The screen is pink and after the fix it works as it did in 4.0. In 4.1 and 4.2 the screen is pink and the desktop copy of the vr viewport does not work. It's a blocker for us, so this is rush job fix. |
Same Error 4.1.1 |
regarding the workaround
|
Still present in 4.2 beta 1 |
Are there plans to backport the fix to godot lts? |
The issue isn't fully resolved in 4.x yet as per the above comments, so that needs to be done first before it can be backported to 3.x. |
Thank you! I confirm that a similar issue exists in 3.5.3. |
My SubViewport update mode is set to Always, and I still get the error message when trying to duplicate the texture. I get no error when debugging in the editor, but it happens in the exported program (in my case, the Quest 3). I'm using Godot 4.2 stable. |
I found a solution while attempting to bypass that check, and it seems to be working fine. I want to recreate Prey's screens, and this is how it's turning out: https://twitter.com/GalacticLake/status/1769937516889616637 Before, I was getting pink screens every time I started the project. This is my solution: It seems the trick lies in creating an exported variable that stores a packed scene of what the subviewport will display. Inside the _ready function, assign it as a child of the subviewport, then make the necessary configurations, such as assigning the material and calling setup_local_to_scene(). Disabling the process mode isn't necessary; that's part of my multi-screen system. With this method, I no longer encounter errors because it's created and configured after the nodes are ready. In the editor, the screens won't be visible, but they will appear in the game; that's the only issue. |
A demo to test the latest status of the Viewport in Godot4 |
FWIW, the error,
When running the following Godot Demo projects: Procedural Materials So both of those demo projects can be used to test fixes for this issue in current and future versions. |
Yes, I'd just ignore these for now. |
4.3 stable, still happening :( |
This comment was marked as off-topic.
This comment was marked as off-topic.
Please see the thread above for an explanation, but please don't bump issues without adding significant new information |
Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.
Godot version
4.0 beta 1 mono
System information
Windows 10
Issue description
Scenes with viewport shows this errors even though viewport textures are set and working in materials:
ERROR: Viewport Texture must be set to use it.
at: (scene/main/viewport.cpp:114)
ERROR: Viewport Texture must be set to use it.
at: (scene/main/viewport.cpp:109)
Steps to reproduce
Create simple scene with viewport and material that is using it as texture.
Minimal reproduction project
No response
The text was updated successfully, but these errors were encountered: