goetzmoritz Posted August 17, 2018 Share Posted August 17, 2018 Hi there, so, it is easy to have decals on a static mesh. But if I want to have it on an animated mesh with bones and animation, it will stick to the origin position of the mesh. Any ideas how to resolve that? Basically, what I want to achieve is having a layered material, something like multimaterial, but without the need to use the vertices in order to separate the materials. Thanks! Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 17, 2018 Share Posted August 17, 2018 you could clone the mesh and render in two passes ? Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 17, 2018 Share Posted August 17, 2018 Oh and I just noticed it was your first post, Welcome to the forum !!!! Quote Link to comment Share on other sites More sharing options...
goetzmoritz Posted August 17, 2018 Author Share Posted August 17, 2018 Thanks Yes, I did some research... Clone the mesh and work with material z-offset. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 17, 2018 Share Posted August 17, 2018 yup ? Quote Link to comment Share on other sites More sharing options...
goetzmoritz Posted August 17, 2018 Author Share Posted August 17, 2018 I tried to achieve that mesh-clone thing, but somehow it does not work. I'm pretty new to Babylon-JS (and very excited indeed). https://www.babylonjs-playground.com/#PN1NNI#46 Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 17, 2018 Share Posted August 17, 2018 A couple of issues. The clone techniques is to simulate layered materials so you will need to be carefull that you fit your textures with the mesh uvs or rewrite them. in you playground mesh[0] does not contains the vertex info but is the parent group not containing rendering info. You should try first on a simpler model to validate the technique as the alien is a pretty complex one. The material looks ok once it will be applied to the right mesh ? Quote Link to comment Share on other sites More sharing options...
goetzmoritz Posted August 18, 2018 Author Share Posted August 18, 2018 Hi! Thanks for this help. I tried to bring a more simple example and things start to get better. Still, I have the issue that in this example http://www.babylonjs-playground.com/#YDO1F#71 you can see that the normal-map is also applied to the second material. This is not what I was aiming for. Is it possible to share the alpha-mask from the albedo for metalness/roughness/normals , too? Quote Link to comment Share on other sites More sharing options...
goetzmoritz Posted August 18, 2018 Author Share Posted August 18, 2018 Wow, I think pbr1.transparencyMode = 3; does the trick! Sebavan 1 Quote Link to comment Share on other sites More sharing options...
goetzmoritz Posted August 19, 2018 Author Share Posted August 19, 2018 zOffset causes weird errors, though. What are proper value ranges for that? For my material for a gltf-model on which I'm using that value on, it makes the "base-layer" material make somewhat transparent, if I use an opacity-map for the "top" layer. For me it seems that the opacity of the top-layer-mesh-material is somehow influencing the base-layer-mesh-material. How can that be? - Can I get rid of that weird effect? Is that bug? - Is there another way to use transparency besides opacity-maps? I'll try to reproduce my effect on playground, will take some time though. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 19, 2018 Share Posted August 19, 2018 This depends on the alpha mode that you are using. You can find more about the available modes here: http://doc.babylonjs.com/how_to/how_to_use_blend_modes Quote Link to comment Share on other sites More sharing options...
goetzmoritz Posted August 19, 2018 Author Share Posted August 19, 2018 Thanks for the hint, but the effect I‘m getting is weird. When I activate the top-layer-mesh and assign an opacity map to the material and set the transparent-mode to 3, the base mesh, which I did not change at all, gets influenced by this opacity map too, but only when you look at it at a very small angle. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 20, 2018 Share Posted August 20, 2018 Oh, this can come from the fresnel effect at grazing angles. Could you set on your material (the decal one): mat.useSpecularOverAlpha = false; mat.useRadianceOverAlpha = false; Quote Link to comment Share on other sites More sharing options...
goetzmoritz Posted August 20, 2018 Author Share Posted August 20, 2018 Yes, thanks! I think I was able to create a very simple Playground to show my issue: https://www.babylonjs-playground.com/#8LFTCH#5 It seems that the Normals are flipped as soon as I apply a new material. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted August 20, 2018 Share Posted August 20, 2018 This is because you are not setting your material as the main one: https://www.babylonjs-playground.com/#8LFTCH#7 There are plenty of properties on the materials and some of them are linked to the mesh and would need to be carried over. Quote Link to comment Share on other sites More sharing options...
goetzmoritz Posted August 20, 2018 Author Share Posted August 20, 2018 Hi Sebavan, yes, this was the last puzzle piece I needed to complete this little project. Thank you a lot you were a great help for me! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.