otto
otto

Reputation: 2043

Three js RectAreaLight on MeshPhongMaterial no light reflection (OES_texture_half_float not supported)

I want to add RectAreaLight to a three.js scene where I placed object with MeshPhongMaterial however there is no light reflection on the objects. I found a working example here: Link

You can see the source code when you open the developer tools.

So I tried to port it to React and the scene renders all objects but there is light reflection. In line 46 the OES_texture_half_float error was thrown. I commented this lines out. Maybe it has something to do with this.

Here is the not working codesandbox: Link

Upvotes: 1

Views: 835

Answers (1)

Mugen87
Mugen87

Reputation: 31076

There are a couple of issues in your code:

  • You have to import RectAreaLightUniformsLib and call its init() method.
  • As mentioned in the documentation, RectAreaLight only supports PBR materials (meaning MeshStandardMaterial and MeshPhysicalMaterial).
  • There is also no shadow support yet so setting flags like castShadow and receiveShadow won't have any effect.

Fixed codesandbox: https://codesandbox.io/s/restless-cherry-4jh72

Upvotes: 1

Related Questions