Jump to content

How to stop Decals from bleeding through the model


ZackMFleischman
 Share

Recommended Posts

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

 

 

Babylon_js_Playground.pngBabylon_js_Playground 2.png

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...