godotengine / godot

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

MeshInstance material is ignored in-game by PrimitiveMesh #9234

Closed nunodonato closed 7 years ago

nunodonato commented 7 years ago

Operating system or device - Godot version: Godot 3, Linux

Issue description: Material looks ok in editor, but totally white when in game. I tried changing alpha, metallic and roughness but no difference at all. Using a directional light. The material is on Mesh (Plane)

game: screenshot from 2017-06-17 08-44-13

editor: screenshot from 2017-06-17 08-43-57

eon-s commented 7 years ago

Not sure if is the same but when starting the project manager and editor I get

ERROR: add_property: Invalid Setter: Environment::set_ssr_accel for property: ss_reflections_accel At: core/class_db.cpp:763.

Then, the environment (a default one with procedural skybox) seems to be ignored when running:

captura de pantalla de 2017-06-17 13-32-02

nunodonato commented 7 years ago

I found (part) of the problem.

If I assign the material inside the PrimitiveMesh properties, it will work ok. But if I assign in the MeshInstance, it wont be used at all.

nunodonato commented 7 years ago

Upon more testing I realized that the Material Override in Geometry Instance seems to work fine. So it's just the Material in the MeshInstance that seems to be ignored by these Primitives

BastiaanOlij commented 7 years ago

Thats weird, I was indeed under the impression Godot takes care of this inside of the Mesh base class. I've basically using the same approach as ArrayMesh is so it may be that ArrayMesh suffers from the same issue.

@reduz any ideas where I should start looking?

edit I can certainly reproduce this. From what I can tell, in the editor it works correctly, in game it always uses the material set on the resource. My guess is that this is caused by us deferring the update of the object and it overwriting the material set on the MeshInstance by the material set on the resource.

vnen commented 7 years ago

I noticed that GIProbes don't consider the light emitted from PrimitiveMeshes (no matter if the material is set on the node or the resource), and maybe it is a consequence of this.

reduz commented 7 years ago

I´m confident that both these things should be fixed now, so closing. In any case test if you want and reopen.

ZorionTen commented 3 years ago

Still not working for me ... amterials are loaded in editor but not in game. Exported as obj from TinkerCAD online. godot 3.2