gpugi: global illumination effects on the gpu lászló szirmay-kalos, tu budapest lászló szécsi,...

15
GPUGI: GPUGI: Global Illumination Global Illumination Effects on the GPU Effects on the GPU László Szirmay-Kalos, TU László Szirmay-Kalos, TU Budapest Budapest László Szécsi, TU Budapest László Szécsi, TU Budapest Mateu Sbert, U of Girona Mateu Sbert, U of Girona

Post on 21-Dec-2015

217 views

Category:

Documents


3 download

TRANSCRIPT

GPUGI: GPUGI: Global Illumination Global Illumination Effects on the GPUEffects on the GPULászló Szirmay-Kalos, TU BudapestLászló Szirmay-Kalos, TU Budapest

László Szécsi, TU BudapestLászló Szécsi, TU Budapest

Mateu Sbert, U of GironaMateu Sbert, U of Girona

Global Illumination Global Illumination renderingrendering

pixel1. Visibility determination2. Illumination computation- New visibility and Illumination tasks

Pure Local IlluminationPure Local Illumination

pixel1. Color computation uses just local information2. Visibility only from the camera

Visibility solution: Visibility solution: depth or alpha depth or alpha compositingcompositing

pixel

Ray tracingversus

Rasterization

Local illumination Local illumination

processing processing pipelinepipeline

Rasterization CompositingobjectsColor + Depth

image

Independent processing:1. Pipeline operation2. Parallel branches

x

y

z

eye

Transformationand lighting

Clipping

1

Why is it fast?Why is it fast?

Proc 2Proc 1

Proc 1

Proc 21

Proc 22

Pipelining

Parallelism

Elements are processed INDEPENDENTLY• No internal storage• Parallel execution without synchronization

GPU hardware GPU hardware achitectureachitecture

Interface

Transform+Illumination

Clipping + Hom.division+ Viewport transform

Projection + Rasterization + Linear interpolation

Texturing

Compositing (Z-buffer, transparency)

Texturememory

vertices

triangles

fragments

VertexShader

FragmentShader

Vertex shaderVertex shader

Clipping: -w<X<w, -w<Y<w, -w<Z<w, 0<color<1

StateTransformsLightsources

Materials

POSITION, NORMAL, COLOR0, TEXTCOORD0,…

glVertex glNormal glColor glTextCoordglBegin(GL_TRIANGLES)

glEnd( )

POSITION, COLOR0, TEXTCOORD0, … for triangle vertices

Homogeneous division: x=X/w, y=Y/w, z=Z/w

POSITION, COLOR0, TEXTCOORD0,… for triangle vertices

IlluminationVertex shader

Viewport transform: xv = center.x + viewsize.x * x / 2

CPU

GPU

FragmentFragment shader shader

StateTexture id,

texturing environment

POSITION, COLOR0, TEXTCOORD0,… for triangle vertices

POSITION, COLOR

Compositing: blending, z-buffering

Projection, Rasterization and linear interpolation

Fragment shaderTexturing:

tex2d(u,v)*color0

POSITION, COLOR0, TEXTCOORD0 for fragments

Texture memory

Frame buffer

Z-cull

GPU stream GPU stream programmingprogramming

Clipping

Triangle setup + rasterization+

Linear interpolation

Compositing

VertexShader

PixelShader

Change of vertex properties

Color computation fromproperties and textures

Framebuffer

CPUVertices + properties:Input stream of vertices 10..20 x 4 floats

Conditional reduction

Texturememory

Keys to GPUGIKeys to GPUGI

Multipass renderingMultipass rendering– Results of a previous pass can only be usedResults of a previous pass can only be used

Render-to-textureRender-to-texture– Results of one pass can be used by another passResults of one pass can be used by another pass

Floating point texturesFloating point textures– HDR radiance and geometric data in texture HDR radiance and geometric data in texture

memorymemory

Storing global geometric and illumination Storing global geometric and illumination information in textures: how?information in textures: how?

Texture atlas Texture atlas == unfoldingunfolding

u

v

x

yz

How to store geometry in How to store geometry in textures?textures? It is up to youIt is up to you! The texture memory is a ! The texture memory is a

RAM addressed by RAM addressed by u,vu,v pairs. pairs. – E.g. E.g. nn m m NURBS surface defined by control NURBS surface defined by control

pointspoints

– CCijij = T[i/n][j/m].xyz, = T[i/n][j/m].xyz, wwijij = T[i/n][j/m].w = T[i/n][j/m].w

Depth image, Z-buffered environment Depth image, Z-buffered environment maps (distance impostors).maps (distance impostors).

Geometry image.Geometry image.

distanceradiance

Z-buffered envZ-buffered env..maps (Patow95)maps (Patow95), , distance impostordistance impostor

Geometry imageGeometry image (Gu02)(Gu02) Texture maps storing the 3D Texture maps storing the 3D

points and normal vectorspoints and normal vectors

[r,g,b] = [x,y,z]