-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
MultiMesh2D + Line2D or Polygon2D changes color of MultiMesh #40901
Comments
After some experimentation the color of the To reproduce this drag the color picker for the My temporary fix for this will be to add a single This effectively resets the color modulation which is set by the first line. Edit: I've now tested with |
After doing some more testing and digging through the sources, it appears that this issue is not present with other kinds of 2D nodes such as Sprites or Meshes, just the multi-mesh. However, the likelyhood of this area being the problem is reduced as If I would suggest that there's some place we draw the Multimesh, and we forget to reset the modulation at the beginning of the draw loop. However I've not found it yet as I'm unfamiliar with Godot's source. After looking some more I found that However beyond that I'd assume that I'd assume therefore that the attribute used to pass the color is being improperly mixed inside a shader somewhere, but I'm not sure which or where to look. Hmm, seems like this part is relevant: |
Great work! It looks like many draw commands start with a line like this (from regular mesh drawing): godot/drivers/gles2/rasterizer_canvas_gles2.cpp Lines 598 to 599 in 241e709
Copying this into the multimesh command should solve this
|
Thanks for the hint! :) I'll try build it on Godot 3.x (as my sample repo doesn't work yet on 4.x) and get back to you! |
Sadly adding the above lines to the start of the render process in the Multimesh switch did not fix the issue: I think it's because a few lines lower we specifically enable color vertex attributes based on the users node configuration? If so, bypassing this would break (I assume) the modulation ability of the Node2D parent class. Any thoughts? |
Fixed by #47582 |
Godot version:
OS/device including version:
Issue description:
When adding a
MultiMeshInstance2D
after aLine2D
orPolygon2D
node, the color of the MultiMesh changes (becoming more faded).An example repository can be found here
Actual result:
Expected result
Expected result can be achieved by changing the order of the nodes (i.e. put the MultiMesh instance before the Line2D)
Expected result can also be achieved by setting "Show Behind Parent" to true, but this does not work in all cases.
Expected result can also be achieved by setting the color to
Color(3, 0, 0, 1)
, althoughColor(2, 0, 0, 1)
still leaves the MultiMesh looking dimmed.Note that the Line2D and Multimesh can be anywhere in the tree (any depth), as long as the MultiMesh is rendered later than the Line2D this effect occurs, causing this to be particularly difficult bug to track down.
The text was updated successfully, but these errors were encountered: