JuliaPolyhedra / Polyhedra.jl

Polyhedral Computation Interface
Other
172 stars 27 forks source link

Mesh displays with incorrect Material #180

Closed ferrolho closed 5 years ago

ferrolho commented 5 years ago

What it says in the title: seems that meshes created with Polyhedra.jl lack the correct material they are assigned, using MeshCat as the visualiser. The colour is correct, but Phong/Lambert does not result in the expected surface lighting.

v1 = [1 1 1 1 0 0 0 0
      1 1 0 0 1 1 0 0
      1 0 1 0 1 0 1 0.]'

p1 = polyhedron(vrep(v1), CDDLib.Library(:float))

m1 = Polyhedra.Mesh(p1)

material = MeshPhongMaterial(color=RGBA(1, 1, 1, 1.0))

setobject!(vis[:m1], m1, material)

I did not dig down enough to understand whether this is an issue with Polyhedra.jl or something else in MeshCat.jl.

blegat commented 5 years ago

I would expect it is an issue with MeshCat as Polyhedra only implements the GeometryTypes decompose API

cc @rdeits @tkoolen

tkoolen commented 5 years ago

Yeah, I don't see how this could be a Polyhedra issue. @ferrolho, feel free to open an issue with MeshCat, but FWIW I do see a slight difference between MeshLambertMaterial and MeshPhongMaterial, and I see the same difference between the two material types for a GeometryTypes.HyperRectangle of the same dimensions. You might want to experiment with some of the different MeshPhongMaterial options, see https://threejs.org/docs/index.html#api/en/materials/MeshPhongMaterial.

ferrolho commented 5 years ago

Closed in favour of https://github.com/rdeits/meshcat/issues/59.