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

Setting transform of meshes in MultiMesh produces an error #12595

Closed
Zylann opened this issue Nov 2, 2017 · 5 comments
Closed

Setting transform of meshes in MultiMesh produces an error #12595

Zylann opened this issue Nov 2, 2017 · 5 comments
Milestone

Comments

@Zylann
Copy link
Contributor

Zylann commented Nov 2, 2017

Godot 3.0 alpha 2, Windows 10 64 bits
nVidia GeForce 940M

As an attempt to answer @abhaskumarsinha, I found out this code doesn't work:

extends MultiMeshInstance

func _ready():
	# Create multimesh resource that will contain 4 cubes
	var mm = MultiMesh.new()
	mm.instance_count = 4
	mm.transform_format = MultiMesh.TRANSFORM_3D
	mm.mesh = preload("res://cube.obj")
	
	# Set position of all cubes at random
	for i in range(mm.instance_count):
		var pos = Vector3(rand_range(-2, 2), rand_range(-2, 2), rand_range(-2, 2))
		var t = Transform(Basis(), pos)
		mm.set_instance_transform(i, t)
	
	# Assign multimesh to be rendered by the MultiMeshInstance
	self.multimesh = mm

It shows only one cube, and 4 errors are logged, everytime instance transforms are set:

ERROR: RasterizerStorageGLES3::multimesh_instance_set_transform: Condition ' multimesh->transform_format == VisualServer::MULTIMESH_TRANSFORM_2D ' is true.
   At: drivers\gles3\rasterizer_storage_gles3.cpp:3825

But as shown in the code, I did set the format to 3D...

Edit:
It works if I assign transform_format before setting instance_count. I didn't expect these to be order dependent.

@djrm
Copy link
Contributor

djrm commented Nov 10, 2017

it is clear why you need to call transform_format and color_format, before setting the instance count, (it allocates and configures everything when you do that) but the name of the method is not very descriptive, another option would be to configure again when setting the formats.

@Zylann
Copy link
Contributor Author

Zylann commented Nov 10, 2017

At first I thought it was a bad idea to expose this as a property, but that makes sense when you know how it's implemented. I wonder which kind of magic Godot does to keep these ordered as properties.

@reduz
Copy link
Member

reduz commented Dec 5, 2017

This is not really a bug, but an error should be shown if format or something is changed before instance count. Is an error being shown or should we add it?

@Zylann
Copy link
Contributor Author

Zylann commented Dec 6, 2017

@reduz only this, in the console as usual:

ERROR: RasterizerStorageGLES3::multimesh_instance_set_transform: Condition ' multimesh->transform_format == VisualServer::MULTIMESH_TRANSFORM_2D ' is true.
   At: drivers\gles3\rasterizer_storage_gles3.cpp:3825

@akien-mga
Copy link
Member

We have now entered release freeze for Godot 3.0 and want to focus only on release critical issues for that milestone. Therefore, we're moving this issue to the 3.1 milestone, though a fix may be made available for a 3.0.x maintenance release after it has been tested in the master branch during 3.1 development. If you consider that this issue is critical enough to warrant blocking the 3.0 release until fixed, please comment so that we can assess it more in-depth.

@akien-mga akien-mga modified the milestones: 3.0, 3.1 Jan 5, 2018
@reduz reduz closed this as completed in 5307043 Sep 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants