-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add IES light profile import for realistic light projectors #715
Comments
Out of curiosity, are there freely-licensed IES profiles out there? Not just freely downloadable, but under a public domain-like license or a libre Creative Commons license. This would be useful for a demo project. |
https://renderman.pixar.com/ies-profiles I found this one. |
https://seblagarde.wordpress.com/tag/ies-specification/ Described how Frostbite implemented IES lights. [Edited] This is a copy of the IES parser code linked in that blog. There is a broken link to the Frostbite paper https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf |
Also Filament has a great explanation https://google.github.io/filament/Filament.md.html#lighting/directlighting/photometriclights |
At ies Library (https://ieslibrary.com), which started early this month, they currently have more than 100k IES files and tools to convert to LDT. They are also planning a Blender plugin to access the library, a type of utility that could be valuable for Godot as well. |
I find this very necessary. It would be a great leap forward in Godot rendering capabilities. IES lights are a important step for achieving realism, and would put Godot in the ArchViz scope. |
See also KhronosGroup/glTF#2200 |
Regarding the IES rendering itself, isn't a dedicated 1D Attenuation Texture property needed for accurate rendering? Light projector textures for both OmniLight3D and SpotLight are applied in 2D space, but it doesn't apply to the light's attenuation (when light goes further away from the origin). Projectors also require shadows to be enabled, which can be too demanding for some game use cases (but I assume you always have shadows enabled for archviz and offline rendering in general). |
Open the ies light and assign as a panorama. |
This comment was marked as off-topic.
This comment was marked as off-topic.
@Nikoraito Please don't bump issues without contributing significant new information. Use the 👍 reaction button on the first post instead. |
https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf I am encountering linkrot here is the relevant text. float getIESProfileAttenuation(float3 L, ShadowLightInfo light)
{
// Sample direction into light space
float3 iesSampleDirection = mul(light.worldToLight, -L);
// Cartesian to spherical
// Texture encoded with cos(phi), scale from -1 ->1 to 0 ->1
float phiCoord = (iesSampleDirection.z * 0.5f) + 0.5f;
float theta = atan2(iesSampleDirection.y, iesSampleDirection.x);
float thetaCoord = theta * FB_INV_TWO_PI;
float3 texCoord = float3(thetaCoord, phiCoord, light.lightIndex);
float iesProfileScale = iesTexture.SampleLevel(sampler, texCoord, 0).r;
return iesProfileScale;
}
// ...
att *= getAngleAtt(L, lightForward, lightAngleScale, lightAngleOffset);
att *= getIESProfileAttenuation(L, light);
// lightColor depends on option.
// Non masked: lightColor = color * MaxCandelas
// Masked (for point light with luminous power): lightColor = color * phi / (4 * PI)
float3 luminance = BSDF(...) * saturate(dot(N, L)) * lightColor * att;
// And lastly if you are generating a photometric web from the data for ray tracing or radiosity, you should interpolate the horizontal angles using a cubic spline curve (open or closed depending on whether the full 360 range of horizontal angles is specified). |
any news on this? |
To my knowledge, nobody is currently working on implementing this feature. |
My last work was here https://github.com/V-Sekai/godot/tree/salvage/ies-lights but I am not working on it currently. |
I wonder - in the absence of such a feature, could a Gradient 1D texture be used with a Light shader to at least approximate this effect without using texture proiection (which needs shadows, which is costly)? |
That solution could definitely work with some modifications to GradientTexture2D to create projection textures for spotlights. Doesn't directly solve this proposal, though. |
Yes, a custom |
So, how things have changed, I've learn basic stuff about graphic pipeline and shaders, and as the one that commented this quote I have to correct myself. I no longer find this very necessary, in fact if implemented following the Godot philosophy it should be done in a plugin and not in the main engine. Solutions provided here about using a GradientTexture2D or GradientTexture1D in the projection of a light are more optimal, the only "issue" is that there is no option to radially project the Gradient1D (only through a GradientTexture2D). |
I really like that workaround, I think there still should be an official implementation though. Just throwing my hat in if anyone more skilled is able to implement this, but since IES files are just raw text files full of numbers, it would be nice if this hypothetical PS: You can save the resource from the workaround that was posted above as a tres file and the editor gives you pretty previews for it |
Can't one just render an IES profile to a cubemap projector? |
Late to answer, but CNDL An open source IES lighting creation tool, if that's useful here. |
That'd be interesting. |
The base Light3D class which OmniLight3D inherits have a property for projector textures, so in theory, it should work just fine. I've never tried it myself, though. If it works as I expected, one could write an IES importer that creates a texture. |
Rendering the IES to a cubemap for OmniLight3D will run into the same issue as #715 (comment). It may not be a dealbreaker for some use cases, but it's worth thinking about. |
Describe the project you are working on:
Not related to my project.
Describe the problem or limitation you are having in your project:
Lights in Godot Engine are clunky and look the same.
There are existing IES profiles that give varied and exciting light types.
https://www.cgarena.com/freestuff/tutorials/max/ieslights/
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
It would make artwork and level design improved if IES light profiles can be imported directly.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
If this enhancement will not be used often, can it be worked around with a few lines of script?:
No, the convenience of dragging a profile to be a light projector is the feature.
Is there a reason why this should be core and not an add-on in the asset library?:
In theory this can be a gdnative plugin, but ies profiles are an important visual tool in lighting a scene.
Other
I am not working on IES lights import, feel free to take on the task.
The text was updated successfully, but these errors were encountered: