/
lights.x3dv
163 lines (148 loc) · 4.15 KB
/
lights.x3dv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#X3D V3.2 utf8
PROFILE Interchange
# Lights demo.
#
# Three lights : point light (the red one; has position),
# spot light (the blue one; has position and direction)
# and directional light (green one; has only direction).
#
# We can see the same scene duplicated three times.
# The left one is illuminated by the point light and spot light.
# The middle one is illuminated only by the directional light.
# And the right one is illuminated by all three kinds of lights.
#
# You can use built-in raytracer
# in view3dscene (use "classic" raytracer for this model)
# to render view of this model with shadows.
#
# We want this to be exactly identical to analogous VRML 1.0 version inside
# see ../vrml_1/lights.wrl. Just for the sake of test.
# To do this, we use "ambientIntensity 1" for every light.
# In VRML 1.0 ambientIntensity is taken from intensity,
# and default intensity is 1. In VRML >= 2.0 default ambientIntensity is 0.
# So lights in VRML >= 2.0 by default are darker (and usually better-looking,
# actually) than VRML 1.0.
NavigationInfo { headlight FALSE }
# Camera settings "encoded" in the VRML declaration below :
# direction -0.003885044017807 -0.000000000002812 -0.11726900190115
# up 1.56576085430515E-009 1 4.36595186670274E-008
# gravityUp 0 1 0
Viewpoint {
position 26.037553787231445 -0.00000117056959 37.542552947998047
orientation 0.010424139909446 0.999979853630066 -0.000200989466975 0.033117223531008
}
Switch {
choice [
# setup point light
DEF LightPointPos Shape {
geometry PointSet {
coord Coordinate { point 10 0 0 }
color Color { color 1 0 0 }
}
}
DEF LightPoint PointLight {
ambientIntensity 1
location 10 0 0
color 1 0 0
# radius below is not needed (in X3D, we can limit by global=FALSE).
# But it's useful: we can see light radius on far spheres,
# when shader (per-pixel) rendering (and checking or radius) in on.
#radius 20
global FALSE
}
# setup spot light
DEF LightSpotPos Shape {
geometry PointSet {
coord Coordinate { point 4 1.6 1 }
color Color { color 0 0 1 }
}
}
DEF LightSpot SpotLight {
ambientIntensity 1
location 4 1.6 1
direction -0.2 0 -1
color 0 0 1
cutOffAngle 0.1
# radius below is not needed (in X3D, we can limit by global=FALSE).
# But it's useful: we can see light radius on far spheres,
# when shader (per-pixel) rendering (and checking or radius) in on.
#radius 20
global FALSE
}
# setup directional light
DEF LightDir DirectionalLight {
ambientIntensity 1
color 0 1 0
direction 1 0 -1
}
DEF Objects Group {
children [
Shape {
appearance Appearance { material Material { diffuseColor 1 1 1 } }
geometry Cylinder { }
}
Transform {
translation 4 0 0
children Shape {
appearance
DEF DefLitAppearance Appearance { material Material { diffuseColor 1 1 1 } }
geometry Box { }
}
}
Transform {
translation 0 4 0
children Shape {
appearance USE DefLitAppearance
geometry Sphere { }
}
}
Transform {
translation 0 0 4
children Shape {
appearance Appearance {
material Material { diffuseColor 1 1 1 }
texture ImageTexture { url "../textures/bricks2.jpg" }
}
geometry Cone { }
}
}
Transform {
translation 0 0 -16
children Shape {
# make SpotLight circle perfect
shading "PHONG"
appearance USE DefLitAppearance
geometry Sphere { radius 4 }
}
}
]
}
]
}
Transform {
children [
USE LightPointPos
USE LightPoint
USE LightSpotPos
USE LightSpot
USE Objects
]
}
Transform {
translation 20 0 0
children [
USE LightDir
USE Objects
]
}
Transform {
translation 40 0 0
children [
USE LightPointPos
USE LightPoint
USE LightSpotPos
USE LightSpot
USE LightDir
USE Objects
]
}