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

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

Closed
BracerJack opened this issue Oct 10, 2020 · 5 comments · Fixed by #53833

Comments

@BracerJack
Copy link

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 Calinou changed the title Example File included ! Sprite3D's color interpretation is wrong for webm video, direct comparison with 2D version of the same thing side by side included. Sprite3D's color interpretation is wrong for webm video, direct comparison with 2D version of the same thing side by side included. Oct 10, 2020
@Calinou
Copy link
Member

Calinou commented Oct 10, 2020

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

  • Create a MeshInstance node.
  • Add a QuadMesh to it and size it accordingly.
  • Add a SpatialMaterial to the QuadMesh, check Local to Scene in the Resource section.
  • Set the albedo texture to the ViewportTexture in the SpatialMaterial.
  • Enable Flags > Unshaded in the SpatialMaterial.
  • Enable Flags > Albedo Tex Force Srgb in the SpatialMaterial. This is the step that fixes the color display.

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 #27790.

@Calinou Calinou changed the title Sprite3D's color interpretation is wrong for webm video, direct comparison with 2D version of the same thing side by side included. Sprite3D displays wrong colors when displaying a ViewportTexture containing a VideoPlayer with a WebM video Oct 10, 2020
@BracerJack
Copy link
Author

BracerJack commented Oct 10, 2020

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
Copy link
Author

BracerJack commented Oct 10, 2020

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
Copy link
Member

Calinou commented Oct 10, 2020

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

It's not any more efficient since 3.2.3 (#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 🙂

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
Copy link
Author

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

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

Successfully merging a pull request may close this issue.

3 participants