Currently, this asset doesn’t work on Unity 5.6 (as of Unity 5.6.2p2). Please use another version of Unity (Unity 5.5 or Unity 2017)

This simple Unity asset provides a few components to render a shadow onto a render texture so that the render texture can be used with Blob Shadow Projector. Blob Shadow Projector is usually used for dropping a round blurry shadow which is not suitable for a skinned mesh object. This asset enables a projector to drop a dynamic shadow which is perfect for skinned mesh objects.

Below images are examples of shadows generated with this asset. As shown in these images, this asset can generate various shadows such as a hard shadow (left), a soft shadow (center), and a blob shadow (right).
hardshadow softshadow blobshadow

This asset can be a good alternative of shadowmap for mobile platform, because it doesn’t require depth textures, and it works on almost all devices. However, Blob Shadow Projector can be very slow on mobile platform. If you are satisfied with the quality of the shadows but not satisfied with the performance, please try our another asset, Fast Shadow Receiver. It really improves the performance of Blob Shadow Projector.

Documents

Links

69 thoughts on “Dynamic Shadow Projector

  • 2015/04/24 at 3:45 AM
    Permalink

    Is Dynamic Shadow Projector part of the Fast Shadow Receiver plugin, or is it a separate plugin? When will it be available?

    Also, does the Dynamic Shadow Projector support multi-shadow casting from multi-directional lights in the scene? This would be a huge plus and make the asset extremely valuable.

    Reply
    • 2015/04/24 at 11:05 AM
      Permalink

      Thank you for the comment.

      Dynamic Shadow Projector is a separate plugin, but it will be free. I will submit this asset this weekend. I hope it will be on Asset Store in a week.

      It is possible to cast multi-shadow, you will need a projector for each directional light.

      Reply
  • 2015/04/25 at 2:34 AM
    Permalink

    Thank you for the information. I’m looking forward to using it. Will we be able to combine this with Fast Shadow Receiver, or are they used separately?

    Reply
    • 2015/04/25 at 2:44 PM
      Permalink

      Yes, it is recommended to combine this asset with Fast Shadow Receiver. In fact, I made this asset for promoting Fast Shadow Receiver 😉

      Reply
  • 2015/05/05 at 6:30 AM
    Permalink

    Any updates on how development of this plugin is going? 🙂

    Reply
    • 2015/05/05 at 12:48 PM
      Permalink

      I already submitted this asset but it is still pending for review. Also I found a little bit severe bug. I don’t know if it affects the review or not. I am waiting for a response from Unity 🙁

      Reply
      • 2015/05/06 at 1:43 AM
        Permalink

        No problem. That’s great to hear it’s going live soon. All the best. 🙂

        Reply
        • 2015/05/08 at 10:16 AM
          Permalink

          It is now on Asset Store! Thanks for waiting for long time.
          But it still have a bug (a memory leak). I will update the asset soon.

          Reply
          • 2017/06/19 at 6:02 PM
            Permalink

            I assume the memory leak was fixed some time ago?

          • 2017/06/20 at 6:27 PM
            Permalink

            Yes, it was fixed in version 1.0.1.

  • 2015/06/10 at 7:16 PM
    Permalink

    Hi, I’m trying to make car headlights shadows, but when i set up everything I get sharp shadow at projectors borders. How can I get the borders soft like the rest of the shadows? I wanna buy the Receiver but I have to be sure that it works as I want.

    Reply
    • 2015/06/11 at 3:41 AM
      Permalink

      Hi, thank you for using my asset! Are you using SpotlightWithShadow shader for your headlights shadows, like Spotlight sample? If you want to make the shadows softer, please try to make the light cookie texture more blurry. Then, the borders will look more natural.

      Reply
  • 2015/09/15 at 11:06 AM
    Permalink

    Hello, if I add your projector to a mesh, the tris count doubles. Is there any way to minimize this number for mobile?

    Reply
    • 2015/09/15 at 12:31 PM
      Permalink

      A projector acts like a camera. So, if you add a projector into your scene, that means you add a special camera into your scene. It will increase the actual count of tris, but it seems like the tris count displayed in the stats window does not count the triangles drawn by a projector. So, I guess the reason why the tris count doubled is you have a hipoly character and tris count for rendering shadow texture doubled the tris count. It is inevitable if you want to have a dynamic shadow. Using shadowmap will also double tris count. If you want to reduce it, please consider using a low-poly character for the shadow.

      Reply
  • 2015/10/01 at 9:47 PM
    Permalink

    Hi!
    first, thank you very much for creating this plugin! it is exactly what i have been looking for and works great! Thanks!

    at the moment i am facing one problem: i have a plane in the scene which is the shadowreceiver and it uses the “light with linear fallof” shader. when i create another plane underneath of my shadowreceiverplane and assign a Unlint/Transparent shader to this second plane, the shadowreceiverplane gets invisible.
    i tried already pretty much, but it is always the same, when the second plane unterneath get a shader with transparency.

    can you help me out here or give me a hint how to solve that problem?
    i would appreciate your help! thanks!! 🙂

    Reply
    • 2015/10/01 at 11:29 PM
      Permalink

      Hi, thank you for your feedback.
      The default render queue value of the “light with linear falloff” is “Transparent-1”. That means shadowreceiverplane will be drawn after all the opaque polygons are rendered, and before any of transparent polygons are going to be rendered. Also, it doesn’t write z value on depth buffer. So, it is easily overdrawn by transparent polygons. I guess, that is the reason of your problem. To solve the problem, you can change the render queue value of the material.
      Please try material.renderQueue = 3000; 3000 means “Transparent”.
      http://docs.unity3d.com/ScriptReference/Material-renderQueue.html

      Reply
    • 2015/10/01 at 11:33 PM
      Permalink

      hi, i solved the problem. had to change the transparent shader. (Queue to Geometry and RenderType to Opaque)

      🙂

      Reply
  • 2016/02/28 at 2:50 PM
    Permalink

    The basic demo runs but with the following errors. It won’t do a build.

    “RenderTexture.Create failed: format unsupported.
    UnityEngine.RenderTexture:GetDepthBuffer(RenderBuffer&)
    UnityEngine.RenderTexture:get_depthBuffer() (at C:\buildslave\unity\build\artifacts\generated\common\runtime\TextureBindings.gen.cs:911)
    UnityEngine.Graphics:SetRenderTargetImpl(RenderTexture, Int32, CubemapFace) (at C:\buildslave\unity\build\Runtime\Export\Graphics.cs:186)
    UnityEngine.Graphics:SetRenderTarget(RenderTexture) (at C:\buildslave\unity\build\Runtime\Export\Graphics.cs:201)
    DynamicShadowProjector.ShadowTextureRenderer:OnPostRender() (at Assets\DynamicShadowProjector\Scripts\ShadowTextureRenderer.cs:871)
    UnityEngine.Camera:Render()
    DynamicShadowProjector.ShadowTextureRenderer:Update() (at Assets\DynamicShadowProjector\Scripts\ShadowTextureRenderer.cs:575)”

    Help please.

    Reply
    • 2016/02/29 at 1:25 AM
      Permalink

      Thanks for the feedback.
      Could you tell me about your environment (OS, target platform, Unity Version, etc.)? I can’t reproduce the problem.

      Reply
  • 2016/04/15 at 3:52 PM
    Permalink

    I follow the tutorial to setup shadow projector.
    But after I add “Draw Target Object” script and try to assign the material into projector, Unity crashes. (100%)

    My environment :
    OS is PC, Win 7
    Unity version is 5.3.3f1

    Reply
    • 2016/04/18 at 11:49 AM
      Permalink

      Can you try to change Multi Sampling to “x1”? Another person reported me that Multi Sampling caused a crash on a specific device before. Please let me know if it works or not.

      Reply
      • 2016/04/18 at 6:07 PM
        Permalink

        Thanks for your reply.
        I’ve tried to change Multi Sampling to “x1″ but Unity still crashes.

        Reply
        • 2016/04/19 at 5:08 PM
          Permalink

          Maybe you miss a camera in the Scene!

          Reply
          • 2016/04/20 at 10:28 AM
            Permalink

            Yes! I don’t have camera in my scene hierarchy (Due to some reason, I create camera at run time).
            After I put camera in scene hierarchy, everything works fine. Thanks a lot!

            May I consult a question? If I have 2 models, model A & model B project their shadows on floor. But some part of model A is cover on model B, can I project model A’s shadow on model B too ? How to do it?

            Thanks.

          • 2016/04/20 at 3:01 PM
            Permalink

            Hi Iceman, thanks for the information! Yesterday, I could not reproduce the crash, but somehow, I could get the crash today. I sent a bug report to Unity already.

            Hi Kidd, you might need to use different layers for object A and B, and only the layer of A should be ignored by the projector of A.

        • 2016/04/19 at 6:01 PM
          Permalink

          Whatever you (and I) did, Unity should not crash. Try the latest version of Unity, and if it still crashes, please send a bug report to Unity. I cannot reproduce the crash on my PC.
          Thanks

          Reply
        • 2016/04/19 at 7:11 PM
          Permalink

          By the way, can you open and play a sample scene? Also, try another shader for the material.

          Reply
  • 2016/06/27 at 4:16 AM
    Permalink

    Hi Nyahoon,

    Really liking the projector, but I am running into one problem. When I put the shadow caster onto my character and stand close to a wall, I see an inverse shadow going in the opposite direction on that wall.

    See this for example: http://starvingeyes.com/temp/shadowProjectorProblem3.jpg

    I have discovered that turning off HDR on my main camera fixes this, however, I definitely need HDR in my game. It seems that the ortho camera attached to the shadow caster when partially inside a wall creates this strange effect. Is there any trick to fixing this? I’ve fiddle around with the settings a lot and cannot find a simple solution.

    If this does not work, would getting the fast shadow receiver prevent this problem?

    Thank you very much,
    Jason

    Reply
    • 2016/06/27 at 12:47 PM
      Permalink

      Hi Jason,

      Thank you for using our asset and letting me know about the problem. I had not considered about floating point render target. Maybe I need to fix my projector shaders. Can you try the following fix?

      In DynamicShadowProjector/Shaders/Projector/DSPProjector.cginc, there is a function named “DSPGetShadowAlpha”. Please change this function as follows (add one more “saturate”):

      I hope it can fix the problem. Also, it might be better to push the near clip plane of the shadow projector up to the feet of the character.

      Reply
      • 2016/06/27 at 7:44 PM
        Permalink

        Excellent! Thank you. Yes, it worked. Great response time also! Loving the way this is working!

        Reply
  • 2016/09/05 at 10:35 AM
    Permalink

    Hi, due to the nature of my game I do not wish to use the lighting system on my character, so I was very happy to have found this asset, however, when I went to add in NPC characters I discovered that simply duplicating the projector and changing the target does not work the way one would expect. Rather than being separate, it seems like all the projectors are linked somehow? Is there a way to fix this so that my NPC characters can also have dynamic shadows?

    Reply
    • 2016/09/05 at 11:25 AM
      Permalink

      This is because you are using a same material for all the characters. As a result, all the characters share the same render texture. This problem will not happen when you run the scene, because the material will be duplicated at runtime. If you want to fix this problem in Editor, please duplicate the material for each character.

      Reply
  • 2016/12/07 at 8:52 AM
    Permalink

    Hi Nyahoon,

    The projector has been working great until I updated from 5.3.3 to 5.5.

    In my project I get:

    NullReferenceException: Object reference not set to an instance of an object
    DynamicShadowProjector.DrawTargetObject.AddDrawCommand (UnityEngine.Renderer renderer, Int32 renderTypeIndex) (at Assets/DynamicShadowProjector/Scripts/DrawTargetObject.cs:308)
    DynamicShadowProjector.DrawTargetObject.UpdateCommandBuffer () (at Assets/DynamicShadowProjector/Scripts/DrawTargetObject.cs:136)
    DynamicShadowProjector.DrawTargetObject.OnPreCull () (at Assets/DynamicShadowProjector/Scripts/DrawTargetObject.cs:259)

    When I create a fresh project and try to use the tutorial scene, I get a lot of:

    RenderTexture.Create failed: format unsupported – 5.
    UnityEngine.Camera:Render()
    DynamicShadowProjector.ShadowTextureRenderer:Update() (at Assets/DynamicShadowProjector/Scripts/ShadowTextureRenderer.cs:586)

    any guidance or help here? This is pretty important to my project and I don’t want to ditch this projector. I see you recently updated, but the package is using Unity 5.0.1.

    Thanks,
    Jason

    Reply
    • 2016/12/07 at 9:59 AM
      Permalink

      I think I figured out the problem. You have to make the draw target the skin of your animated character and not have it be targeted to the shell (like before). The second error in the tutorial can be eliminated by turning off the blob shadow sample. Not sure what that’s all about. Thanks, sorry for clogging up your boards with this.

      Reply
      • 2016/12/08 at 8:46 AM
        Permalink

        Hi, thank you for telling us about the problems, but I couldn’t reproduce them so far.

        Does the shell object have any invalid renderers? The first error means there was a renderer that has a null material or a null shader in the shell object or in its children.

        Reply
  • 2016/12/20 at 9:53 AM
    Permalink

    Hi!

    I got this Volumetric Light script that uses the built in shadow. It won’t work unless I have the Light Shadow set to either Hard or Soft. Is there a way to edit the shadow from the Light object instead of the one from the projector?

    Amazing asset by the way!

    Reply
    • 2016/12/20 at 12:43 PM
      Permalink

      Hi Carl,

      Thank you for using our asset! This asset uses a projector to cast a shadow, not a light, so built in shadow must be turned off. If you cannot see any shadow unless you set either Hard or Soft to Light Shadow, that means something was wrong with the projector setup. Please check if the projector has a right material.

      Reply
  • 2016/12/21 at 12:28 AM
    Permalink

    Hello,

    First of all I want to thank you for the complex and very useful asset, but I seem to have a single issue. If there is something placed between the projector and the shadow casting object, that thing gets shadowed. Is there a way to avoid that? Does your paid plugin handle such situations?

    Reply
    • 2016/12/21 at 11:30 AM
      Permalink

      Hi Teshla,

      Thanks for the comment. That is a common problem of a projector. You can set a larger value to the near clip plane of the projector. This value is not used for the shadow texture rendering, so the shadow casting object does not need to be entirely covered by the near clip plane.

      Reply
  • 2017/03/10 at 2:36 AM
    Permalink

    Hi Nyahoon Team,

    Does Dynamic Shadow Projector work with iOS?
    Sorry I was trying to find information but I couldn’t see anything.

    Regards

    Gareth

    Reply
    • 2017/03/10 at 11:05 AM
      Permalink

      Yes, it should work on any platform. Do you have any problems?

      Reply
      • 2017/03/11 at 8:56 PM
        Permalink

        Yes. The shadows work on Android but they are not visible in iOS. Do you think it may be something in my build settings I need to look at?

        Reply
        • 2017/03/11 at 11:31 PM
          Permalink

          Which shader do you use for your projector? Mipmapped shadow shader will not work on some devices. However, as far as I know, it should work on iOS devices.

          Reply
  • 2017/04/09 at 4:15 AM
    Permalink

    it works like a charm, but I get this errors in the console:

    Rendering camera ‘BlobShadowProjector’, but calling code does not set it up as current camera (current camera: ‘Main Camera’)
    Rendering camera ‘SoftShadowProjector’, but calling code does not set it up as current camera (current camera: ‘BlobShadowProjector’)
    Rendering camera ‘HardShadowProjector’, but calling code does not set it up as current camera (current camera: ‘BlobShadowProjector’)

    Unity 5.6.0f3

    Reply
    • 2017/04/09 at 4:12 PM
      Permalink

      Please ignore those error messages. You will get those errors only in edit mode. ShadowTextureRenderer calls Camera.Render function to render shadow textures in edit mode, but in game mode, the camera renders shadow textures normally and Camera.Render is never called. It seems like the error message is always shown when Camera.Render is called in Unity 5.6.

      Reply
      • 2017/04/09 at 6:29 PM
        Permalink

        Thank you for the quick response this great asset!

        Reply
  • 2017/05/21 at 3:50 PM
    Permalink

    Thank you for all of this, it help me to achieve the desired effect, but there is something wrong with Unity5.6.1

    Reply
    • 2017/05/22 at 6:19 PM
      Permalink

      Thank you for the bug report. I will investigate this problem.

      Reply
  • 2017/05/21 at 6:08 PM
    Permalink

    Hi,

    I’m really enjoying your Dynamic Shadow Projector, but I’m having some issue after upgrading to Unity 5.6.1. All my shadows are now just black squares. Just thought I would let you know in case no one has reported it yet.

    Reply
    • 2017/05/22 at 6:21 PM
      Permalink

      Thank you for your bug report. I will investigate this problem.

      Reply
  • 2017/05/24 at 5:22 PM
    Permalink

    Hi,
    I have the same bug using Unity 5.6.
    Have you managed to solve it?

    Thanks a lot for your help!

    Reply
    • 2017/05/24 at 6:14 PM
      Permalink

      No. Please use Unity 5.6.0 or lower for now. I already sent a bug report to Unity.

      Reply
      • 2017/05/24 at 6:39 PM
        Permalink

        I’m using already Unity 5.6.0, the bug happens in this version too… i’ll have to come back to 5.5

        Thanks a lot again

        Reply
        • 2017/05/25 at 11:03 AM
          Permalink

          Which version of the asset are you using? Version 1.0.6 has workarounds for Unity 5.6 bugs.

          Reply
          • 2017/05/26 at 9:53 PM
            Permalink

            I’ve just upgraded to the latest version but am still getting the same issues as the previous. Perhaps there was a mistake with the .unitypackage upload or something?

            I’m using Unity 5.6.0p4.

          • 2017/05/27 at 12:00 PM
            Permalink

            I confirmed that Unity 5.6.0f3 doesn’t have the issue.

          • 2017/05/27 at 11:09 PM
            Permalink

            Actually, Unity 5.6.0p4 had the same issue. This bug must be introduced at this version.

  • 2017/05/28 at 3:20 AM
    Permalink

    That’s odd, I was getting these issues with the Unity 5.6 beta as well a few months back. Odd that 5.6.0f3 would be OK whereas p4 isn’t :/ Maybe they took something out of the beta for the initial release that went back in with a patch.

    Reply
    • 2017/05/28 at 7:37 PM
      Permalink

      This issue is very similar to the bug of Unity 5.6 beta, but different one. The workaround I added no longer works for this issue.

      Reply
    • 2017/06/08 at 12:08 PM
      Permalink

      You mean overlapping shadows? That is also a common problem of Unity’s projector, and handling this problem is beyond the scope of this free asset. From Unity 5.6, shadow mask is available, and if you can use it in projector’s shader, you might be able to handle this problem. However, it is a bit complicate. You will need to duplicate a projector for each static shadow receiver so that the projector’s shader can read a baked shadow mask texture.

      Reply
  • 2017/07/20 at 11:53 AM
    Permalink

    For some reason the shadow textures don’t seem to update when the object rotates.
    Even in the demo scenes…
    Any ideas as to why?

    Reply
    • 2017/07/20 at 7:42 PM
      Permalink

      In version 1.0.6, shadow textures are not updated automatically. Please select the shadow projector object in Hierarchy view to update the texture. I will fix this problem in the next version.

      Reply
  • 2017/08/11 at 3:14 PM
    Permalink

    Hi there!

    I really appreciate this asset you’ve created and the work you’ve put into it (and the fact that it’s free). Any idea when you might release the next update? Unfortunately in Unity 5.6.1 it’s broken for me 🙁

    Thanks again and I look forward to crediting you in my game once it comes out someday 🙂

    Reply
    • 2017/08/11 at 8:07 PM
      Permalink

      Thank you for your comment. Actually, this asset has a problem in Unity 5.6.1, and we couldn’t find any workarounds so far. We believe this is a Unity’s bug, and we sent a bug report already. Please use Unity 5.5 or Unity 2017 for now.

      Reply

Leave a Reply

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

Anti Spam Code *