Parse RectAreaLight problem

Hi, I think I found a bug at parsing rectAreaLight and a temp solution.

Env:
Babylon.js-9.11.0

Bug behaviour:

  1. create a rectAreaLight by const light = new RectAreaLight()
  2. serialize the light by const data = light.serialize()
  3. deserialize the light by Light.Parse(data, scene)
  4. the bug is when after parsing, the rectAreaLight don’t work(can’t see the light)

Solution:
When I console the light object, I found the light._photometricScale=0,and I set to 1 can fix the bug.
diving in the source code, I found it did’t handle the Light.LIGHTTYPEID_RECT_AREALIGHT case in _getPhotometricScale() function, so the light._photometricScale is the initial value 0.
I simply add one line to handle the rectAreaLight case can fix the bug in source code, but I think you know how to fix the bug better, so I write this topic to report this bug.

cc @srzerbetto

@acg78219 , thanks for finding this!

Yes, area lights are currently not been properly serialized. I’m currently working in a PR for fully fix this. I will let you know once the PR is open, but my plan is to be done with it this week.

@acg78219 , I have a PR open for fixing this:

Fix RectAreaLight serialization: position, photometric scale, and emission texture by SergioRZMasson · Pull Request #18605 · BabylonJS/Babylon.js

With this RectAreaLight should be fully serializable.

@acg78219 , the PR has been merged. Changes should be in the next Babylon.js release (probably 9.14.0)

Appreciate!