godot icon indicating copy to clipboard operation
godot copied to clipboard

Sprite 3D texture rendering is broken frame 1

Open ToufouMaster opened this issue 1 year ago • 3 comments

Tested versions

  • Reproductible in v4.3.dev5.official [89f70e98d]

System information

Windows 10 - v4.3.dev5.official [89f70e98d] using Mobile or Forward+ AMD RX 5600 XT

Issue description

When using a Sprite3D and instancing a Card (my scene) containing a Sprite3D inside a Viewport with a camera, rendered in 2D using a Sprite2D with a ViewportTexture, when instancing the Card during the first frame the texture will be rendered incorectly image Using the Compatibility renderer fix the issue

Steps to reproduce

i can't figure out how to reproduce the error, but here is the node tree image

Minimal reproduction project (MRP)

i was unable to reproduce the issue on an other project so here's mine, the card is saved inside "card.tscn" bug_report.zip

ToufouMaster avatar Mar 26 '24 00:03 ToufouMaster

it seems to be a bit of the same problem as here, but it is not produced in the same way, I'll leave it there for now. https://github.com/godotengine/godot/issues/56687

ToufouMaster avatar Mar 26 '24 00:03 ToufouMaster

Here is a smaller project with the same problem: viewport-glitch.zip

I created an object with a Sprite2D and a SubViewport, using the viewport as the sprite's texture. image This object is rapidly instantiated and deleted to show the first frame. image image

It seems like the problem relates to how the viewport's texture is not rendered before the sprite renders, so the sprite is rendering some uninitialized texture memory from the GPU.

A temporary fix for your project is to set the viewport's Update Mode to render when the parent is visible, so it is initialized when the sprite asks for the texture: image

smntic avatar Mar 28 '24 16:03 smntic

I tried to set Update mode to When parent visible but it did not work. I tried it with SubViewport being a child and a sibling of the Sprite3D.

UQuark avatar Apr 25 '24 12:04 UQuark