Top Banner
Introduction à WebGL
29

Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Oct 19, 2018

Download

Documents

ngonhan
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Introduction à

WebGL

Page 2: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Contexte

Informatique et Géomatique 3ème

année

Cadre : Enseignement en troisième année

d’Informatique et Géomatique

Technologie d’avenir pour faire de la 3D

BARAT MARC IGEO3 2013-02-13 2 /

Page 3: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

SOMMAIRE

Informatique et Géomatique 1ère année

Présentation de WebGL

Définition

Référentiels

Architecture

Textures

Eclairage/Lightmapping/Ombrage

Evènements

Moteur Physique

Framework Three.js

Avantages et Inconvénients de WebGL face à la concurrence

Démonstration

Informatique et Géomatique 3ème

année

BARAT MARC IGEO3 2013-02-13 3 /

Page 4: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Présentation de WebGL

BARAT MARC IGEO3 2013-02-13 4 /

Page 5: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Qu’est-ce que WebGL?

Informatique et Géomatique 1ère année

Technologie Web 3D OpenSource

BARAT MARC IGEO3 2013-02-13 5 /

A l’origine le Khronos Group consortium de multinationales des multimédias pour

créer un standard ouvert de lecture contenu multimédia riche

Nvidia, ATI, Sun…

Spécification d ’affichage 3D pour navigateurs Web

Google Chrome version 9+

Mozilla Firefox version 4+

Safari avec menu développement activé (désactivé par défaut)

Pas Internet Explorer!

Utilise les pilotes OpenGL de la carte graphique

A travers le code Javascript d’une page Web

Contexte GL

Page 6: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Qu’est-ce que WebGL?

BARAT MARC IGEO3 2013-02-13 6 /

1) L’utilisateur appelle la page

2)Le serveur envoie la page avec le code JavaScript

3) Le navigateur interprète le JavaScript côté client et fait appel aux pilotes OpenGL du système

4)Le navigateur affiche le contenu WebGL dynamiquement à l’utilisateur

Page 7: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Les référentiels

Informatique et Géomatique 1ère année

3 référentiels

BARAT MARC IGEO3 2013-02-13 7 /

Page 8: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Qu’est-ce que WebGL?

Informatique et Géomatique 1ère année

Pipeline WebGL

BARAT MARC IGEO3 2013-02-13 8 /

Page 9: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Qu’est-ce que WebGL?

Informatique et Géomatique 1ère année

WorkFlow WebGL

BARAT MARC IGEO3 2013-02-13 9 /

Page 10: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Textures

BARAT MARC IGEO3 2013-02-13 10 /

Image appliquée sur un maillage

Sources multiples

Pas de texture 3D

Côtés doivent être des puissances de 2!

Mipmapping

Page 11: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Textures

Informatique et Géomatique 1ère année UV Mapping vs Tiling

BARAT MARC IGEO3 2013-02-13 11 /

Page 12: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

MipMapping

Informatique et Géomatique 1ère année Cinématique

BARAT MARC IGEO3 2013-02-13 12 /

Page 13: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Eclairage

BARAT MARC IGEO3 2013-02-13 13 /

Un coefficient I

Modèle classique : éclairage de Phong

3 types d’éclairage :

Ambiant

Diffus

Spéculaire

Page 14: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Lightmapping

BARAT MARC IGEO3 2013-02-13 14 /

Idéal pour des objets statiques avec des sources lumineuses statiques

Eclairage précalculé dans un logiciel de modélisation 3D (comme Blender) et stocké

dans une texture

Peut être combiné avec d’autres techniques d’éclairage comme Phong

Page 15: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Ombrage

BARAT MARC IGEO3 2013-02-13 15 /

Différentes techniques :

Ombrage trivial

Ombrage projeté

Shadowmapping

Très coûteux mais utile pour le réalisme de la scène

Le plus utilisé : Shadowmapping

Page 16: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Shadowmapping

BARAT MARC IGEO3 2013-02-13 16 /

Page 17: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

BARAT MARC IGEO3 2013-02-13 17 /

Effets d’acnée

Aliasing

Shadowmapping

Page 18: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Evènements

BARAT MARC IGEO3 2013-02-13 18 /

Evènements clavier, souris

Redimensionnement de la fenêtre

Plusieurs API pour la gestion de la souris

Pointer Lock API (Comme un FPS)

Autres périphériques (GAMEPAD API, Kinect,

Ecrans Tactiles)

Page 19: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Moteur Physique

BARAT MARC IGEO3 2013-02-13 19 /

Gestion des collisions entre objets

Stucture de données : Octree

Technique du picking : sélection d’un objet à partir d’un pixel du rendu

Page 20: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Three.js

BARAT MARC IGEO3 2013-02-13 20 /

Librairie JavaScript à intégrer au contenu

HTML

Gère tout ce qu’on a vu précédemment de

manière simple

Framework facile à prendre en main

Page 21: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

www.thalesgroup.com

Avantages /Inconvénients de

WebGL

BARAT MARC IGEO3 2013-02-13 21 /

Page 22: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Points forts

BARAT MARC IGEO3 2013-02-13 22 /

Pas de Plugin

HTML5

3D

Page 23: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Sécurité

BARAT MARC IGEO3 2013-02-13 23 /

Technologie critiquée et non supportée par Microsoft

« Source permanente de vulnérabilités très difficiles à corriger »

Réponse de la fondation Mozilla

Même problème dans Silverlight et Molehill(Flash)

« Tout ajout de nouvelles fonctionnalités à une pile logicielle expose les

parties existantes aux contenus potentiellement hostiles, un passage

obligatoire qu'ont dû endurer selon lui les « moteurs des polices de

caractères, les codecs vidéo, les bibliothèques [de rendus] des images... »

Page 24: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Sécurité

BARAT MARC IGEO3 2013-02-13 24 /

Page 25: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Limitations

BARAT MARC IGEO3 2013-02-13 25 /

Compatibilité

JavaScript (pour faire plaisir à Mr Revuz!)

Technologie gourmande

OpenGL Lite

Page 26: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Comparatif

BARAT MARC IGEO3 2013-02-13 26 /

WebGL Silverlight Flash

Licence Standard, open-source

Propriétaire mais une partie sur CodePlex

Propriétaire

Support OS Tous Windows , Mac Tous sauf iOS

Support Navigateurs Manque IE Tous Tous

Communauté + +++ +++

API Faible mais évolue Très riche Très Riche

3D Au cœur de la conception

Performante mais pas prioritaire

Le plus populaire

Sécurité Conception Dangereuse à voir dans le futur

Peu de failles importantes

Failles importantes

Performances +++ ++ ++

Facilité d’utilisation Sans plugin Plugin Plugin

Page 27: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

www.thalesgroup.com

Démonstration

BARAT MARC IGEO3 2013-02-13 27 /

Page 28: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

Webographie

BARAT MARC IGEO3 2013-02-13 28 /

• Spécifications officielles :

• http://www.khronos.org/files/webgl/webgl-reference-card-1_0.pdf

• Site de l’enseignant à l’ESIPE :

• http://www.spacegoo.com/

• Apprendre le WebGL :

• http://learningwebgl.com

Page 29: Introduction à WebGL - igm.univ-mlv.frigm.univ-mlv.fr/~dr/XPOSE2012/Introduction au WebGL/[GL][IG3]Expose... · SOMMAIRE Informatique et Géomatique 1ère année Présentation de

QUESTIONS

?

BARAT MARC IGEO3 2013-02-13 29 /