-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Initial implementation for Area Lights #16078
base: master
Are you sure you want to change the base?
Initial implementation for Area Lights #16078
Conversation
…into sergio/area-light
…of Specular power
Co-authored-by: Gary Hsu <bghgary@users.noreply.github.com>
Visualization tests for WebGPU (Experimental) |
WebGL2 visualization test reporter: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job !! Besides the comments, I am wondering what makes standard and PBR not look alike in the tests knowing they use the same maths ?
const _ltc1 = new Uint16Array(64 * 64 * 4); | ||
const _ltc2 = new Uint16Array(64 * 64 * 4); | ||
|
||
const ltcPath = Tools.GetBabylonScriptURL("https://assets.babylonjs.com/areaLights/areaLightsLTC.bin", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should still support something through the script base url if we can ? this is the centralized way for our users to prevent external call.
} | ||
|
||
public transferToNodeMaterialEffect(effect: Effect, lightDataUniformName: string) { | ||
// TO DO: Implement this to add support for NME. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next PR @SergioRZMasson ?
packages/dev/core/src/Shaders/ShadersInclude/pbrDirectLightingSetupFunctions.fx
Outdated
Show resolved
Hide resolved
I think this is related to the metallic calculations performed down in the shader. By changing the metallic values we can make them more or less simular. |
Also, we perform the calculation in linear space in the PBR and apply the gamma correction at the end, whereas we perform the calculation directly in gamma space in the standard material. This could explain some of the differences. |
this.position = position; | ||
|
||
if (!this._scene._ltcTextures) { | ||
this._scene.areaLightLTCProvider ||= new DefaultAreaLightLTCProvider(this._scene, "https://assets.babylonjs.com/areaLights/areaLightsLTC.bin"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After this PR #16089 is merged and available in master you can use the same paradigm to allow overriding this URL (i.e. use the Tools.GetAssetsUrl function). You will also need to move the asset to the /core/ directory in the Assets repository to stay consistent and make the asset override procedure work correctly.
WebGL2 visualization test reporter: |
Visualization tests for WebGPU (Experimental) |
…/Babylon.js into sergio/area-light
Overview
This PR provides a first implementation for rectangular area lights. The implementation is based on reference repo https://github.com/selfshadow/ltc_code/ and uses the Linearly Transformed Cosines technique described by Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt`s paper in 2016 . This PR only supports single color rectangular area lights with texture support been introduced in a latter PR. This PR also does not support shadows for the RectAreaLight.
API
Besides the usual diffuse and specular colors the area light is defined by a position, a width and a height. Setting a rotation is possible by assigning a transform node as a parent for the light.
By default shaders will use LTC data stored in the Babylon.js CDN. However, users can assign their own
IAreaLightLTCProvider
toscene.areaLightLTCProvider
and use their own LTC textures.