Shader Example - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Shader Example

Description:

Toon Shader ... 'Mathematics of OpenGL' (chapter of the Red Book) lighting is presented in here. ... and spot lights, all according to the Red Book equations. ... – PowerPoint PPT presentation

Number of Views:62
Avg rating:3.0/5.0
Slides: 32
Provided by: jyunmi
Category:
Tags: example | red | shader | toons

less

Transcript and Presenter's Notes

Title: Shader Example


1
Shader Example
  • Ref GDC 2004 Bill Licea-Kane (ATI Research)

2
Content
  • Helloworld
  • Brick (Ch.6, orangebook)
  • Spheremap
  • ShaderGen

3
Shader Examples from Lighthouse3D
Hello World This pair of vertex/fragment shaders
is about the smallest pair we can write. It
performs only the standard vertex transformation,
and sets the same color for all pixels. It shows
several ways of achieving the vertex
transformation, and introduces the some of the
matrices provided available in GLSL.
Color Shader A simple example of how to get the
color specified in an OpenGL application, using
glColor, all the way to the fragment shader.
Flatten Shader This is a simple example of vertex
manipulation. It starts out by flattening a
teapot, and it ends up with a vertex shader that
animates a wavy teapot, based on a uniform
variable to keep track of time.
Toon Shader In this tutorial it will be shown the
impact of placing certain computations on the
vertex shader vs. the fragment shader. It uses
varying variables to establish communication
between shaders, and shows how to access an
OpenGL lights position.
Lighting Shaders Lighting according to the
"Mathematics of OpenGL" (chapter of the Red Book)
lighting is presented in here. The tutorials
starts with a directional light per vertex, i.e.
as in OpenGL fixed functionality, and then moves
on to per pixel implementations of directional,
point and spot lights, all according to the Red
Book equations.
Texturing This tutorial starts from basic
texturing, accessing texture coordinates and
texels, and moves on to a multitexturing example
where one of the texture units is applied to give
a glow in the dark effect.
4
Sphere Map (from Spec)
5
Sphere Map (Idea)
6
Porting to Shaders
7
Argument Normalization
Let caller normalize
8
(No Transcript)
9
(z1)
10
(No Transcript)
11
(x2y2z2)
12
(No Transcript)
13
Built-in Functions
14
(No Transcript)
15
M in Denominator only
16
pre-invert M
Multiplication better than division
17
Constant Folding
18
(No Transcript)
19
Scale and Bias
20
(No Transcript)
21
Built-in Functions
22
(No Transcript)
23
Remove temporary scalar
24
(No Transcript)
25
Built-in?!
26
(No Transcript)
27
Function Parameters
28
(No Transcript)
29
Add terse comments
30
(No Transcript)
31
Homework
  • Implement sphere map w/o shaders
  • Implement sphere map w/ shaders
  • Implement cubemap w/ and w/o shaders
  • Implement dynamic cubemap
Write a Comment
User Comments (0)
About PowerShow.com