How to add lights to a standard material in ThreeJS

A step by step guide on an ambient light to a scene in ThreeJS and learning how they adapt the standard material on a plane geometry in ReactJS.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 11/06/2023 at 10:57
Last Updated on 11/10/2023 at 23:27
<p>Two flowers that represent ReactJS and ThreeJS. Beneath them sits the text "ReactJS &amp; ThreeJS Lights (Standard Materials)."</p>

A step by step guide on an ambient light to a scene in ThreeJS and learning how they adapt the standard material on a plane geometry in ReactJS.

SubscribeDownload Open Source Starter Project

We recommend that you clone our Open Source React-Redux Starter Project, checking out the tutorial/three-js/starter branch and carrying out the steps below. The changes can be found on the tutorial/three-js/lights-standard-material branch.

git clone git@github.com:delasign/react-redux-starter-project.git
View Repository

Step One: Setup the project

<p>A screenshot of the app running in a browser. If you change the scale of the screen, the object will adapt accordingly.</p>

Follow the tutorial below to setup a responsive ThreeJS, ReactJS project that displays a plane in a scene.

How to create a ThreeJS responsive ReactJS project

Step Two: Update the Material

<p>A screenshot of VSCode showing how we have updated the plane material to a MeshLambertMaterial. Code available below.</p>

Update the plane material to a MeshLambhertMaterial using code similar to the one below.

Step Three: Add the Light

<p>A screenshot of VSCode showing how we added an ambient light to the scene. Code available below.</p>

Add an ambient light to the scene using code similar to the one below.

To learn more about the types of lights that are available, consult the link below - the light options are on the left menu side bar.

Consult ThreeJS Light Documentation

Step Four: Test

<p>A screenshot of Chrome demonstrating that the plane has adapted the light onto the material.</p>

Run the code and confirm the light works as expected.

Looking to learn more about ReactJS and ThreeJS ?

Search our blog to find educational content on learning how to use ReactJS and ThreeJS.

Search our BlogReact, ThreeJS & GLSL Resources

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe