i have created a decal mesh through DecalGeometry，and the decal mesh is on the surface of B mesh。How can i do to blend decal mesh with the normalMap of B mesh,inorder to let decal mesh seem like is a part of B mesh
I don’t think this can be simply done. Both meshes are rendered independently. Accessing the uv data and normal map of mesh B from the decal mesh does not work.
whether if can achieve it through setting blending of decals mesh’s material？
If you provide a live demo with your current progress, it might be easier to give some advises.
here is my code :decalTest.rar (409.9 KB),the mesh B and the decal mesh is like this:
Please give me some advice.Thank you
Um, sry. I can’t think of a way in order to solve this problem with two independent meshes (I mean “mesh b” and “decal mesh” in your particular case). Maybe someone else has an idea…
The only thing that comes to mind is to somehow calculate the UV coords of the part of mesh b that is covered by the decal mesh, and set the decal mesh UVs so that the same part of the normal map is used. No idea how to go about doing that though.
@looeee @Mugen87 thank you very much, i have realized it through set the repeat and offset of decal mesh’s normalMap.This method may not be the most appropriate method, but I hope to help you achieve a better approach.here is my code :decalTest.rar (797.8 KB)
You might want to look into deferred shading for this.
Another alternative is to modify the material and add another texture layer, but it would be tricky finding the right mapping for the decal.