From the course: Learning 3D Graphics on the Web with Three.js

Unlock the full course today

Join today to access over 24,400 courses taught by industry experts.

DirectionalLight

DirectionalLight

- [Instructor] Directional lights emit parallel light rays. This is great for simulating light sources that are very, very far away, like the sun. This means that the shadows cast by the directional lights will all be parallel to each other. Like before, I will create a function that wraps the three.JS directional light function. So here, underneath my spotlight creating function, I will be creating another function. Called "get directional lights." And instead of calling the point lights, I will call the directional light function of three.JS. And I will update the references to spotlights in the file to directional lights. So here, instead of calling the "get spotlight" function, I will call the "get directional light" function, and I will change all the references to "spotlight" to "directional light." To be able to select all the references to "spotlights," I'm using the commands, the shortcuts, of Sublime text editor. One more thing that I need to do is, I need to get rid of this…

Contents