Search Unity

How to use the Projector component when using LWRP?

Discussion in 'General Graphics' started by Vak_HD, Jun 26, 2018.

  1. Vak_HD

    Vak_HD

    Joined:
    Aug 6, 2016
    Posts:
    14
    I don't seem to be able to get the Projector component to work when using the new Lightweight Render Pipeline. Does anyone know how to get this to work using LWRP? I've tried to use the Upgrade Material tool on the Projector Materials from the Standard Assets Effects package but get the message:

    ShadowProjector material was not upgraded. There's no upgrader to convert Projector/Multiply shader to selected pipeline
    UnityEditor.Experimental.Rendering.LightweightPipeline.LightweightMaterialUpgrader:UpgradeSelectedMaterials()

    etc..

    Do I need to set up a regular LightweightPipeline material a certain way to in order for it to work? If so I am having trouble and don't seem to be able to get it to work.
     
    TreesAreOP likes this.
  2. itsPeetah

    itsPeetah

    Joined:
    Nov 4, 2016
    Posts:
    4
    I know this comment is going to be pretty useless but I also am having this problem and I hope this thread reaches out to someone who can help
     
  3. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,174
    You have to provide a shader that's compatible with LWRP for it to work.
     
  4. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    811
    Why don't the default projector shaders work? They don't display any errors or warnings, they just don't work.
     
  5. jugueton

    jugueton

    Joined:
    May 11, 2016
    Posts:
    13
    Very helpful...
     
    Jelmer123, Nattress and fazhom like this.
  6. phil_lira

    phil_lira

    Unity Technologies

    Joined:
    Dec 17, 2014
    Posts:
    554
    Projectors are not supported by SRP and LWRP. We need to provide faster alternatives for decals, blob shadows and so on.

    What are you main usage of projectors? Then we can add your requests to our backlog.
     
    decimation and ROBYER1 like this.
  7. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    1,867
    We use projectors in our tools to highlight an area of the terrain and also detect the height at that point as the user moves the mouse across a terrain. Is there a better way to do this that works in both HDRP and LWRP?

    We use them in orthographic mode with the projector facing downwards.
     
    Novack and joshcamas like this.
  8. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    1,122
    I was wanting to use a projector as my character throws objects and I have a line renderer that shows the trajectory arc but if you start to get kind of far away it becomes difficult to determine exactly where the end of the line renderer is compared to other objects near it, so I wanted to have something of a crosshair or circle or something that projects on to the ground or onto whatever object happens to be at the receiving end of the line renderer and where the thrown object will end up.

    Is there another way that someone can suggest for LWRP that might work for this and be able to display on the ground as well as on other objects if they happen to be there? I would assume that if this gets added to a backlog it will probably be a while before it makes it into a release, yeah?

    --- Edit --- Hmm... I had been using LWRP since the start of this current project and things were more or less fine this whole time and I made due with the limitations but decided to copy my project and remove the LWRP just to see if the restrictions were worth the performance increase. Turns out, they are not. My game ran just as good, while I had not actually profiled it yet without it, it seemed to actually be running better. I guess I may as well just run normal rendering as it will at least not restrict some of the things I need. I guess I can just revisit LWRP down the road to see if things are better at a later date.
     
    Last edited: Sep 23, 2018
  9. reflectingb0t

    reflectingb0t

    Joined:
    Apr 10, 2018
    Posts:
    18
    Having trouble with Projectors, too..
    We use Blob Shadow Projector for the player character shadow (just the one from Unity Standard Assets) and somehow it works fine in the Scene view with LWRP, but in Game it sometimes shows and sometimes not.
    It seems to depend on the mesh the player is standing on (for example the regular plane doesn't work, but some custom meshes always show the shadow), but i couldn't figure it out exactly.
    Setting the render queue and moving the projector doesn't fix this. Any idea or workaround? We can afford the performance cost of the projector in this particular case.
     
  10. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,174
    As answered earlier, projectors are not supported by SRP and LWRP.
     
  11. juanfornos

    juanfornos

    Joined:
    Feb 17, 2018
    Posts:
    9
    I was using projector for blob shadows as real time are too expensive for low end devices.

    Blob shadow support would be great and makes total sense in the LWRP context.
     
    Gekigengar, Giacas and qzmp like this.
  12. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    28,160
  13. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    370
    Thanks for the link! I'll check this out as soon as a I can but I am a bit concerned. It appears to be using the projector component - but I'm hoping that the shaders involved don't have the same issue of requiring a re-render of every mesh they touch. Considering I need to be able to render hundreds of onscreen blob shadows at once, that would be bad.
     
  14. hippocoder

    hippocoder

    Digital Ape Moderator

    Joined:
    Apr 11, 2010
    Posts:
    28,160
    Yeah although Kink3d works at Unity and on LWRP (I think) so I don't think he would deliberately make something crappy and slow. You could ask him - @Kink3d here, or on twitter: https://twitter.com/MatthewDean3D

    I have doubts it's slow, but it is actually still forward so YMMV... I haven't tested it because I'm using HDRP at the moment which supports decals by default.
     
  15. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    370
    I checked it out and it does indeed appear to add additional SetPass calls for each decal unfortunately. At least, that's the case with the built-in pipeline. Maybe it's different for the LWRP. I suppose this is at least a nice temporary fill-in for projectors if one is using the LWRP.

    Sadly I'm in production so using something experimental like the new rendering pipelines is out of the question for me.
     
    hippocoder likes this.
  16. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    871
    Just passing by to say the kDecals by Kink3d isn't for LWRP yet, as it still use projectors.

    You will need to develop a custom solution based on ScriptableRenderPass, here are some examples:

    https://github.com/UnityTechnologies/LWRPScriptableRenderPass_ExampleLibrary

    I haven't seen a working solution in the wild yet, but it's possible, here are a few idea:

    https://forum.unity.com/threads/alternative-blob-shadows-lwrp.592237/

    (Projector are slow anyway, by going the alternative routes you gain what LWRP focus on: performance)

    (Kinda think this thread should be in the graphic beta forum.)
     
    phil_lira likes this.
  17. Jokerminator

    Jokerminator

    Joined:
    Jun 30, 2006
    Posts:
    263
    Clouds effect. Blood. Details in general.

    Please make projectors and decals work, also in the LWRP. No support isn't an option!
     
  18. japtar10101

    japtar10101

    Joined:
    Mar 13, 2010
    Posts:
    138
    I have a unique case where I'm trying to create an F-zero-like arcade game with anti-gravity vehicles hovering over a track that can flip upside-down. A common problem I have are that users cannot tell how high the vehicle is hovering over the track, especially if the vehicles & track are upside-down, thus making the directional light ineffective. If I could project the vehicle's "shadow" (as in, blob shadow) onto the track so it's always pointing down relative to the vehicle, that would go a long way in helping solve this visual problem.
     
  19. merpheus

    merpheus

    Joined:
    Mar 5, 2013
    Posts:
    152
    There is no decal support, no projector support. But it is really really needed. I am making blood splatting to ground via projectors on different mesh surfaces but without it I can't do that.
     
    h0neyfr0g and kkrg001 like this.
  20. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    1,163
    How does the terrain editor manage to have something like projectors for brushes? Is it built into the terrain shader?
     
  21. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    356
    Don't worry, this solution doesn't work either.
     
    DezBoyle likes this.
  22. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    370
    Ha yeah, tried a long time ago and discovered as much. Thanks for the heads up just the same. I just ended up going back to deferred rendering and using a deferred decal shader to solve the issue. Just made life easier.
     
  23. WILEz1975

    WILEz1975

    Joined:
    Mar 23, 2013
    Posts:
    356
    If I can have my say without being stoned, for me HDRP and LWRP are the worst update since I use Unity. And I use it from the Unity 3 version.
    I think it will take a long time for these introductions to be usable on a large scale. Especially because the tons of shaders that are on the net do not work if they are not rewritten from scratch for these pipelines.
     
  24. nasos_333

    nasos_333

    Joined:
    Feb 13, 2013
    Posts:
    10,158
    Any news on a projector for LWRP - HDRP ?
     
    RalliantoDeLaVega likes this.
  25. khalvr

    khalvr

    Joined:
    Sep 12, 2017
    Posts:
    53
    It's a part of the shader. When you paint terrain, you are basically painting into texture maps which have the same dimensions as the terrain. The shader then reads from the RGBA channels of these maps and use them as weights for the different terrain layers.

    The best solution for decals would be to have a system which crops out pieces of the meshes it affects and uses them for its own renderer. This would allow them to be batched too, though it would be a more static approach than projectors and not as usable for shadows and such.
     
  26. RalliantoDeLaVega

    RalliantoDeLaVega

    Joined:
    Jan 30, 2014
    Posts:
    45
    Exactly, we need this!

    I want to draw spell indicators on the ground, but it's pretty damn difficult without ANY method of projecting with the new render pipelines....
     
  27. sarynth

    sarynth

    Joined:
    May 16, 2017
    Posts:
    98
    Use case for me is an indicator around the mouse cursor of where the spell will cast, as well as indicator around the selected unit. Can't find anything in Universal Render Pipeline.
     
  28. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    871
    sarynth likes this.
  29. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,209
    Does this add additional passes to the URP rendering? Asking as we are using URP with VR on platforms like the quest where Fixed - Foveated rendering can be broken by an intermediate textures being produced such as render features using a camera color texture.
     
  30. jsunandmax

    jsunandmax

    Joined:
    Jan 12, 2013
    Posts:
    17
    any update here? REALLY need Projectors with URP....
     
    RGAMESR, ArmanUnity and ROBYER1 like this.
  31. decimation

    decimation

    Joined:
    Feb 25, 2015
    Posts:
    1
    A simple solution for blob shadows that is as straight forward as projectors would be fantastic for URP. I would love it if it was just in Standard Assets. It took about 4 hours to understand why the projectors didn't work in my project so it would be nice if there was an addendum to the "Guidelines" file in Standard Assets that said it does not work with URP.
     
    ROBYER1 likes this.
  32. Kristapsmadeapp

    Kristapsmadeapp

    Joined:
    Jul 10, 2019
    Posts:
    8
    As a projection blob shadow to my player I found a solution by adding spotlight instead of projector and changing light`s color to negative (created black light) using script (added script to spotlight):

    for example:

    using UnityEngine;
    public class LightColorScript : MonoBehaviour
    {
    public Vector4 hackColor;
    public float multiplier;
    public Light LightToChange;

    void Update()
    {
    var light = LightToChange;
    light.color = new Color(hackColor.x, hackColor.y, hackColor.z, hackColor.w) * multiplier;
    }
    }


    Hope this helps to someone ..
     
  33. L4Z3RC47

    L4Z3RC47

    Joined:
    Jun 21, 2015
    Posts:
    46
    Hello @phil_lira
    I am also wondering about the possibilities of having the old projector updated for HDRP. My use case is a bit different from the above in that we are using the projectors from the built in pipeline to do some reverse projection mapping for non-standard display setups.

    In this scenario we have a scene which we want to map onto a non-uniform geometric LED display while retaining perspective from a preset point. This results in a forced perspective installation where our content appears 3D to viewers from the defined point in realworld space. To achieve this we take a model of our display and import it into our scene (using layers to separate the object from the rest of the scene) and add a scene camera which represents the realworld viewpoint. We then take our scene camera and assign its output to a render texture which is in turn assigned as the texture to our projector. By projecting onto the model of our screens with the projector matching our desired viewing point in world space we can then take orthographic captures of the model to derive the desired output to send to our display.

    Unless there are other ways I'm unaware of to project textures onto non-uniform geometry?

    I'd love to get your input. Thanks!

    Sincerely
    W
     
  34. L4Z3RC47

    L4Z3RC47

    Joined:
    Jun 21, 2015
    Posts:
    46
    Another possibility could be an update to the Decal Projector in HDRP that is unaffected by light?
     
  35. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    780
    Also wondering if there is an ETA for this... simply axing features is not the way you would expect this to work.
     
  36. toishaanpatel

    toishaanpatel

    Joined:
    Feb 24, 2020
    Posts:
    1
    yeah, instead of repeating that comment, you could have said something useful that could guide us in the right direction
     
  37. Emme73

    Emme73

    Joined:
    Jan 24, 2013
    Posts:
    23
    No decals in URP. Wow. In 2020.Now lets have a look at Unreal...
     
    JasonDaze likes this.
  38. Emme73

    Emme73

    Joined:
    Jan 24, 2013
    Posts:
    23
    Ok, ok, beeing an artist, these are many hoops to jump through, but in the end I got it working, and it works like I needed :D
     

    Attached Files:

    Brodus likes this.
  39. Viole

    Viole

    Joined:
    Dec 29, 2015
    Posts:
    21
    Bump. Needed for indicators projected onto the terrain. (URP)
     
    Brodus likes this.
  40. Madix

    Madix

    Joined:
    Nov 22, 2013
    Posts:
    15
    Another bump. How is one supposed to create ground targeting or spell placement indicators in URP? Crazy
     
    Brodus and Novack like this.
  41. the_motionblur

    the_motionblur

    Joined:
    Mar 4, 2008
    Posts:
    1,738
    Also Bumping this ... Just jumped into a first project with URP (yeah, late to the party) and realized there are no projectors or light cookies in 2019.4. How is this still not implemented by default? Isn't texture projection and decals a basic in game development? °_°
     
  42. pavelmo4alov

    pavelmo4alov

    Joined:
    Mar 13, 2013
    Posts:
    14
  43. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    780
    Very interesting stuff!

    The first one is not an option for me, as github readme says:

    Decal mesh generation is relatively slow. This system is not recommended as a way to dynamically place bullet holes or other effects during gameplay.

    Once the decal mesh is generated it remains as it is and will not adapt to the other meshes changing. This system will not work nicely with skinned mesh renderers or other meshes that get distorted at runtime.

    At least in my case, the projectors are heavily used as indicators, and need to instantiate them dynamically, and move them around (so they need to run over different textures, and have layer filters). So I guess it will require testing to know if the second solution is fine in feature set, and performance.

    Thank you for sharing the findings.
     
    Last edited: Aug 21, 2020
    pavelmo4alov likes this.
  44. calpolican

    calpolican

    Joined:
    Feb 2, 2015
    Posts:
    375
    did it work?
     
  45. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    780
    Have not tried it yet. Im mid-project using built-in render pipeline precisely because of the projectors, and Im quite hesitant to divert time and energy at this point into testing this. If I do, I'll report back, but dont hold your breath :)
     
  46. calpolican

    calpolican

    Joined:
    Feb 2, 2015
    Posts:
    375
    ok, if anyone finds a solution, let me know. Hopefully unity will add this system soon, it's already in the URP list, so let's see.
     
  47. Brielga

    Brielga

    Joined:
    Aug 2, 2017
    Posts:
    1
    xNex, Novack and pokruchin like this.
  48. Elharter

    Elharter

    Joined:
    Sep 20, 2015
    Posts:
    54
    xNex likes this.
unityunity