User Tools

Site Tools


gamedev:ieslightprofiles

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
gamedev:ieslightprofiles [2020/10/26 23:45] dragonlordgamedev:ieslightprofiles [2020/11/24 09:57] (current) – [IES Image Module] dragonlord
Line 1: Line 1:
-{{tag>localization text}}+{{tag>lighting ies}}
 <WRAP youarehere> <WRAP youarehere>
-[[:start|Start Page]] >> [[:gamedev|Game Development with the Drag[en]gine]] >> **IES Light Profiles**+[[:start|Start Page]] >> [[:gamedev|Game Development with the Drag[en]gine]] >> [[:gamedev:lighting|Lighting System]] >> **IES Light Profiles**
 </WRAP> </WRAP>
  
 ====== IES Image Module ====== ====== IES Image Module ======
  
-The Drag[en]gine Game Engine includes by default the **IES Image Module**. This module allows loading IES Photometric files. 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.+The Drag[en]gine Game Engine includes by default the **IES Image Module**. This module allows loading IES Photometric files for use with [[gamedev:lighting|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: [[https://ieslibrary.com/en/home|IES Library]]. IES Files can be found on various pages of light fixture manufactures. There exists a large collection of free to use IES files here: [[https://ieslibrary.com/en/home|IES Library]].
Line 13: Line 13:
  
 <WRAP center round info 60%> <WRAP center round info 60%>
-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 the user having to do this all the time 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 images. If you want to access the image data in your game scripts you have to reverse the gamma correction by applying a "pow" function with exponent "2.2".+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 [[gamedev:textureproperties:color_gamma|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)". 
 +</WRAP> 
 + 
 +<WRAP center 100%> 
 +<WRAP center box 450px> 
 +{{youtube>LGBZLfGvm6M?medium}} 
 +<WRAP centeralign>IES file handling</WRAP> 
 +</WRAP>
 </WRAP> </WRAP>
  
 ====== Usage ====== ====== Usage ======
  
-To use IES profiles as light skins you need to create a skin object with one texture and one texture property of type [[gamedev:textureproperties:color_omnidir_equirect|color.omnidir.equirect]]. A typical skin file looks like this:+To use IES profiles as light skins you need to create a skin with one texture and one texture property of type [[gamedev:textureproperties:color_omnidir_equirect|color.omnidir.equirect]]. You can do this using the [[gamedev:deigde:editors:skin|IGDE Skin Editor]] or by creating a "*.deskin" file manually. A typical skin file looks like this:
  
 <code xml><?xml version="1.0" encoding="ISO-8859-1"?> <code xml><?xml version="1.0" encoding="ISO-8859-1"?>
Line 24: Line 33:
   <texture name='material'>   <texture name='material'>
     <image property='color.omnidir.equirect'>/shareddata/materials/light/profiles/display.ies</image>     <image property='color.omnidir.equirect'>/shareddata/materials/light/profiles/display.ies</image>
 +    <color property='omnidir.rotate.spot' r='0.25'/>
   </texture>   </texture>
 </skin> </skin>
 </code> </code>
  
-The path to the IES file can be relative 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.+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. +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 above contains such a rotation using [[gamedev:textureproperties:omnidir_rotate_spot|omnidir.rotate.spot]]. The texture property expects values in the range from 0 (0°) to 1 (360°). Hence 0.25 represents a 90° rotation. The components map to axes like this: red -X-Axis, green -> Y-Axis, blue -Z-AxisNot set components are hence no rotation.
- +
-<code xml><?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' g='0' b='0'/> +
-  </texture> +
-</skin> +
-</code>+
  
-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 achieveHence 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.+As note there exist two rotation properties: [[gamedev:textureproperties:omnidir_rotate|omnidir.rotate]] and [[gamedev:textureproperties:omnidir_rotate_spot|omnidir.rotate.spot]]. The difference is that [[gamedev:textureproperties:omnidir_rotate|omnidir.rotate]] applies to all light sources including point lights whereas [[gamedev:textureproperties:omnidir_rotate_spot|omnidir.rotate.spot]] applies only to spot and projector type light resources. Using this property allows to create light skins which are compatible for all light sources.
  
 ====== Drag[en]gine IES Pack ====== ====== 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/profileswith their respective skin files found at path "/shareddata/materials/light". This is an overview of the included profiles (click for larger image):+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 (as shared DragonScript Module files). You do not need to copy them to your project. The IES images can be found at the in-game path <wrap hi>/shareddata/materials/light/profiles</wrap> with their respective skin files found at in-game path <wrap hi>/shareddata/materials/light</wrap>. This is an overview of the included profiles (click for larger image):
  
 {{gallery> :gamedev:iesprofiles?0&200x200&lightbox&showname&titlesort }} {{gallery> :gamedev:iesprofiles?0&200x200&lightbox&showname&titlesort }}
gamedev/ieslightprofiles.1603755913.txt.gz · Last modified: 2020/10/26 23:45 by dragonlord