User Tools

Site Tools


gamedev:ieslightprofiles

This is an old revision of the document!


IES Image Module

The Drag[en]gine Game Engine includes by default the IES Image Module. This module allows loading IES Photometric files for use with Lighting System. These files are created by measuring real world luminaires. By using such files complex and realistic light patterns can be simulated which improves the overall credibility of rendered scenes.

IES Files can be found on various pages of light fixture manufactures. There exists a large collection of free to use IES files here: IES Library.

The IES Image Module loads *.ies files as 16-bit, equirectangular omni-direction textures with normalized values. IES files contains candela values. By normalizing them into the range from 0 to 1 the loaded images can be used with light sources as light skin to shape the light while still using the light intensity to alter the overall intensity.

IES profiles contain linear candela values. To use them with lighting the values would have to be gamma corrected by 1/2.2 . To avoid having to add the color.gamma texture property to all light skins the IES Image Module applies gamma correction while rendering the profile as image object. This way loaded profiles can be used as drop-in replacement for existing omni-direction light skins.

If you want to access profile data in game scripts you have to reverse the gamma by using “pow(pixel, 2.2)”.

Usage

To use IES profiles as light skins you need to create a skin with one texture and one texture property of type color.omnidir.equirect. You can do this using the IGDE Skin Editor or by creating a “*.deskin” file manually. A typical skin file looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<skin>
  <texture name='material'>
    <image property='color.omnidir.equirect'>/shareddata/materials/light/profiles/display.ies</image>
  </texture>
</skin>

The path to the IES file can be relative (to the directory the *.deskin is located in) or absolute. Using relative path makes skins easy to move between directories or game projects. The name of the texture is not important. Lights always use the first texture defined in a skin file.

If you want to use IES profiles for spot and projector type light sources you have to rotate the image first. This is required because IES profiles typically have the image shining down the Y-Axis. Spot and projector type light sources on the other hand shine along the Z-Axis. The image has to be rotated by 90° around the X-Axis to line them up. This example modifies the skin from above to work with spot lights. The omnidir.rotate expects values in the range from 0 (0°) to 1 (360°). Hence 0.25 represents a 90° rotation.

<?xml version="1.0" encoding="ISO-8859-1"?>
<skin>
  <texture name='material'>
    <image property='color.omnidir.equirect'>/shareddata/materials/light/profiles/display.ies</image>
    <color property='omnidir.rotate' r='0.25'/>
  </texture>
</skin>

Using this modified light skin on point type light sources is not going to work since the rotation would make the light shine now along the Z-Axis which is most likely not what you want to achieve. Hence if you want to use a an IES profile on both point and spot or projector type light sources you have to create two individual skin files.

Drag[en]gine IES Pack

The Drag[en]gine ships with a pack of 30 IES profiles ready to be used in your project. This pack is guaranteed to exist on all game engine installation. You do not need to copy them to your project. The IES images can be found at the path /shareddata/materials/light/profiles with their respective skin files found at path /shareddata/materials/light. This is an overview of the included profiles (click for larger image):

You can find them under the Skin Browser in the IGDE World Editor: World Editor Light Skin Browsing

To apply the light skin to a light source either add the appropriate Object Property (typically “light.lightSkin”) or right click on the light skin in the browser and click the desired “Active Object Set Property” menu entry.

You could leave a comment if you were logged in.
gamedev/ieslightprofiles.1603756875.txt.gz · Last modified: 2020/10/27 00:01 by dragonlord