Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  4. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Photo realistic indoor lights - IES importer

Discussion in 'Assets and Asset Store' started by Thomas-Mountainborn, May 24, 2016.

  1. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Ever looked at your indoor lighting and wondered why it looked video game-y, in spite of global illumination and physically based rendering? This is because Unity renders points lights as a perfect sphere, but real life lighting is far from this perfection. Take a look at a wall or ceiling being shone upon by a light right now, and notice the irregular pattern created by the bulb and fixture.

    The cure for this, you ask? IES lights. IES stands for " Illuminating Engineering Society", a century old American organization that created a standard for sharing photometry in the eighties. Real life light output from lamps is measured, and stored in the .ies file format. IES files have become common place in CG to get the most lifelike lighting possible, both in pre-rendered visuals and in real time. Unreal Engine supports them natively, for instance - Unity does not.

    Unity does support point and spotlight cookies out of the box however, and this is all it takes to increase the fidelity of your indoor scenes.



    The asset allows you to import entire folder hierarchies of .ies files with a single click in the editor, giving you an instant library of realistic point and spotlight cookies to work with. IES files are widely available, free of charge and limitations, since lamp manufacturers have to provide them anyway. The asset comes bundled with 60 point and spotlight cookies to get you started, and the documentation shows you how to go about getting more.

    Get it here! Now with spotlight support!

    Note: Unity does not yet support baked light cookies (and I have no idea if this is something that will happen in the future, though I sure hope it will). This means that the lights have to be in real time, in turn enforcing the need for deferred rendering. If your project requires forward rendering, you should be aware of the cost of real time point and spotlights and the limited simultaneous amount it allows.

    What makes this asset the ideal way of getting .ies data into Unity?
    • It gives a perfect match of the photometry, with the full 360 degree asymmetry of the lamp preserved.
    • Creates spotlight cookies whenever possible, making the best possible use of your performance budget.
    • Imports the files as cubemaps and 2D textures, which can easily be shared within and across projects, and implemented without any hassle.
    • Entire folder hierarchies can be imported at once, with a single click, getting you right back into level design instead of having to fuss about with any other way of importing.
    • Has a unique "enhanced import" mode, for really bringing out the beauty of artificial lighting.
    • Imports any kind of .ies file, tested with over ten thousand files from various manufacturers.
    • Cheapest asset of its kind on the store.
    Who would benefit from this asset?

    Anyone with a scene being lit by point and spotlights, really. Architectural visualizations can benefit from this especially, but all projects look better with photometry based lighting. There is a reason why AAA games have been using it for some time now.

    If you want to read more about the asset and the IES format in general, you can head to the asset's site here. If you have any questions, feel free to direct them to me in any way you see fit. I hope you will come to appreciate the beauty of artificial lighting in the way that I have during the development of this asset.


     

    Attached Files:

    Last edited: Mar 5, 2017
    Mauri, elias_t and Gozdek like this.
  2. Gozdek

    Gozdek

    Joined:
    Jun 21, 2015
    Posts:
    356
  3. elias_t

    elias_t

    Joined:
    Sep 17, 2010
    Posts:
    1,091
    Hi Thomas.

    One question. Can this asset import ies lights at runtime?
     
  4. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Hey Elias. Currently it doesn't, as I didn't see an immediate use for it. However, I can definitely add this functionality if this is something you require.
     
  5. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    84
    Will these work for spotlights as well?
     
  6. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    No, they're for point lights only - the .ies data is always measured in a full sphere around a light source. Point lights can be made to look like spot lights though, based on where light is shining, but it's true that there are some gains to be had from using actual spot lights. I'll get to work on supporting them.
     
  7. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    84
    @Thomas Mountainborn cheers I'd be an instant purchase with spotlight support, using point lights as spotlights is a bit too much of a performance concern
     
    Thomas-Mountainborn likes this.
  8. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Good news, everyone! (and @popMark especially) The asset can now create spot light cookies. There's still some finishing touches required before I push the update to the store, but I've attached a couple of samples to whet your collective appetites.

     

    Attached Files:

    popMark and gurayg like this.
  9. garyhaus

    garyhaus

    Joined:
    Dec 16, 2006
    Posts:
    590
    Looking forward to the spotlight support with GREAT anticipation.

    Thanks!
     
    Thomas-Mountainborn likes this.
  10. popMark

    popMark

    Joined:
    Apr 14, 2013
    Posts:
    84
    Awesome stuff! just bought it in anticipation
     
    Thomas-Mountainborn likes this.
  11. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Alright, I've returned from vacation, and the update is ready to hit the store! I've included a whole bunch of new samples of both spotlight and point light cookies. Normally the update will appear in the coming days. It will also set the asset to its final price of $25, so if you're still on the fence about your purchase, I'd say get it while the gettin's good.
     
    popMark likes this.
  12. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Aaaand we're live! When you now import .ies files after updating to 1.1, the asset will automatically create spotlight cookies whenever possible. Using spotlights instead of point lights is less expensive performance wise, so I recommend reimporting any .ies files which are only shining light in one half of the cubemap. There are now 55 cookies (21 point light and 34 spotlight), almost all of them new ones. I have attached 4 new samples to the original post.

    The old sample folders have been deprecated, having been replaced with a "point lights" and "spotlights" sample folder. Point light cookies of the old system which actually should be point light cookies have been kept, but moved and renamed - if you already have them in your project however, Unity will keep them in the old folder under the old name, so don't be surprised if you see some missing numbers in the point light samples folder.
     
    Last edited: Jul 28, 2016
  13. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    So how's everyone enjoying spotlight support? I'd love to see some screenshots of your IES cookies in action!
     
  14. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    A couple of months ago, I was approached by a customer who had trouble importing some .ies files - turns out they contained automotive photometry, which has a very different format to architectural IES measurements. I updated the asset to parse this type of data, and worked closely with the customer over these past months to get the most accurate result possible in Unity. The asset now contains 5 automotive samples, courtesy of the customer. Automotive imports are prefixed with [FOV <x>], showing you the field of view the light shines at in reality, so you can adjust your in-game lights accordingly.

    In the process of trying to achieve the most life like replica of the lights, I decided it would be best to give full control over the imported cookie to the user. A new raw HDR import is now part of the 1.2 release, which imports the data as an .exr, preserving full 32 bit precision of all measurements. The HDR import works for both point and spotlights, but unlike regular imports where spotlight cookies are vignetted and prepped for immediate use within the editor, these raw imports will need to be processed by you. In return, you can create very highly detailed cookies by tonemapping the HDR data in an image editing program like Photoshop. Attached there two automotive imports - one with regular import settings, and one HDR image manually tonemapped.
     

    Attached Files:

  15. SAOTA

    SAOTA

    Joined:
    Feb 9, 2015
    Posts:
    220
    I'd love to give this a try, perhaps make some promo material?
     
  16. Mraklen

    Mraklen

    Joined:
    Jun 6, 2017
    Posts:
    3
    Hi Thomas!

    Can this asset import ies lights at runtime?
     
  17. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Hi Mraklen! The asset is meant as an editor-time importer so I haven't yet tested it, but it should be possible. Since the main processing is done by a shader, there shouldn't be much of a performance spike either. I'll do some testing and I'll let you know.

    Can I ask what kind of application you need runtime ies imports for? I'm kind of curious.
     
    SAOTA likes this.
  18. Mraklen

    Mraklen

    Joined:
    Jun 6, 2017
    Posts:
    3
    Thank you, Thomas. I'm going to expect results!

    A program where everything is loaded in real time. Models, textures, lighting. This is required by the customer.
     
  19. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Alright, I've created a helper class with static methods to give easy access to ies importing at runtime. I'll do some more testing, and submit it to the asset store this week. I'll keep you posted!
     
    Mraklen likes this.
  20. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Alright @Mraklen, I just submitted 1.2.5 to the asset store. It will be online in the coming days.
     
    Mraklen likes this.
  21. Mraklen

    Mraklen

    Joined:
    Jun 6, 2017
    Posts:
    3
    Thank you so much! You really helped me out!!!
     
    Thomas-Mountainborn likes this.
  22. SamAB

    SamAB

    Joined:
    Feb 12, 2015
    Posts:
    6
    Hi @Thomas-Mountainborn, I required IES Files importing from FBX files to do architectural VR. We deal with thousands of IES lights. We use Revit specifically, like much of the architecture industry does. Revit has point, linear,square and spherical light shapes. It also supports color temperature and lumen value.

    Please let me know if you have any questions, I'm a Revit lighting nerd. I would love to see this implemented so that I can render all my lighting in Octane Render inside unity :D
     
  23. SamAB

    SamAB

    Joined:
    Feb 12, 2015
    Posts:
    6
  24. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    118
    After importing i get 2 error
    IESWizard.cs error CS1502P the best overloaded method match for 'miniext.miniexr.miniexrwrite(uint, uint, uint, float[])' has some invalid arguments
    and
    CS1503 Argument #1 cannot convert string expression to type uint

    what's the fix ?

    inside visual studio I get line 171 cannot convert string to uint and cannot convert from uint to bool in IESWizward.cs
     
    Last edited: Jan 31, 2018
  25. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    That's very strange, I have no idea why you would get an error like that. MiniEXR is from the Unity wiki, I've attached the script to this post. Can you try replacing IES/Scripts/MiniEXR.cs with the attached one?

    And did you make any changes to the code yourself in trying to fix it?
     

    Attached Files:

    Last edited: Jan 31, 2018
  26. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    118
    It was freshly imported, it came with error, i tried to fix it myself, but I was out of luck, the error don't seem to make any sens. I did a reimport and replace the miniEXR.cs file with the one you posted and it return the same error. The error show up in IESWizward.cs file, maybe you can post me a working version of that script and i'll try to replace that one. (Or send it by email so that non-client have access to it lol). I can email you my invoice if needed.

    it's really sad to have this asset and not even being able to test it out. I remember wishing for IES for archviz in unity back in the unity 4 days and today's i can really benefit from it and unfortunately it doesn't work. I'm on 2017.3.0f3

    inside visual studio the error is a bit different. It say cannot conver from string to uint and cannot convert from uint to bool at line 171. I don't even know what a uint is...
     
  27. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    The error is that the call for the MiniEXR function from IESWizard is supplying incorrect parameters, which can only happen if the code is changed - the asset definitely works in all 2017 versions, so it's very strange that in your case a fresh import of the asset creates this error. Can you PM me your version of IESWizard.cs so I can take a look?
     
  28. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    118
    it'S done
     
  29. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    The file is just as it should be - I am baffled. When I import it into the asset's project, I get no errors. I've attached an updated version of MiniEXR.cs, with all overloads except the one used by me set to private, so your Unity can't be confused about which overload to use.
     

    Attached Files:

  30. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    118
    changing function to private doesn't change anything. Not so sure that having all those different function sharing the same name was the best approach. This is why it is confuse, it try to reach the wrong function that require other parameter. Anyway, to remove the error i have change line 171 in IESWizard to include the bool it was looking for so it become

    MiniEXR.MiniEXR.MiniEXRWrite(targetFilename, exrData.Width, exrData.Height, false, exrData.Pixels, false);

    i'm not really sure if they should be true or false, but since they reffer to export alpha and flipvertical i set them to false but didn't test importing new IES file. That said, creating a cookie out of a IES isn't black science neither so i'm kind of disapointed by the whole asset anyway. Asset should be call light cookie creator and in the feature list it should mention IES support. That would be a more honest description
     
  31. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Overloads (functions sharing the same name but different parameters) aren't a bad approach, they are standard in programming. MiniEXR was created by one of the creators of Unity, Aras Pranckevicius - he knows what he's doing.

    I'm confused by the fix you propose. The only overload which I have left accessible is this one:

    Code (csharp):
    1. public static void MiniEXRWrite(string _filePath, uint _width, uint _height, Color[] _colorArray)
    There is no bool that goes at the end. In fact, there isn't any overload which takes a bool. These are all the MiniEXRWrite overloads in the MiniEXR.cs which is in the asset:

    Code (csharp):
    1. public static void MiniEXRWrite(string _filePath, uint _width, uint _height, Color[] _colorArray)
    2. public static void MiniEXRWrite(string _filePath, uint _width, uint _height, uint _channels, float[] _rgbaArray)
    3. public static byte[] MiniEXRWrite(uint _width, uint _height, Color[] _colorArray)
    4. public static byte[] MiniEXRWrite(uint _width, uint _height, uint _channels, float[] _rgbaArray)
    None of them take any booleans at all. Do you perhaps have another copy of MiniEXR in your project? There is clearly something going on, because the function header you pasted does not exist in the asset.

    As for you being disappointed: the asset says exactly what it does. There are no other ways of getting both point and spot light cookies from IES files into Unity. The asset has helped many professionals to get far nicer lighting, or use the import functionality to visualize actual automotive lighting, for instance. I'm not sure what else you were hoping to find, because nothing else was ever promised. This is the second sentence in the asset description:

    If that is not what you are looking for, I'm sorry to hear that. You can request a refund through the asset store.
     
    Last edited: Feb 4, 2018
  32. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    118
    Well as I said, the fix work for me and remove all confusion out of unity. No more errors. Don't ask me why, maybe another asset is creating incompatibility. As I said it's working, but I was hoping a bit more than just a cookie creator. I was expecting that the information would be treated with physically based algorithm, not just as projection map. I can create cookie myself. I don't ask refund, it's working and i'm not complaining to get a refund, i'm sharing my experience, opinion. It's just that I was expecting more. And fighting against errors that nobody, including me, doesn't understand is a bit too much right now :O)

    bool are for _ExportAlpha and bFlipVertical (reported by VisualStudio).
     
    Last edited: Feb 5, 2018
  33. nvf33

    nvf33

    Joined:
    Aug 8, 2015
    Posts:
    5
    Hi Thomas,
    when creating spot light cookies out of ies files with your nice plugin, I wonder which spotlight angle I need to use in unity to match the ies angle characteristics. In the ies data they are precisely defined on the sphere, so as far as I understand there must be some relation between the spotlight angle and the ies angles.
    Any hint would be appreciated!
    Regards
    nvf33
     
    Last edited: Feb 6, 2018
  34. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    For automotive spotlight imports, I prefix the correct field of view to the file name. I didn't do this for regular lights, since I figured most people just wanted to get their lights to look nicer. I can patch this in though, so architectural lights also have their actual FOV prefixed in the file name. I might not be able to do so until next week however, I'm leaving on holiday this night.
     
  35. nvf33

    nvf33

    Joined:
    Aug 8, 2015
    Posts:
    5
    Hi Thomas,
    thank you for your reply. I'd be fine with you telling me where in the script this angle is available for the moment, so that I can output it somewhere.
    Thank you in advance
    nvf33
     
  36. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    I've sent you a patched script by PM, which will output the field of view of architectural spotlight cookies in the filename, just as it does for automotive cookies. I'll include this in the next release of the asset, which will introduce a sample scene.
     
  37. xipherx70

    xipherx70

    Joined:
    May 2, 2013
    Posts:
    1
    Hi Thomas,

    thanks to your awesome plugin we saved months of development on a new project.....

    But we noticed a strange behaviour when I use the "raw hdr import" mode that generates an EXR image file.

    The image has the horizontal faces inverted if compared with the cubemap generation mode.

    In attach you can find the import of the same IES file with both modes. noHDRRawImport.png hdrRawImport.png
     
  38. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Very strange! I'll check it out when I'm back from holiday next Monday.
     
  39. nvf33

    nvf33

    Joined:
    Aug 8, 2015
    Posts:
    5
    Great, thank you very much, it worked out of the box, and it seems to reflect the real world ;-)!
    nvf33
     
  40. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    I have managed to reproduce the issue, and sent you a patch by PM. Turns out that the files I used to test the raw import cubemaps with all had symmetry around the Z axis, so this slipped under my radar.

    It's strange though, I had to put the negative X face first, even though the documentation says the positive one should go first.

    You're welcome, glad to hear it works as expected.
     
  41. Unplug

    Unplug

    Joined:
    Aug 23, 2014
    Posts:
    118
    all those patch sent on PM will be shared to everyone anytime soon ?
     
  42. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Once I've completed the sample scene, the FOV suffix for architectural spotlights and the fix for raw import cubemaps will be pushed to the store along with it. Shouldn't be too long.
     
  43. Cascho01

    Cascho01

    Joined:
    Mar 19, 2010
    Posts:
    1,011
    Just being curious, would your IES-lights be compatible with volumetric fog/mist stuff like this ?
    I mean, will I get a 3D-volumetric "cone" that accurately represents the real IES emission volume?
     
  44. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Only if the asset supports light cookies - that would be something you have to ask the creator of the volumetric fog.
     
  45. alexandervobling

    alexandervobling

    Joined:
    May 30, 2017
    Posts:
    1
    Hi Thomas! Does your asset work on iOS/Android devices?
     
  46. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Hi Alex,

    The asset creates cookies. Light cookies are (AFAIK) supported on any device, but only on real time lights. So if you are able to use the deferred rendering path or only intend to use very few real time lights simultaneously on forward, it should work fine. Here's someone with some useful information on using real time lights on Android: https://answers.unity.com/questions/443602/light-cookies-on-android-.html
     
  47. MarcusUlpius

    MarcusUlpius

    Joined:
    Jul 31, 2017
    Posts:
    3
    Thomas,

    When using Steam VR for Windows Mixed Reality (the Lenovo Experience headset and Motion controllers), the imported ies files work correctly only in the Unity editor (both Scene and Game preview panes).

    Unfortunately when the standalone exe binary is run, the scene lighting become terribly mutated as shown in the right side of the attached image, regardless of quality settings and number of lights in the scene. I notice too that the headset is correct when running a preview in Game mode inside of Unity.

    Normal game files on windows and linux run perfectly. Somewhere the VR settings are destroying the ies data.

    I was hoping you had some thoughts on this if not a solution.

    steam vr lenovo experience mixed reality ies file.png
     
    Last edited: Sep 21, 2018 at 12:33 AM
  48. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    The vive screenshot has vertex lighting, which is why it's so unsightly. I think your quality settings might be lowered when you start it in VR, and Unity reverts to 0 pixel lights. Check the quality settings, see what default is used for VR, or set at least 1 pixel light for all quality levels. (Fast and Fastest have 0 pixel lights by default)

    Real time pixel lights are very expensive though. You'll have to use them very sparingly in VR.
     
  49. MarcusUlpius

    MarcusUlpius

    Joined:
    Jul 31, 2017
    Posts:
    3
    I believe you are correct on all fronts, according to a guide over at Steam Community:
    https://steamcommunity.com/sharedfiles/filedetails/?id=952563208

    Unfortunately I have the pixel count already set to 1000 which provides great results in non-vr builds of the same ies files. Also, quality settings are maxed too. Where else to check other variables?

    quality settings.png

    Interestingly, if I run the whole project direct from Unity in preview, the SteamVR and the WMR windows trigger just as they do when the stand-alone build is run - except the lighting with the ies files are correct. A very dirty work around I might have to use for presentations.

    I imagine that Unreal will do something similar as Unity, as the VR system is problem, not what the engines are outputting.

    I really appreciate your quick reply, perspective and expertise, thank you. I'd love to hear any other opinions on this matter no matter how far fetched. Perhaps I should go back to baking the ies lighting in Blender and import the models after into Unity...(aka pain).
     
  50. Thomas-Mountainborn

    Thomas-Mountainborn

    Joined:
    Jun 11, 2015
    Posts:
    312
    Setting the pixel light count of Fantastic to 1000 will not do you any good if Fast is at 0, and Unity chooses Fast when you start the build in VR. Can you double check that all other quality levels have a pixel light count of at least 1?