Shadow and color problems going from v64 to v161

I am trying to port a very old application (2015) from three.js v64 to v161.

Basically, it has 3 light sources, a particle system, some objects and skyboxes.

Without using “renderer.useLegacyLights = true;”
the lights are gone, no matter what values I use. Only the ambient light seems to have any effect.

What I have understood is that, since version 155, inputs given as SRGB colors/textures are transformed to LinearSRGB, then processed, and finally converted back to SRGB, when outputting. Anyway, no clue how to disable the legacy option and have lights working again…

Second, the shadows are wrong, as if the shadowCamera had been ignored.

The original version (v64) is here:
https://krotalias.github.io/cwdc/13-webgl/homework/Christmas_tree_with_three.js.html

The new version v161 is here:
https://krotalias.github.io/cwdc/13-webgl/homework/Christmas_tree_with_three.js_new.html

The source of the new version is also here:

https://krotalias.github.io/cwdc/13-webgl/homework/Christmas_tree_with_three.js_new_files/doc-three/index.html

Both versions run fine on mobile devices, and can be controlled using the keyboard.

Any suggestion is really appreciated.

Thank you.

Read the following two guides to understand the changes to color spaces and lighting in latest three.js versions:

BTW: Upgrading from r64 to 161 is a huge step. You might want to consider to break down your migration into steps of ten releases. Meaning r64 to r74 to r84 and so on. This will make it much easier to detect breaking changes and apply the respective migration tasks.

My bad. The shadow was my mistake. I was using the syntax of the shadow camera from v64. It is fixed now.

The only thing I still do not understand is how to make lights work without

“renderer.useLegacyLights = true;”

Well, I have done it.

I had to increased the light intensities:

ambient light 0.2 → 2
point light 2 → 4
spot light 1 → 2
directional light 2 → Math.PI * 2

However, without

pointLight.decay = 0;

no matter what valor I used for point light intensity, there was no point light at all!!

That was the part I was stuck with… and goes against the doc, which states to keep the default…

The point lights and spot lights in your scene are positioned about 0.25km from the scene origin. Intensities of 2–4 candela are about as bright as a couple of candles, which is why you aren’t seeing light at that distance. You’d need much brighter lights, on the order of thousands of candela. Or disabling decay is fine, if you don’t need the lights to decay over distance.

I understood the problem. If the tree was just 1.3 m height, then the lighting would be kind of adequate. But since it is 130m height, from the point of view of the light, it is as if a scale factor of 100 had been applied to the scene. Taking into account a quadratic attenuation factor with the distance, the intensities should have been 10.000 times brighter. Therefore, since I used some very low intensities, I had to set decay to zero, so the light does not vanish.

Anyway, it seems to me that it would be more appropriate having the possibility to set the coefficients of attenuation (a,b,c) directly: 1/(ax**2+bx+c). I think that how it is done in “unit” and “unreal”.

Thanks for the tips.