godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.3k stars 20.23k forks source link

Sprite3D displays wrong colors when displaying a ViewportTexture containing a VideoPlayer with a WebM video #42698

Closed BracerJack closed 2 years ago

BracerJack commented 3 years ago

Godot version: 3.2.3

OS/device including version: GTX 1650

Issue description: I noticed someone else asking this question but with no file example and the conversation stopped at the possibility that there is a webm colorspace conversation error on the source video's side, so here is a direct comparison showing the colors working perfectly and as expected in the VideoPlayer component in 2D mode but get totally screwed up useless when handled by Sprite3D.

And also notice the error report when NOT A SINGLE SCRIPT have been typed at all, I didn't even do anything !: get_node: Node not found: Sprite3D/Viewport. setup_local_to_scene: ViewportTexture: Path to node is invalid. webm_bug.zip

Calinou commented 3 years ago

This is probably due to sRGB conversion not being applied when it should. There's a workaround for this:

To solve this in Sprite3D, we need to expose a flag to force albedo as sRGB. cc @clayjohn

Sprite3D on the left, correctly configured MeshInstance on the right:

Comparison screenshot

Here's the project with the workaround included: webm_bug_workaround.zip


And also notice the error report when NOT A SINGLE SCRIPT have been typed at all, I didn't even do anything !: get_node: Node not found: Sprite3D/Viewport. setup_local_to_scene: ViewportTexture: Path to node is invalid.

This is a known bug, see https://github.com/godotengine/godot/issues/27790.

BracerJack commented 3 years ago

Untitled-1

PS, just saw the workaround by @Calinou, will try it now, but still, this is an issue that should have never been. And also notice the error, the 2 un-provoked error that came out of nowhere.

BracerJack commented 3 years ago

Question to @Calinou, so is using the MeshInstance node more efficient resource wise ?
How do you exactly set the hierarchy structure for the MeshInstance method ? A screenshot of the hierarchy chain would be appreciated.

Is Sprite3D "supposed" to be the way to do it all along but it is just currently broken ?

Calinou commented 3 years ago

Question to @Calinou, so is using the MeshInstance node more efficient resource wise ?

It's not any more efficient since 3.2.3 (https://github.com/godotengine/godot/pull/39867), but it's more flexible than Sprite3D for sure.

How do you exactly set the hierarchy structure for the MeshInstance method ? A screenshot of the hierarchy chain would be appreciated.

Check the minimal reproduction project I uploaded in my comment :slightly_smiling_face:

Is Sprite3D "supposed" to be the way to do it all along but it is just currently broken ?

Sprite3D isn't broken. It just don't aim to target advanced use cases. Consider it as a shortcut to setting up a MeshInstance + QuadMesh.

BracerJack commented 3 years ago

@Calinou...thank you, for your patience and your kindness. I appreciate your help and your presence.