Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[RELEASED] Projector Simulator

Discussion in 'Assets and Asset Store' started by shwhjw, Nov 28, 2017.

  1. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86


    Hey guys!

    My day job involves working with projectors and it was bugging me that Unity did not really have a good way to visualise a projected image, so I decided to see if I could rectify that. Here is the result!

    Projector Simulator
    allows you to achieve realistic projector effects. Simply drop in the prefab and apply your selected image(s).

    - Project any image (or series of images) in colour
    - Enjoy realistic shadowing true to the light source
    - Fully adjustable lens shift, aspect ratio, lens ratio, brightness
    - Adjustable resolution for optimal performance
    - C# interface to control sequence playback (example included)

    NEW in v1.3:
    - Ability to project video files in real-time
    - Ability to project RenderTextures in real-time

    https://assetstore.unity.com/packages/tools/particles-effects/projector-simulator-86123



     

    Attached Files:

    Last edited: Feb 7, 2019
  2. momo_the_monster

    momo_the_monster

    Joined:
    Sep 3, 2014
    Posts:
    16
    This works mostly great for me. I love the inclusion of real-world specs like shift, keystoning, projector throw etc. But I've found it to be fiddly with colors - I've attached some images to demonstrate.

    In this test scene, I have four projectors with the same content - a 1080p test image. For some reason, they're all showing up as green in my current configuration. If I turn all but one off, then they show up full-color. Sometimes, if I resize the game window just right, they'll show up full-color. Any idea why this is happening?

    Test Image: test-image.jpg
    Good Window Split: projector-scene-vs-game.PNG
    Bad Window Split: projector-scene-vs-game-2.PNG
     
  3. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi Momo,

    Any chance you are using Forward rendering? We have seen issues with strange lighting effects occuring when the Pixel Light Count is set too low - each colour projector adds 3 spotlights to your scene, so the Pixel Light Count (under Quality settings) must be increased to accommodate the new lights. Here we have a brief explanation:

    An alternative solution would be to switch to deferred rendering.

    If this is not the issue, would you be able to share your scene/project?
     
  4. momo_the_monster

    momo_the_monster

    Joined:
    Sep 3, 2014
    Posts:
    16
    Updating the Pixel Light Count to have 3*Number of Projectors in my scene fixed it, thanks! May I suggest adding this to the manual?

    Another 'fix' to the problem was to use separate elements as 'Screens' for the projectors to hit, so that each object only had 3 lights hitting it. In my scene, I have one big room object with 12 lights hitting it with only 3 Pixel Light Count in my Quality settings.
     
  5. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Glad to hear you sorted it. Yes you are right, it should be added to the manual.
     
  6. masterdd

    masterdd

    Joined:
    Jan 23, 2016
    Posts:
    4
    I don't know how fast I can get a response, but I recently downloaded this plug-in, and thought it works fine in the game window the image does not pop up in the preview tab. Any idea why this might be?
     
  7. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi Masterdd, honestly I've not come across this bug before. Can you include some example images? Is there just no projected image in the scene window? Sometimes an issue can occur where the projected image stops responding to the projector controls but this can always be fixed by playing and stopping play in the editor. Which rendering API are you using?

    I'll admit I have not yet tested ProjectorSim with Unity 2018. Can you upload a simple project that exhibits the issue?
     
  8. masterdd

    masterdd

    Joined:
    Jan 23, 2016
    Posts:
    4
    Sorry if I'm a bit confusing frankly I'm a bit new to all of this. Here's both my scene view and game view. I've tried restarting unity and playing and pausing but the projection doesn't show up in the scene view which makes it hard to line. I apologize in advance if I'm missing something extremely obvious, but I don't really understand why it's not showing up. I haven't adjust anything with the rendering API that I know of, so that could be it? Honestly am a bit clueless. Unity_GameView.JPG Unity_SceneView.JPG
     
  9. hjwshw

    hjwshw

    Joined:
    Oct 11, 2018
    Posts:
    2
    Hi Masterdd, this certainly appears to be a bug. Perhaps in the meantime you can use the Game view to align the image, but I have not tested the current release on the more recent versions of Unity. There is an update to be released soon for optimisations, which may help. I will make sure to do testing on your version of Unity.
     
    Last edited: Oct 11, 2018
  10. hjwshw

    hjwshw

    Joined:
    Oct 11, 2018
    Posts:
    2
    Come to think of it, the projectors have spotlights as children, so it is strange that they are not outputting any light in the scene view but they are in the game view. Can you inspect the individual spotlights that are on the projector? I suppose they must be on if you have a output I the Game view... what happens if you turn the spotlights on and off, clear the cookie etc? You might need to uncheck "live" in the projector before doing this to prevent the projector from overriding your changes.

    Could you upload a screenshot of your project's graphics settings + quality settings? Does it work if you switch to/ from deferred rendering?

    Also I've just realised I'm signed into the wrong account on mobile -_-
     
  11. masterdd

    masterdd

    Joined:
    Jan 23, 2016
    Posts:
    4
    Oh all good. I feel like a idiot, but I did what you said to realize all I had to do was hit a lighting button on the scene window from a pop up in the spotlights. Thank you so much for the quick response though this tool is really helpful for me right now and having it work properly makes it 10x easier. Will definitely come back if any issues arise, but thank you a ton for the help!
     
  12. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi Masterdd, I was just making a cup of tea when that thought popped into my head! Rushed here to post it but you've already found the answer. I should have caught it as the rest of your scene window looked very flat. I thought you were testing me!

    Another thing to add to the troubleshooting section of the manual I guess :D
     
  13. david-THEORIZ

    david-THEORIZ

    Joined:
    Feb 7, 2019
    Posts:
    1
    Hey guys, we have the same need at Théoriz, we use professional software computing and simulating brightness on surface, pixel and light density etc.

    The thing is that we do most things in unity and our workflow would be so much better to do everything there.

    Since hdrp is computing light aspects in a physical manner i.e. Lumens etc. It should be easier now to build some nice simulations. Also the video player of unity and some hap unity player on vimeo got really good recently.

    What do you think ? Is this something you consider? Or maybe we can build it together?

    All the best
     
  14. mebinb2

    mebinb2

    Joined:
    Feb 4, 2019
    Posts:
    2
    Hello.. Do you think this asset would work for my project which involves projecting a sprite image onto a spatial mapping mesh obtained from the hololens? Anyone tried this out? Thanks!
     
  15. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi Mebinb2,

    I'm afraid I don't know enough about the Hololens to comment. Projector Simulator uses standard Unity Spotlights to create the projection effect, so you could test to see if your mapping mesh can "catch" light from (several) spotlights first? If you have a red, green, and blue spotlight with the same cookie, does it appear as white light on your mesh?
     
  16. mebinb2

    mebinb2

    Joined:
    Feb 4, 2019
    Posts:
    2
    Thank you shwhjw! I tried to follow your suggestion.. I could not get any any projection using the spotlight on the spatial mapping mesh. I suppose this could because the spatial mapping mesh shaders available from Holotoolkit does not support this. I may have to dig deeper into shaders.. Any other suggestion?
     
  17. dangrover1

    dangrover1

    Joined:
    Oct 22, 2019
    Posts:
    3
    I seem to be running into an issue where none of the projectors seem to be turned on when I build a scene using the projectors. Everything seems to work fine in the editor, but then if I make a build, using for example the testing or ProjectorControl scenes, the projector images do not appear. Do you know why that may be? I have my camera's rendering path set to Deferred if that helps.
     
  18. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi Dangrover1,

    This was a known issue when the new shader method (1.4) was initially released but it was quickly fixed. The cause of that was the shaders used during processing were not being included in the build. Can you confirm that you have 3 shaders located in ProjectorSimulator\Scripts\Resources?

    If you make a development build do you get any error messages showing up?

    It might be worth enabling the "use legacy method" on the projectors which will cause them to fall back to the non-shader approach (although one of the projectors in the test scene should already have this checked), just to see if that suddenly makes it work. If so, it points to an issue with the processing shaders.

    I have just built the test scene with both deferred and forward rendering and it appears to work. Can I ask which version of Unity you are running? Would you be able to share your project folder so I can check your other settings?
     
  19. dangrover1

    dangrover1

    Joined:
    Oct 22, 2019
    Posts:
    3
    Hi shwhjw, thanks for the quick response! After your suggestions, I made a build in development mode and discovered that the shaders were not being included with the build. Afterwards, I have now made sure that they are included and that seems to have fixed the issue. Thank you for the help, sorry that I overlooked something small like this. Thanks again!
     
  20. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi dangrover1,

    Glad you sorted it! I thought I had fixed that issue... Were the shaders in the Resources folder?
     
  21. dangrover1

    dangrover1

    Joined:
    Oct 22, 2019
    Posts:
    3
    For the build, they were not, but if they are included in the Always Included Shaders in the graphics settings, it seems to work without having them in there.
     
  22. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi all,

    Projector Simulator has just been updated to support HDRP (from Unity 2018.3)!

    When you import Projector Simulator in an HDRP project, you will need to unpack the .unitypackage found in the '_HDRP' folder. You should also increase the cookie resolution in the HDRP settings (the video on the store page shows how to do this), otherwise the images will appear blurry.

    As we only use the new Shader method under HDRP, support for keystoning has been removed until we add the functionality to the Shader method. You can still use keystone adjustment with the Legacy method under the Standard renderer.

    Happy projecting!
     
    Last edited: Dec 2, 2019
  23. obyrne

    obyrne

    Joined:
    Jan 23, 2018
    Posts:
    2
    Anyone know if this works with WebGL builds?
     
  24. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi obyrne,

    WebGL is partially supported - the "legacy" processing method works with WebGL as it does not rely on shaders. This means that image processing is slower than the newer shader-based method, so it is not ideal for hundreds of images or more than one or two RenderTextures being projected. Performance will likely vary depending on the hardware of the end-user.

    We have also had comments that video files do not get projected in WebGL after building, but that seems a much deeper issue in Unity/browser security and does not only affect Projector Simulator. It should be possible if properly hosted online, but we don't have the resources to properly investigate. Further detail:
    https://www.reddit.com/r/Unity2D/comments/fjehls/webgl_video_not_working/
    https://blog.kongregate.com/unity-html5-cors-and-you/

    Kind regards,
    WG
     
  25. obyrne

    obyrne

    Joined:
    Jan 23, 2018
    Posts:
    2
    Amazing, thanks for the quick response, just tested it out and works like a charm.
     
    shwhjw likes this.
  26. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi obyrne, we have just updated Projector Simulator with a new shader which should mean that WebGL now supports the faster shader-based processing method.
     
  27. parei

    parei

    Joined:
    Feb 22, 2017
    Posts:
    1
    Hi. I am trying to have 2 Projectors running at the same time, wich project 2 different videos. If I have two Videoprojectors with different Videos attached, they both show the same Video or are Flickering between the two. Do you have a fix for that? Probobly a Script for a second projector, that refers to another VideoSource? I didnt mange to create one myself, because I am a little to new to this. Thanks in advance!
     
  28. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi PaulaRessig, my first thought is, are both projectors projecting the same RenderTexture? Otherwise I can run a test but I'm pretty sure this should be working.
     
  29. SeltsamMitHut

    SeltsamMitHut

    Joined:
    Apr 20, 2021
    Posts:
    1
    Hi, really like your projector simulator! I want to use it for a maze with optical illusions. Is there a way to make a texture projection look completly like its source without the immitation of projector physics, without black getting transparant? I looked in the script but couldnt find anything.... but I m also bloody new to Unity, so perhaps I just overlooked something very obvious. Thanks in advance :)
     
  30. cheryl_l

    cheryl_l

    Joined:
    Aug 28, 2019
    Posts:
    6
    Hello! I think this projector simulator is awesome and I've been trying to use it for a research project, but I'm running into issues where having multiple projectors in a space causes a colour cast to appear in the areas around the projectors. I've attached a screenshot of two projectors and the pinkish cast around them. Is there a setting that can be tweaked to avoid this? Thanks in advance!
     

    Attached Files:

  31. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi cheryl, I think you need to increase the Pixel Light Count in Quality settings. As each projector has 3 Spotlights, you should set it to at least 3x the number of projectors + the number of other realtime lights that are affecting the scene.

    @SeltsamMitHut I'm afraid Projector Simulator isn't cut out for such use - as we use Unity's lighting system we can only add light to a scene and there's no way to project "black" light. Your best bet is a shader of some sort that can project the "illusion" image onto whatever geometry you like, or maybe Unity's in-built "Projector" component can be made to do what you want.
     
  32. cheryl_l

    cheryl_l

    Joined:
    Aug 28, 2019
    Posts:
    6
    Thank you so much! That did the trick! I was also wondering if it's possible to customize the shader used in this asset. I wanted to be able to add custom parameters to change the way the projected image looks.
     
  33. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    The shader code is included under Scripts\Resources, so have at it I guess!
     
  34. cheryl_l

    cheryl_l

    Joined:
    Aug 28, 2019
    Posts:
    6
    I was trying to play around with that shader but none of my changes are reflected in the scene. For example, if I change the fragment shader to return float4(0, 0, 0, 0) in all cases, I'm still able to see the projections normally. Is there another setting that should be changed?
     
  35. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    I just did a test, replacing the last line in the shader "return c[_Channel]" with "return float4(0, 0, 0, 0)" and it caused the shader-based projectors to project only black, so seems to work as expected. If one of your projector's keystone settings are non-zero then it will fall back to the "legacy" CPU processing method and the shader won't be used (as keystoning is not supported by the shader). Does that explain why it's not working for you?
     
  36. cheryl_l

    cheryl_l

    Joined:
    Aug 28, 2019
    Posts:
    6
    I tried to change all the keystone settings to 0 on a mostly-empty scene and it didn't work unfortunately. Thanks for the suggestion though!
     
  37. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hm, only other cause would be if you were using HDRP as the custom shader isn't used for that... but then you wouldn't have the keystone settings, so I'm afraid I'm out of ideas.
     
  38. cheryl_l

    cheryl_l

    Joined:
    Aug 28, 2019
    Posts:
    6
    I played around with it and it looks like it'll only show the changes made in the shader if you save the shader and then replace the image with a different one. I'm not exactly sure why it doesn't update immediately on save, but at least it works now! Thank you for all the help!!
     
  39. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Ah that makes sense. When I was testing I was playing and stopping the scene to cause the shader to be reloaded. Changing the projected image does the same. Glad you got it working!
     
    cheryl_l likes this.
  40. Pryme8

    Pryme8

    Joined:
    Dec 11, 2014
    Posts:
    2
    We bought this package to work with the HDRP rendering pipeline, I followed the setup and we can not get the example scene to project anything.

    upload_2021-7-1_12-52-1.png

    There is this warning:
    upload_2021-7-1_12-52-23.png

    We are running Unity Version 2020.2.5f1

    Any ideas why its not working?
     
  41. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi Pryme8, I just did a test with HDRP in 2020.3.3 and see a similar thing (no warning message though, but that seems to be an issue with Unity as we do not call SendMessage anywhere)...

    After importing the package you have to increase the resolution of the 2D cookie atlas (which you must have done), but I also had to turn the projector brightness up very high to get a visible image. It seems the default value of 1000 is too low, setting the projector brightness to upwards of 1 000 000 should work.

    The reason this is needed is that our HDRP package is built in Unity 2018 with the beta version of HDRP, where the default brightness of 1000 is fine. It is probably time we updated the package to have correct brightness values with the release version of HDRP.
     
    Pryme8 likes this.
  42. Pryme8

    Pryme8

    Joined:
    Dec 11, 2014
    Posts:
    2
    You are a gentleman and a scholar! Perfect!

    Now if I can figure out why the RenderTarget version is not projection anything then Ill be golden!

    *UPDATE* looks to be the same problem, just ramped up more.
     
    Last edited: Jul 2, 2021
    shwhjw likes this.
  43. timschindler

    timschindler

    Joined:
    Nov 4, 2021
    Posts:
    1
    Hey there - this is a really cool asset. Unfortunately i don´t get it running. I expected using it drag and drop like in the video. But in my URP project the projection doesn´t come to light. Is there a special install procedure? Thanks and best
     
  44. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi, unfortunately URP is not yet supported as Projector Simulator relies on spotlight cookies, which URP does not yet support. Only HDRP and the standard renderer are currently supported.
     
    timschindler likes this.
  45. MrFinlayW

    MrFinlayW

    Joined:
    Jan 11, 2016
    Posts:
    2
    Hi Shwhjw, could you help me figure out if this asset may be useful for my project? I'm looking to develop a tool for testing projections onto a real place. I have the model re-topologized from lidar + photogrammetry, and would like to test different video sources going onto the target. The difficult part is, we would like to do this on a Quest 2 (on the legacy rendering system is fine). Will your asset work on the Quest 2?

    Secondly we would like to best replicate specific projectors, does your asset allow us to input a lumen value for example?

    Many thanks,

    Finlay
     
  46. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi, you can use Projector Simulator to replicate the light path of a real projector if you know the specific throw ratio and lens shift amount you are able to use. We use Unity's lighting system so as long as your model can be lit with standard Unity lights then you should be able to light it up with a projector.

    I haven't tested with the Quest myself, but am aware of another user who was using it successfully (may have been Quest 1 not Quest 2).

    There is no translation from lumens to Unity's light units in the standard renderer that I am aware of. HDRP lights do use lumens as their intensity unit, but as we are only using a subsection of a spotlight (blacking out park of the spotlight to simulate lens shift) the input lumens do not equal the output lumens, with the difference getting larger as you add more lens shift. Maybe this is something we can calculate and correct for in the next version. I'm not sure how accurately Unity simulates lumens though, as perceived projector brightness also relies on other things like ambient light and camera exposure in HDRP.
     
  47. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    I just tested with HDRP and it seems like Projector Simulator does already correct for the intensity differences caused by lens shift, aspect ratio etc, but you need to enable the "spot reflector" via script for it to work correctly (later versions of HDRP do not expose it in the Inspector). To do this, edit the function SetLumens() in CookieCreator to look like this:
    upload_2022-4-4_22-48-54.png

    This change will be applied automatically in an update shortly.
     
  48. Godheritage

    Godheritage

    Joined:
    Aug 16, 2021
    Posts:
    2
    Hi! shwhjw, I really love this projector! But I met a problem, I created a render texture projector, and it works fine in editor, objects can eassily occlude light, but in build version, object can not occlude light, I wonder why, thanks!
    editor:
    upload_2022-5-31_16-47-56.png
    build:
    upload_2022-5-31_16-49-38.png
     
  49. shwhjw

    shwhjw

    Joined:
    Mar 15, 2016
    Posts:
    86
    Hi Godheritage, can you check which quality setting the build is using? Perhaps the editor uses a high graphics preset and the build is using a lower one with shadows turned off or different lighting settings?
     
  50. Godheritage

    Godheritage

    Joined:
    Aug 16, 2021
    Posts:
    2
    haha, you are like a prophet! I forgot to change my build quality, thank you!!!;)
     
    shwhjw likes this.