Ogre - PowerPoint PPT Presentation

About This Presentation
Title:

Ogre

Description:

Material: Ambient, Diffuse, Specular, Emission, Shininess. Farbe pro Eckpunkt. 23 ... Specular & Emissive (Front & Back), Vertex (if lighting is off), AmbientScene. 25 ... – PowerPoint PPT presentation

Number of Views:155
Avg rating:3.0/5.0
Slides: 35
Provided by: Jung76
Category:
Tags: ogre | specular

less

Transcript and Presenter's Notes

Title: Ogre


1
Ogre
  • 1 Ungeheuer n, Menschenfresser m
  • http//dict.leo.org
  • 2 Abk. f. OpenGL Grabber
  • http//www.fh-karlsruhe.de/juan0014

2
Thema
  • 3D-Screenshot

3
Inhalt
  • Technische Architektur
  • OpenGL vs. VRML
  • Geometrie
  • Transformationen
  • Material und Texturen
  • Beleuchtung
  • OpenGL-Spezialitäten
  • Logging
  • Ausblick

4
Technische Architektur
Anwendung
opengl32.dll
glu32.dll
Treiber
5
Technische Architektur
Anwendung
opengl32.dll
glu32.dll
Ogre
Treiber
VRML
6
Technische Architektur
  • Anwendungsverzeichnis
  • Anwendung.exe
  • opengl32.dll (Ogre)
  • Systemverzeichnis
  • opengl32.dll
  • glu32.dll

7
OpenGL vs. VRML
  • Beispiel

8
OpenGL vs. VRML
  • VRML

Welt
Transformation
Ansicht
Form
Material
Textur
Geometrie
9
OpenGL vs. VRML
  • VRML

VRML V2.0 utf8 DirectionalLight
ambientIntensity 0.5 color 0.9 0.9 0.9
direction -100 -50 -100 Transform
rotation 1 1 1 0.65 scale 2.5 2.5 2.5
children
Shape appearance Appearance
material Material ambientIntensity
1 diffuseColor 1 0 0
emissiveColor 0 0 0 shininess 1
specularColor 1 1 1
texture ImageTexture url
"IRTEX67B.jpg" repeatS TRUE
repeatT TRUE geometry
Box size 2 2 2
10
OpenGL vs. VRML
  • OpenGL

Licht
glLight
Transformation
glRotate
Material
glMaterial
Textur
glTexImage2D
Geometrie
glNormal
glVertex
11
OpenGL vs. VRML
  • OpenGL

// lighting float diffuseLightColor4
0.9f, 0.9f, 0.9f, 1.0f float
ambientLightColor4 0.45f, 0.45f, 0.45f,
1.0f) glLightfv(GL_LIGHT0, GL_DIFFUSE,
diffuseLightColor) glLightfv(GL_LIGHT0,
GL_AMBIENT, ambientLightColor) //
transformation glRotated(37.24, 1.0, 1.0,
1.0) // material float diffuseColor4
1.0f, 0.0f, 0.0f, 0.0f glMaterialfv(GL_FRONT,
GL_AMBIENT_AND_DIFFUSE, diffuseColor)
// texture glTexImage2D(GL_TEXTURE_2D, 0, 3,
256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE,
pixels) // geometry glBegin(GL_QUADS) glNormal3
d(0.0, 0.0, -1.0) glTexCoord2d(0.0,
0.0) glVertex3d(-1.0, 1.0, -1.0) glTexCoord2d(0
.0, 1.0) glVertex3d( 1.0, 1.0,
-1.0) glTexCoord2d(1.0, 1.0) glVertex3d( 1.0,
-1.0, -1.0) glTexCoord2d(1.0, 0.0) glVertex3d(-1
.0, -1.0, -1.0) ... glEnd()
12
OpenGL vs. VRML
  • Klassenstruktur

13
Geometrie
  • Points
  • Lines,Line strip,Line loop
  • Polygon
  • Triangles,Triangle strip,Triangle fan
  • Quads,Quad strip
  • Evaluators
  • PointSet
  • IndexedLineSet
  • IndexedFaceSet
  • Box, Sphere, etc.
  • ElevationGrid

14
Geometrie
  • Klassenstruktur



1
1
1
15
Geometrie
  • Klassenstruktur

16
Geometrie
  • Beispiel

// geometry glBegin(GL_QUADS) glNormal3d(0.0,
0.0, -1.0) glVertex3d(-1.0, 1.0,
-1.0) glVertex3d( 1.0, 1.0, -1.0) glVertex3d(
1.0, -1.0, -1.0) glVertex3d(-1.0, -1.0,
-1.0) glNormal3d(0.0, 0.0, 1.0) glVertex3d(-1.0
, -1.0, 1.0) glVertex3d( 1.0, -1.0,
1.0) glVertex3d( 1.0, 1.0, 1.0) glVertex3d(-1.
0, 1.0, 1.0) ... glEnd()
geometry IndexedFaceSet coord Coordinate
point -1 1 -1, 1 1 -1, 1 -1
-1, -1 -1 -1, -1 -1 1, 1 -1 1,
1 1 1, -1 1 1, ...
normal Normal vector 0 0 -1, 0 0
-1, 0 0 -1, 0 0 -1, 0 0 1,
0 0 1, 0 0 1, 0 0 1, ...
coordIndex 0 1 2 3 -1, 4
5 6 7 -1, ...
17
Transformationen
  • Stack
  • Modelview, Projection, Texture
  • Baum
  • Transform, Viewpoint, TextureTransform





18
Transformationen
  • Zerlegung einer
  • Transformationsmatrix

19
Transformationen
  • Klassenstruktur

1


1
10
1
20
Transformationen
  • Klassenstruktur

BasicTransformation
LoadIdentity
MultIdentity
SimpleTransformation
MatrixTransformation
Rotation
Scale
Frustum
LoadMatrix
MultMatrix
Ortho
21
Transformationen
  • Beispiel

// transformation glRotated(37.24, 1.0, 1.0,
1.0) glScaled(2.5, 2.5, 2.5) glBegin(GL_QUADS)
... glEnd() ... glPushMatrix() glTranslated(-
10.0, 20.0, 0.0) ... glPopMatrix() ...
Transform rotation 1 1 1 0.65 children
Transform scale 2.5 2.5 2.5
children Shape ...
... Transform
translation -10 20 0 children
...
22
Material und Texturen
  • Material Ambient, Diffuse, Specular, Emission,
    Shininess
  • Farbe pro Eckpunkt
  • Unterscheidung nach Vorder- und Rückseite
  • nicht-texturierte Glanzlichter

23
Material und Texturen
  • Texturen und Texturkoordinaten
  • Multitexturing(Lightmaps, Bumpmapping,
    Environment Mapping, ...)

24
Material und Texturen
  • Klassenstruktur

1

1

10
1

25
Material und Texturen
  • Beispiel Material

Shape appearance Appearance material
Material diffuseColor 1 0 0
ambientIntensity 1 specularColor 1 1 1
shininess 1 geometry IndexedFaceSet
...
// material float diffuseColor4 1.0f,
0.0f, 0.0f, 0.0f glMaterialfv(GL_FRONT,
GL_AMBIENT_AND_DIFFUSE, diffuseColor) float
specularColor4 1.0f, 1.0f, 1.0f,
1.0f glMaterialfv(GL_FRONT, GL_SPECULAR,
specularColor) glMateriali(GL_FRONT,
GL_SHININESS, 128)
26
Material und Texturen
  • Beispiel Texturen

Shape appearance Appearance texture
ImageTexture url "IRTEX67B.jpg"
geometry IndexedFaceSet coord
Coordinate point -1 1 -1, 1 1 -1,
1 -1 -1, -1 -1 -1, ... coordIndex
0 1 2 3 -1, ... texCoord
TextureCoordinate point 0 0, 0
1, 1 1, 1 0, ...
// texture glTexImage2D(GL_TEXTURE_2D, 0, 3,
256, 256, 0, GL_RGB, GL_UNSIGNED_BYTE,
pixels) // geometry glBegin(GL_QUADS) glTexCoor
d2d(0.0, 0.0) glVertex3d(-1.0, 1.0,
-1.0) glTexCoord2d(0.0, 1.0) glVertex3d( 1.0,
1.0, -1.0) glTexCoord2d(1.0, 1.0) glVertex3d(
1.0, -1.0, -1.0) glTexCoord2d(1.0,
0.0) glVertex3d(-1.0, -1.0, -1.0) ... glEnd()
27
Beleuchtung
  • PointLight, DirectionalLight, Spotlight
  • Parameter Ambient, Diffuse, Specular, Spot,
    Attenuation
  • Ambientes Licht für gesamte Szene
  • komplett verschiedene Beleuchtung pro Objekt

28
Beleuchtung
  • Klassenstruktur

1
8
29
Beleuchtung
  • Beispiel

DirectionalLight ambientIntensity 0.5
color 0.9 0.9 0.9 direction -100 -50 -100
// lighting float diffuseLightColor4
0.9f, 0.9f, 0.9f, 1.0f float
ambientLightColor4 0.45f, 0.45f, 0.45f,
1.0f) glLightfv(GL_LIGHT0, GL_DIFFUSE,
diffuseLightColor) glLightfv(GL_LIGHT0,
GL_AMBIENT, ambientLightColor)
30
OpenGL-Spezialitäten
Arrays
glNormal3d(0.0, 0.0, -1.0) glTexCoord2d(0.0,
0.0) glVertex3d(-1.0, 1.0, -1.0) glTexCoord2d(0
.0, 1.0) glVertex3d( 1.0, 1.0, -1.0) ...
PseudoArray
vs.
glNormalPointer(...) glTexCoordPointer(...) glVe
rtexPointer(...) glDrawArrays(...) glDrawElemen
ts(...)
SequenceArray
31
OpenGL-Spezialitäten
Display-Listen
GLState
1

1

32
OpenGL-Spezialitäten
GLU- und GLUT-Funktionen Extensions
glu32.dll
opengl32.dll
glut.dll
glGetString(GL_EXTENSIONS)
Anwendung
" ... GL_ARB_multitexture GL_EXT_abgr ... "
opengl32.dll
wglGetProcAddress ("glMultiTexCoord2fARB")
33
Logging
Protokoll aller Funktionsaufrufe
glBegin -- Return address 0x00425B48 mode GL
_QUADS glTexCoord4d -- Return address
0x0543DE36 s 0.273438 t 0.472656 r
0 q 1
  • Debugging
  • Lerneffekt
  • 60 GB-Platten ausnutzen ?

34
Ausblick
  • ZusammenfassungOpenGL rein, VRML raus
  • LightmapsVRML-Extensions / Nachberechnung
  • 2,5-D vs. 3-DTransform Lighting
  • Portierung (MacOS, Linux)
  • Robustheit
  • weitere Ausgabeformate
  • ...
Write a Comment
User Comments (0)
About PowerShow.com