WebGL's multicolored light source

Source: Internet
Author: User

What are the light sources in three.js?

In Three.js, the light source has a base class of Three.light (hex), which accepts 16 binary colors as parameters to initialize the color of the light source, such as we want to define a green light source, which can be defined as:

var New Three. Light (0x00FF00);

And as the 3d engine three.js, this base class is difficult to meet our requirements, so we also need to inherit the base class of the more diverse light source:

In addition to this base class light source, we also have ambient light, area light, directional light, Spotlight, point Light, and so on. Below we introduce some common light sources.

(1) Ambient light

  The environment is light that has been reflected many times , so it is impossible to determine its original orientation. It is a ubiquitous light whose light source can be thought to come from any direction. Therefore, when we set the scene light as ambient light, all objects will show the same degree of brightness, ambient light can be used three. Ambientlight to show that his constructor is three. Ambientlight (hex); , it still accepts 16 binary colors as parameters, as follows:

var New Three. Ambientlight (0xff00000); Scene.add (light);

As above, after adding the light source, the scene will be able to render the effect through the light source.

  

WebGL's multicolored light source

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.