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

Vertex colors are assigned incorrectly in quadrilaterals drawn using CommandPrimitive #97593

Closed
Lielay9 opened this issue Sep 28, 2024 · 2 comments · Fixed by #98652
Closed

Comments

@Lielay9
Copy link
Contributor

Lielay9 commented Sep 28, 2024

Tested versions

Master as of writing: v4.4.dev.custom_build [76a1359]
Regression after #92797 (bisected)

System information

Godot v4.4.dev (a657ea4) - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4090 (NVIDIA; 31.0.15.3699) - AMD Ryzen 9 7950X 16-Core Processor (32 Threads)

Issue description

Quadrilaterals drawn using CommandPrimitive (RenderingServer.canvas_item_add_primitive(), antialiasing etc.) assign the provided vertex colors incorrectly after #92797 in the RD-renderers. More specifically, the second constructed triangle (top left, bottom right, bottom left in the first image) uses the colors indexed at 0, 1 and 2, when it should use 0, 2 and 3.

func _draw() -> void:
	var uvs: PackedVector2Array = [Vector2.ZERO, Vector2.RIGHT, Vector2.ONE, Vector2.DOWN]
	var colors: PackedColorArray = [Color.WHITE, Color.RED, Color.GREEN, Color.BLUE]
	var points: PackedVector2Array = uvs.duplicate()
	for i: int in points.size():
		points[i] *= 500
		points[i] += Vector2(50, 50)
	draw_primitive(points, colors, uvs)
Screenshot 2024-09-28 204209

Incorrect antialiasing of line (drawn with scale 10 to blow out the feather size):

Screenshot 2024-09-28 210515

Compatibility for reference:

Screenshot 2024-09-28 211249

Steps to reproduce

Minimal reproduction project (MRP)

primitivevertexcolors.zip

@Lielay9

This comment was marked as resolved.

@Lielay9 Lielay9 changed the title Vertex colors are assigned incorrectly in quadrilaterals drawn using CanvasItem.draw_primitive Vertex colors are assigned incorrectly in quadrilaterals drawn using CommandPrimitive Sep 28, 2024
@stuartcarnie
Copy link
Contributor

Reproduced it – thanks for the MRP!

Fixed in #97340:

CleanShot 2024-09-29 at 06 31 50@2x

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