- Home /
Question About Bullet Decals Javascript
I need to add a bullet decal where my ray-cast hits the ground. My question is not about how to do that but how to make it look right. Currently when the decal appears it "flashes" as the player moves as it directly perpendicular to the floors normal. I think I may have made the decal object wrong. I simple made a small plane, added the texture to a transparent shader material and then instantiated the plane on the floor when a hit was found. I can get around this by translating the decal in the direction of the normal a little but surely there is a better way?
This question shows up as unanswered. If you'd be so kind, could you-$$anonymous$$oningStoma post your answer as an answer, and you... dfdhkldhg mark that one as accepted?
Hehe, dfghdh. :)
Answer by KoningStoma · Jan 21, 2013 at 11:00 PM
I believe it's called "z fighting".
As far as I know, moving it a bit in the direction of the normal is the most practical way to stop it from happening. I have always done it that way.
thanks for that, moved it 1000th of a unit in the direction of the normal
As @$$anonymous$$oningStoma said, this is a typical Z-fighting case: when two surfaces are at the same distance from the camera, small precision errors make random parts of one object appear in front of the other and vice versa, causing that annoying flickering. The only way to avoid this without worse collateral effects is to move the decal a little ahead of the surface - even a very small displacement like 0.0001 can do the magic.
Your answer
![](https://koobas.hobune.stream/wayback/20220613091344im_/https://answers.unity.com/themes/thub/images/avi.jpg)