Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to alter the intensity of a shadow cast by a three.js object?

Tags:

three.js

How can I alter the intensity of a shadow cast by an object in the three.js? Currently translucent materials cast a shadow as intense as opaque objects. Obviously I'd like the translucent ones to not cast such an intense shadow.

like image 660
edA-qa mort-ora-y Avatar asked Oct 03 '22 02:10

edA-qa mort-ora-y


1 Answers

When casting shadows in three.js using WebGLRenderer, objects are treated as solid and non-translucent from the point of view of the light.

You can control the shadow intensity on a per-light basis by setting light.shadowDarkness to a value in the range [ 0, 1 ].

three.js r.64


EDIT: light.shadowDarkness is no longer supported as of three.js r.74. You can add ambient light to your scene to compensate.

three.js r.75

like image 180
WestLangley Avatar answered Oct 07 '22 20:10

WestLangley