webgl tutorijal

43
WebGL 3D GRAFIKA NA INTERNETU www.quinced.com

Upload: quinced

Post on 11-Jul-2015

290 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: WebGL tutorijal

WebGL3D GRAFIKA NA INTERNETU

www.quinced.com

Page 2: WebGL tutorijal

Preslikavanje realnosti

Page 3: WebGL tutorijal

ShadersOkruženje

KvadratPojmoviPipeline

TransformacijeKocka

PojmoviTeksture

SvetloAnimacija

SferaOkruženje

Istorija, budućnostPrimena

Page 4: WebGL tutorijal

OpenGL

OpenGL ES

WebGL

Page 5: WebGL tutorijal

LOW LEVELmora malo da se misli

Page 6: WebGL tutorijal

model > priprema > Crtaj! > vertex shader > fragment shader

Page 7: WebGL tutorijal

HTML5 Canvas

Page 8: WebGL tutorijal

Step by step

Page 9: WebGL tutorijal

gl_Position = vec4(vpos, 0, 1);

gl_FragColor = vec4(0,0,0,1);

function getShader(...)

function initShaders()

function initWebGL(…)

function start()

Page 10: WebGL tutorijal
Page 11: WebGL tutorijal
Page 12: WebGL tutorijal
Page 13: WebGL tutorijal

Setting the scene

Page 14: WebGL tutorijal
Page 15: WebGL tutorijal

gl-matrix

Page 16: WebGL tutorijal

gl_Position = pMatrix * mvMatrix * vec4(vpos, 1);

mat4.perspective(pMatrix, Math.PI/4, 400 / 400, 1, 1000);

mat4.translate(mvMatrix, mvMatrix, [0, 0, -10.0]);

mat4.rotateY(mvMatrix, mvMatrix, Math.PI/6);

mat4.rotateX(mvMatrix, mvMatrix, Math.PI/6);

gl.drawElements(gl.TRIANGLES, 36, gl.UNSIGNED_SHORT, 0);

Page 17: WebGL tutorijal

varying vec4 vColor;

vColor = aVertexColor;

gl_FragColor = vColor;

Page 18: WebGL tutorijal

varying vec2 vTexture;

vTexture = aVertexTexture;

uniform sampler2D uSampler;

gl_FragColor = texture2D(uSampler, vTexture);

textureCoordinates = [...]

function initTextures()

gl.texImage2D(...)

gl.texParameteri(...)

gl.activeTexture(...)

Page 19: WebGL tutorijal

gl_FragColor = vec4(textureColor.rgb*vLighting, textureColor.a)

attribute vec3 aVertexNormal;

uniform mat3 uNormalMatrix;

transformedNormal = uNormalMatrix * aVertexNormal;

ambientLightColor = vec3(0.6, 0.6, 0.6);directionalLightColor = vec3(0.0, 0.8, 0.7);directionalVector = vec3(0.5, 0.5, 0.5);

directional = max(dot(transformedNormal, directionalVector), 0.0);

vLighting = ambientLightColor + (directionalLightColor * directional);

vertexNormals = [...]

mat3.normalFromMat4(normalMatrix, mvMatrix);

Page 20: WebGL tutorijal

window.requestAnimationFrame(tick);

function animate()

Page 21: WebGL tutorijal

vertices = [...];vertexNormals = [...];textureCoordinates = [...];triangles = [...];

Page 22: WebGL tutorijal
Page 23: WebGL tutorijal

Vertexi (koordinate)

Boje

Mapiranje tekstura

Normale za osvetljenje

Matrice transformacija

Vertex shader

Fragment shader

Animacija

attribute

uniform

varying

Matematika

Page 24: WebGL tutorijal

How it’s made

Page 25: WebGL tutorijal
Page 26: WebGL tutorijal
Page 27: WebGL tutorijal
Page 28: WebGL tutorijal
Page 29: WebGL tutorijal

Šta fali?Mnoge oblasti: napredno osvetljenje, upravljanje tekstom, interakcija sa korisnikom, blending, manipulacija 3D modelima….

Komunikacija/komentari

Three.js

Interakcija

Page 30: WebGL tutorijal

Zašto tutorijal?

Page 31: WebGL tutorijal

Odnos prema učenju

Page 32: WebGL tutorijal

INFORMACIJEVIŠE sadržaja

MANJE kvalitetnog

Page 33: WebGL tutorijal

INDIVIDUALNOSTStudent > Profesor/Mentor?Profesor/Mentor > Student?

Page 34: WebGL tutorijal

Niko nema TOLIKO vremena da traži odgovor(ili bar tako oni misle)

Page 35: WebGL tutorijal

Šta će očekivati studenti za 10 godina?(ili bar šta mi mislimo o tome)

Page 36: WebGL tutorijal

Student će i dalje trebati mentora TUTORA

Page 37: WebGL tutorijal

> Saradnja / komunikacija[IZMEĐU SVIH KOJI KOMUNICIRAJU-RAZMENJUJU]

+ Alati / načini

Page 38: WebGL tutorijal
Page 39: WebGL tutorijal
Page 40: WebGL tutorijal

E-Learning?

Page 41: WebGL tutorijal

E-Learning?

pa….ne baš

Page 42: WebGL tutorijal

Studenti

Pismenost (pravopisna, akademska, idejna, poslovna, digitalna)

Kritika i reakcija na kritiku

Izbegavanje “lošeg” društva

Poštovanje nauke

Otkrivanje talenata van okvira ocena

Jasne misli

Kompromis nepomirljivog (naučna institucija <> produkcija radne snage)

Page 43: WebGL tutorijal

Hvala!