playcanvas / engine

JavaScript game engine built on WebGL, WebGPU, WebXR and glTF
https://playcanvas.com
MIT License
9.52k stars 1.33k forks source link

Add support for IES profiles #4365

Open GSterbrant opened 2 years ago

GSterbrant commented 2 years ago

Description

Add support for IES light profiles:

image

These are essentially just weights you can use in a shader and lookup the value based on the angle between the view point and the light, and can be used to create lights which correspond much more to real-world lightbulbs.

mvaligursky commented 2 years ago
Screenshot 2022-06-29 at 09 08 18

https://renderman.pixar.com/ies-profiles

mvaligursky commented 2 years ago

We could have a global switch (at least for the clustered lights) of the meaning of the cookie texture. It could be switched to a IES profiles meaning. This would make it very easy to implement, just a small part of the shader would work differently.

GSterbrant commented 2 years ago

You'd just need to change how you sample the texture. Instead of doing all the heavy projection math, you can just use the angle between surface and the light to pick the IES value.

mvaligursky commented 1 year ago

The way Frostbite engine added this is described in 4.5 Photometric lights https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf

Screenshot 2023-08-15 at 10 37 49