Hi there, I have some trouble with DecalGeometry…
Here is the exemple which I modified to show my problem : [update 27.06.19] - I changed materials to MeshNormalMaterial to better show the normal issue. https://felixmariotto.github.io/webgl_decals
When I parent some decals in an object, which I thereafter rotate, the decals show weird shadows… I assume this is a problem of normal, but I’m not sure.
See the shadows of the stars on the following pictures ? It doesn’t follow the model’s normal.
I think there’s a confusion about how decals work. Each decal is separate geometry, and this new geometry is basically a cube cut-out of the original geometry, then a texture is painted on it. So, in your case, the head has a complex normal map, that map is ignored and only the head geometry is used. The reason for weird shadows is, probably, due to number of overlaps, because each of these spats is basically a separate mesh and if it is allowed to occlude - it will create these types of artifacts.
Hi Usnul, thanks for your answer.
I don’t know if if the shadow problem occurs because of overlapping meshes, because if I cancel the rotation of the mesh, I can overlap as much as I want without this issue occurring at any time :
those normals don’t look right (on the second to last image), normals along the back of the head pointing down.
It does look like something strange is going on. Maybe try to visualize normals on the decal geometry also. Also, perhaps try using “normal” material rendering for both as a toggle option, might help you get a better idea.
I changed the materials as you suggested to make the problem more obvious, I updated the example of my first message.
I’ve been struggling so far without finding anything, it seems to come from how vertices normals are copied to the decal geometry inside DecalGeometry. @Mugen87 I saw in the example code that you contributed to it, do you have any idea what could be my issue ?