godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.22k stars 20.23k forks source link

MultiMeshInstance error flood from VisualServer #19788

Closed oiblank closed 6 years ago

oiblank commented 6 years ago

Godot version: 3.0.3

OS/device including version: Windows 10 Nvidia GTX750Ti

Issue description: I used blender to create a plane mesh with set texture to achieve a "billboard sprite" which would work with multimeshinstance (billboard mode on a plane mesh doesn't actually work as it doesn't rotate the mesh only the applied texture but that's for another issue i suppose), and used multimeshinstance to populate a meshinstance terrain, I created multimeshinstance by following the documentation, set the target and source mesh as described, and when running the scene I get a flood of infinite errors:

0:00:37:0458 - Condition ' multimesh->color_format == VisualServer::MULTIMESH_COLOR_NONE ' is true. returned: Color()
----------
Type:Error
Description: 
Time: 0:00:37:0458
C Error: Condition ' multimesh->color_format == VisualServer::MULTIMESH_COLOR_NONE ' is true. returned: Color()
C Source: drivers/gles3/rasterizer_storage_gles3.cpp:4050
C Function: multimesh_instance_get_color

I also tested it without the billboard material and the error persists.

Also tried selecting a Color Format (either float or byte) which while not giving out any errors makes all my instanced meshes disappear completely.

Steps to reproduce: Already covered that and attached a stripped down project file recreating it.

Minimal reproduction project:

MultiMeshInstance_Error.zip

rokasv commented 6 years ago

Doesn't sound like a bug, to use the color param, you need to set it to one of the values indicating how you'll use it:

capture

i.e if done from code: multimesh.color_format = MultiMesh.COLOR_FLOAT

EDIT: oh wait, missed the part saying you tried that EDIT2: downloaded project, changed the color format manually, no errors, everything looks the same

oiblank commented 6 years ago

Yeah, but if you actually refresh the multimesh node after setting the color (change the number of instances) the color mode gets applied and they move to a different formation, and if you don't refresh it and save the scene, saving outputs the same errors for each individual instance. e.g. meshinstancerror

edit: Also tried the same thing without using the blender mesh but rather creating a custom plane and a custom quadmesh, still the same result.

rokasv commented 6 years ago

what do you mean by refresh?

if you are creating a new instance, it will always default to the Color Format being none, to counter this you can add the script code I posted in the last post to the _ready() function

oiblank commented 6 years ago

If you change the color format via editor it doesn't update straight away (see picture attached before) and at saving still produces the same error of no color, but if you change any other property of the multimesh node e.g. instance count, it updates the properties and changes the color format thus changing the location of instances based on the color format.

Attaching the script to the multimeshinstance node doesn't seem to actually change the color format when inspected through remote inspector at runtime and still outputs the same errors for me.

rokasv commented 6 years ago

It's not a convenient thing to get around, but it doesn't sound like an engine issue.

What I would do is create a function, which would change the number of instances and set the color format when doing it, then you can do it at runtime. If you need help with it in more detail, I'm Rokas#0521 on Discord.

oiblank commented 6 years ago

Found a thing that worked for me, that is: After populating a target mesh, set the color mode to float, save the scene (produces the no color error), close the scene completely, and open it again, now the color mode is actually float, no error and the locations didn't get messed up. All works fine until I fiddle with the multimesh again, so basically I have to reload the scene everytime after setting up a multimeshinstance.

akien-mga commented 6 years ago

This seems to be the same issue as #17850, closing as duplicate. I'll add the reproducer project there as additional debug material.