Seventh lecture light Source processing
In the x3d scene space, the illumination brightness of the Shape object can be treated by point Light node (pointlight), Parallel source node (directionallight) and concentrating light source node (SpotLight).
This explains the properties of these three nodes and how to use them.
One, point Light source node (pointlight)
Pointlight is a point light that emits light in all directions. Light illuminates all geometrical objects and is not shaded by geometric forms. Its main properties are shown in the following table:
properties |
meaning |
default value |
use instructions |
on |
light switch |
true |
|
color |
|
1 1 1 |
Specifies the color of the light that affects the actual color display effect of the object |
Where the light source is located |
0 0 0 |
/tr> |
intensity |
lighting brightness |
1 |
|
tr>
ambientintensity |
0 |
|
radius |
Light impact radius |
100 |
maximum radius of lighting effect with light source |
light attenuation parameter |
1 0 0 |
|
The simple sample code is as follows:
Description: We first construct a small ball with the same color as the light source at the point light position, then construct a cylinder at (3,0,0). The results are shown in the following figure, noting the color of the cylinder.
If an identical cylinder is added between the light source and the cylinder, try to compare the effects of the two cylinders. The code is as follows:
The results are shown in the following illustration: