Demistifying the 3D Web - part 2
Click here to load reader
-
Upload
pietro-grandi -
Category
Engineering
-
view
210 -
download
1
Transcript of Demistifying the 3D Web - part 2
![Page 1: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/1.jpg)
WebGL
The native 3D API
![Page 2: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/2.jpg)
Native API
● javascript API
● brings typed arrays
● immediate mode graphical API
● no plugins needed
![Page 3: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/3.jpg)
OpenGL legacy
● based on OpenGL ES 2.0
● shader based pipeline
● uses GLSL 1.0 for shaders
● shaders are compiled
![Page 4: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/4.jpg)
How to get it
● create a <canvas> element
● retrieve the desired context
o myCanvasDOMElem.getContext(“3d”);
● access WebGL methods through context
![Page 5: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/5.jpg)
And what about shaders?
● passed as strings. Very long strings.
● C like syntax and statically typed
● two flavors: vertex and fragment shader
● native matrix and vector operators
![Page 6: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/6.jpg)
● shader based pipeline
● vertex shader to control vertices properties
● fragment shader to control pixels properties
● allow us to keep control of the pipeline
Why?
![Page 7: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/7.jpg)
Dealing with complexity
● WebGL uses points, lines and triangles
● geometries can have thousands of triangles
● lot of boilerplate even for trivial examples
● string composition in JS? Really?
![Page 8: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/8.jpg)
JS Frameworks for WebGL
● ThreeJS
● OSGJS
● BabylonJS
● ...yet another JS (SceneJS, ...)
![Page 9: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/9.jpg)
ThreeJS
● originally written in ActionScript
● the most famous one
● tons of tutorials and workshops
![Page 10: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/10.jpg)
OSGJS
● porting of OpenSceneGraph (C++)
● texture pipeline very close to Blender
● good support through forums
● production use: Sketchfab
![Page 11: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/11.jpg)
BabylonJS
● Microsoft’s WebGL framework
● based on a Silverlight game engine
● good support and demos
● extended physics support
![Page 12: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/12.jpg)
Let’s sell it tomorrow!
● Not just a modern browser, but a cool one
● not a HTML5 standard. Yet.
● powerful GPU is strongly suggested
![Page 13: Demistifying the 3D Web - part 2](https://reader038.fdocuments.in/reader038/viewer/2022100803/58efbf151a28ab6e3d8b45f7/html5/thumbnails/13.jpg)
Let’s sell it tomorrow!
● Depends on the whole stack
o video adapter
o OS and drivers
o browser version, vendor, build...
o blacklists, security paranoias, luck