Search Instagram Twitter Facebook Spotify Grid Tag Date Folder Chat Pencil

DevLog Update – Decals

The last 2 days have confirmed my theory that it’s the most trivial parts of a game that end up being the most time-consuming and tedious to implement.

I cleaned up the code for the Teleportation Doorways, and started to replace the old teleportation areas with this new element. However, I started to notice this very weird bug: the decals around the archway of the door, which show how many keys the player has obtained, and how many are needed to open the door, would fade in and out of visibility.

The way the decals for the door works is that I have 12 of them responsible for the key lights. 6 of them show how many keys are required, and 6 of them show the number of keys the player has.

The decals showing the required number of keys are off-set from the mesh by 0.01. This is because if there is not offset, there ends up being a strange flickering effect because there are 2 meshes overlapping and the engine doesn’t know which one to render.

Then, because the decals showing how many keys the player has need to be shown on top of the decals showing required number of keys, they are off-set by 0.02, show that they are rendered over the other decals.

However, I was noticing a problem where, if I stood at certain angles, some of the decals showing how many keys the player has would become invisible. I double checked the code, and the logic was all correct. As far as the element was concerned, it was detecting the right number of keys, and had the right requirement number. From this, I determined it was just a problem with the decals.

I started to play around with the different settings of the decal projectors: size, culling angle, position, affected layers. Eventually, what I found was that the decal for the required keys and the decal for the number of keys the player has, cannot overlap. Despite having the mesh off-set values be different, if the decal projectors overlap, there ends up being some kind of a problem.

This is what the set up for the decals look like now:

decals_setup

You can see that the decal projectors (represented by the capital D with three lines next to it), are off set from each other.

Not the most satisfactory solution, as I still don’t know what was going on. However, it has solved my problem for the moment, and I’m just glad I can move on and work on other aspects of the game.

One Comment

  1. If you are interested to understand the issue, you can post the description in the Decal System thread in the Unity forum. I’ll explain you the underlying restrictions. It is mostly related to transparent shaders.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.