ZackMFleischman Posted November 15, 2016 Share Posted November 15, 2016 Hey all! So I noticed some behavior where a decal was "bleeding through" (or duplicating itself) through the thinner parts of models. The behavior is witnessed in the standard decal playground if you try to put a decal on the feet of the cat: http://www.babylonjs-playground.com/#1BAPRM (See the attached images for an example) I've already read pretty extensively through the Decal's thread: From that thread I gleamed that I can mitigate this slightly by limiting the Z scale on the decal size. However this is far from ideal as I'm painting decals on arbitrary meshes, many of which have several bends and/or are very thin, so it very much seems like I have the trade off of not letting my decal bleed through to the other side of a mesh with unnecessarily clipping it around corners < 90. I can appreciate that there is some difficulty getting the decal's to behave appropriately when wrapped past 90 degrees, but does anyone with some knowledge of the behemoth that is the decal implementation have insight to how we can at least correct this duplication / bleed through issue? Thanks! Zack Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2016 Share Posted November 15, 2016 Hello the decal "captures" a volume of the target mesh. This volume is defined by the decal size. For instance, here, http://www.babylonjs-playground.com/#1BAPRM#78, the size on Z == 2 and it works. Your conclusion is correct and if you want to take in account all kind of meshes I guess you will have to tweak the decal size on a per mesh basis Quote Link to comment Share on other sites More sharing options...
ZackMFleischman Posted November 15, 2016 Author Share Posted November 15, 2016 @Deltakosh Would you mind sharing a bit more insight as to the Decal algorithm? I might like to modify it to only create the triangles of the decal mesh whose normal is within a certain range of the normal at the pick point. (by means of the angle between them) I guess I could also "transparent out" the non-desired triangles as well. For my use case I don't always have the luxury of knowing what every mesh is, and even then there are some meshes that just don't work by tweaking the decal size, because they're too rounded and sharp at some points so culling the volume on the Z-Axis produces undesired cropping of the decal, but they're thin at other points so it would bleed through. Thanks for your input, Zack Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 16, 2016 Share Posted November 16, 2016 That's the power of open source, everything is public https://github.com/BabylonJS/Babylon.js/blob/7c0b819e8021b4e3254ac1b3d90ae585bf6c2125/src/Mesh/babylon.meshBuilder.ts#L892 Feel free to submit a PR if you want to improve it so that everyone will be able to use it 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.