Search Unity

Does anyone know how to fix decal projector stretching on steep angles?

Discussion in 'Universal Render Pipeline' started by Kaerfca, May 21, 2022.

  1. Kaerfca

    Kaerfca

    Joined:
    Aug 7, 2015
    Posts:
    2
    Hi, y'all,

    I'm trying to make a Pikmin-inspired game and it's going pretty well so far. There will be a projector which will act as the whistle/throwing target if anyone has ever played any of the Pikmin games. This is my biggest hurdle I've come across so far.

    Since the decal will be moving constantly based on the mouse's position, I'm trying to avoid having it stretch out when it reaches a sharp angle. It seems to work fine for ramps as long as they're not too tall/steep, but any edges or walls are going to pose a problem. I've considered just about everything and finally decided to ask for help. If anyone has any thoughts or suggestions, I'm open to anything. Thank you!

    Here's my settings for the projector texture:

    upload_2022-5-20_23-48-17.png

    And here's what I'm trying to avoid:

    upload_2022-5-20_23-47-46.png

    Thank you to anyone who has any suggestions. :)
     
  2. Ratatoeskr

    Ratatoeskr

    Joined:
    Oct 25, 2013
    Posts:
    9
    I dont have a solution, unfortunatly I'm also very interessted as I have the same problem.
    Nevertheless in your case I could imagine that limiting the decal to the ground layer may help. You probably have to do this anyway as overwise other objects like player, prop etc. will also be painted on by the decal.

    Also in HDRP I somewhere saw an option to usw angle fade on decals. I didnt try this and also for my project I'm using URP, but maybe this could help
     
  3. funkyCoty

    funkyCoty

    Joined:
    May 22, 2018
    Posts:
    727
    The URP decals are very bare-bones. If the people who made it actually made games, it would have the pretty standard option of fading out based on angle, or at the very least clipping based on the angle of the surface it's touching.

    If you're experienced with shader stuff, you could add this in yourself. Just grab the normal of the surface and dot it with the normal of the decal, and if over some threshold clip() it.
     
  4. VeganBurrito86

    VeganBurrito86

    Joined:
    Jun 3, 2021
    Posts:
    7
    URP does have an angle fade option on the decal projector. At the bottom of this screenshot:

    upload_2022-10-18_1-16-27.png

    You drag the sliders on each end to achieve what you're looking to do.
     
    REDACT3D_ likes this.
  5. REDACT3D_

    REDACT3D_

    Joined:
    Nov 8, 2020
    Posts:
    222
    the same as HDRP,
    the Angle Fade Slider, as mentioned by VeganBurrito86