Index
Building the 3D
scene, in addition to creating models, setting colors and tiles on models, requires a lighting effect to more realistically reflect real-world scenes.
This manual will introduce headlight, point light, spotlight and directional light in depth such as the various configuration parameters of light source, as well as fog and other effects.
The HT
is built with a headlight in default, the headlights equivalent to the eye position of graph3dView.getEye()
has a point light, where the source of the light is changed with graph3dView.getEye()
, so even if the user does not do any lighting settings, roaming to any location can experience the basic lighting effect.
Graph3dView
controls the headlights through the following parameters:
headlightRange
: The lamp influence range, the default is 0
representative it cal illuminate to the infinite distance, if set the value then the light exposure effect will fade with the object away from the shadowheadlightColor
: The color of the lightheadlightIntensity
: Light intensity, default is 1
, if greater than 1
then enhance the intensity, if less than 1
then weakening the intensityheadlightDisabled
: Turn off the lighting effect, the default is false
, can be set to true
to turn off the light effectHT
provides ht.Light
type of data that inherits from ht.Node
, by creating ht.Light
type of data object, then add to the DataModel
data model to achieve the effect of adding lights. The following light source types point light, spotlight and directional light are all controlled by ht.Light
object, the following is the common style
attribute of the lighting type:
light.type
: Default to point
spot light, can be set to spot
spotlight, and directional
directional light typelight.color
: The color of lightlight.intensity
: Light intensity, defaults to 1
, if greater than 1
then enhance the intensity, if less than 1
then weaken the intensitylight.disabled
: Turns off the lighting effect, defaults to false
and can be set to true
to turn off the light effectRemove
ht.Light
object fromDataModel
, with thelight.disabled
property set tofalse
can be turned off the lighting effect, but the delete operation is heavy from theDataModel
, it is recommended that to delete it while in long time do not use it, if you want to achieve frequent changes in flicker and other effects, the proposedlight.disabled
control is more efficient.
Light is emitted from all directions in its position, affecting all objects within its length range.
ht.Light
, that is, light.p3()
valuelight.range
: The light affects range, the default is 0
represents to be able to illuminate to infinite distance, if set the value then the light exposed effect decays with the object away from the shadow.The spotlight is affected by objects within the specified fillet and length range, from where it is, to the position of the center point.
ht.Light
, that is, light.p3()
valuelight.center
: The location of the center point of the light source direction, the default is the origin [0, 0, 0]
light.range
: The light affects range, the default is 0
represents can illuminate to the infinite distance, if set the value then the light exposed effect with the object away from the shadow and fadelight.angle
: The angular curvature of the light, in which the object is affected by the light sourcelight.exponent
: Light exposure attenuation index, the default is 0
, the greater the value of the object farther away from the center is affected by the light effect weakerThe directional light is in the infinite distance, in the direction specified to illuminate all objects in the scene, the sun is the application of such light.
ht.Light
object center point to the 3D coordinate origin [0, 0, 0]
vector direction, so changing the center point position of the light object can change the direction of illumination.HT
provides an fog effect that renders the scene shrouded in atomization, and Graph3dView
is controlled by the following parameters:
fogDisabled
: The default is false
does not enable fog effect, can be set to true
to enable fog effectfogColor
: The color of fogfogNear
: The default is 1
, which represents that the object starts to be affected by the fog effect from the distancefogFar
: The default is 2000
, which means that the object is completely invisible from the distance