@@ -4,7 +4,7 @@ titleSuffix: Microsoft Azure Maps
44description : How to add a custom WebGL layer to a map using the Azure Maps Web SDK.
55author : stevemunk
66ms.author : v-munksteve
7- ms.date : 09/23 /2022
7+ ms.date : 10/17 /2022
88ms.topic : how-to
99ms.service : azure-maps
1010services : azure-maps
@@ -117,10 +117,10 @@ map.layers.add(new atlas.layer.WebGLLayer("layerId",
117117
118118This sample renders a triangle on the map using a WebGL layer.
119119
120- <!-- ------------------ Insert example here ----------------------------------->
121-
122120![ A screenshot showing a triangle rendered on a map, using a WebGL layer.] ( ./media/how-to-webgl-custom-layer/triangle.png )
123121
122+ For a fully functional sample with source code, see [ Simple 2D WebGL layer] [ Simple 2D WebGL layer ] in the Azure Maps Samples.
123+
124124The map's camera matrix is used to project spherical Mercator point to
125125gl coordinates. Mercator point \[ 0, 0\] represents the top left corner
126126of the Mercator world and \[ 1, 1\] represents the bottom right corner.
@@ -141,17 +141,16 @@ to load a [glTF][glTF] file and render it on the map using [three.js][threejs].
141141You need to add the following script files.
142142
143143``` html
144- <
script src =
" https://unpkg.com/[email protected] /build/three.min.js" ></
script >
145-
146- <
script src =
" https://unpkg.com/[email protected] /examples/js/loaders/GLTFLoader.js" ></
script >
144+ <script src =" https://unpkg.com/three@latest/build/three.min.js" ></script >
145+ <script src =" https://unpkg.com/three@latest/examples/js/loaders/GLTFLoader.js" ></script >
147146```
148147
149148This sample renders an animated 3D parrot on the map.
150149
151- <!-- ------------------ Insert example here ----------------------------------->
152-
153150![ A screenshot showing an an animated 3D parrot on the map.] ( ./media/how-to-webgl-custom-layer/3d-parrot.gif )
154151
152+ For a fully functional sample with source code, see [ Three custom WebGL layer] [ Three custom WebGL layer ] in the Azure Maps Samples.
153+
155154The ` onAdd ` function loads a ` .glb ` file into memory and instantiates
156155three.js objects such as Camera, Scene, Light, and a ` THREE.WebGLRenderer ` .
157156
@@ -165,6 +164,27 @@ a single frame by calling `map.triggerRepaint()` in the `render` function.
165164> - To enable anti-aliasing simply set ` antialias ` to ` true ` as
166165 one of the style options while creating the map.
167166
167+ ## Render a 3D model using babylon.js
168+
169+ [ Babylon.js] [ babylonjs ] is one of the world's leading WebGL-based graphics engines. The following example shows how to load a GLTF file and render it on the map using babylon.js.
170+
171+ You need to add the following script files.
172+
173+ ``` html
174+ <script src =" https://cdn.babylonjs.com/babylon.js" ></script >
175+ <script src =" https://cdn.babylonjs.com/loaders/babylonjs.loaders.min.js" ></script >
176+ ```
177+
178+ This sample renders a satellite tower on the map.
179+
180+ The ` onAdd ` function instantiates a BABYLON engine and a scene. It then loads a ` .gltf ` file using BABYLON.SceneLoader.
181+
182+ The ` render ` function calculates the projection matrix of the camera and renders the model to the scene.
183+
184+ ![ A screenshot showing an example of rendering a 3D model using babylon.js.] ( ./media/how-to-webgl-custom-layer/render-3d-model.png )
185+
186+ For a fully functional sample with source code, see [ Babylon custom WebGL layer] [ Babylon custom WebGL layer ] in the Azure Maps Samples.
187+
168188## Render a deck.gl layer
169189
170190A WebGL layer can be used to render layers from the [ deck.gl] [ deckgl ]
@@ -175,7 +195,7 @@ within a certain time range.
175195You need to add the following script file.
176196
177197``` html
178- <script src =" https://unpkg.com/deck.gl@8.8.9 /dist.min.js" ></script >
198+ <script src =" https://unpkg.com/deck.gl@latest /dist.min.js" ></script >
179199```
180200
181201Define a layer class that extends ` atlas.layer.WebGLLayer ` .
@@ -215,6 +235,8 @@ This sample renders an arc-layer google the [deck.gl][deckgl] library.
215235
216236
217237
238+ For a fully functional sample with source code, see [Deck GL custom WebGL layer][Deck GL custom WebGL layer] in the Azure Maps Samples.
239+
218240## Next steps
219241
220242Learn more about the classes and methods used in this article:
@@ -236,7 +258,12 @@ Learn more about the classes and methods used in this article:
236258[deckgl]: https://deck.gl/
237259[glTF]: https://www.khronos.org/gltf/
238260[OpenGL ES]: https://www.khronos.org/opengles/
261+ [babylonjs]: https://www.babylonjs.com/
239262[WebGLLayer]: /javascript/api/azure-maps-control/atlas.layer.webgllayer
240263[WebGLLayerOptions]: /javascript/api/azure-maps-control/atlas.webgllayeroptions
241264[WebGLRenderer interface]: /javascript/api/azure-maps-control/atlas.webglrenderer
242265[MercatorPoint]: /javascript/api/azure-maps-control/atlas.data.mercatorpoint
266+ [Simple 2D WebGL layer]: https://samples.azuremaps.com/?sample=simple-2d-webgl-layer
267+ [Deck GL custom WebGL layer]: https://samples.azuremaps.com/?sample=deck-gl-custom-webgl-layer
268+ [Three custom WebGL layer]: https://samples.azuremaps.com/?sample=three-custom-webgl-layer
269+ [Babylon custom WebGL layer]: https://samples.azuremaps.com/?sample=babylon-custom-webgl-layer
0 commit comments