GLSL OpenGL Shading Language. Waldemar Celes Departamento de Informática, PUC-Rio inf. puc-rio. br

Size: px
Start display at page:

Download "GLSL OpenGL Shading Language. Waldemar Celes Departamento de Informática, PUC-Rio celes @ inf. puc-rio. br"

Transcription

1 OpenGL Shading Language Waldemar Celes Departamento de Informática, PUC-Rio inf. puc-rio. br

2 Pipeline Programável Vertex & fragment shader Vertex program Aplicação Transformação Modelagem e Visualização Iluminação Projeção Clipping Mapeamento de Tela Rasterização Mapeamento de Textura Combinação Blend Teste α,s,z Frame Buffer Fragment program Aplicação Geometria Rasterização

3 Pipeline Programável w Controle sobre operações de vértices w Controle sobre operações de fragmentos w Operações substituídas n Transformação n Iluminação n Projeção n Geração de coordenadas de textura n Aplicação de textura n Combinação w Geração de geometria w CPU GPU

4 Vertex shader w Operações substituídas n Transformação de vértices l Modelview e projection n Transformação de normais l Transformação, re-escala, normalização n Iluminação por vértice n Geração de coordenadas de textura n Geração de coordenadas de clip n Definição de tamanho de ponto

5 Vertex shader w Operações não substituídas n Clipping contra frustum n Divisão da perspectiva n Mapeamento de tela l Transformação de viewport l Transformação de Z

6 Vertex shader w Recebe um vértice n Não transformado e não iluminado w Transforma o vértice n As 4 componentes devem ser preenchidas w Opcionalmente n Gera coordenadas de textura l Aplica transformações l A coordenada w deve ser preenchida n Ilumina n Calcula fator de fog n Calcula tamanho de ponto n etc.

7 Vertex shader w Não cria ou destrói vértice n 1 vértice de entrada n 1 vértice de saída w Não há informação topológica n Não há aresta, face n Não há info de vértices vizinhos l Podemos usar atributos com info explicitada w Carregado dinamicamente n Como objetos de textura

8 Fragment shader w Aplicado a qualquer fragmento n Ponto, linha, triângulo, pixel, bitmap n Pode-se descartar fragmentos w Processamento n Fragmento a fragmento, independentes w Operações substituídas n Texturing n Color sum l Soma das cores primária e secundária pelo programa w Acesso ao stencil e buffers auxiliares n Possível futura extensão

9 230 CHAPTER 6 Thinking Outside the Box: Nonstock Shaders Arquitetura GLSL básica 101 The OpenGL Shading Language (GLSL) is a C-like high-level language that is compiled and linked by your OpenGL implementation and (usually) runs entirely on the graphics hardware. Shader programs look a lot like C, they start with the main function as their entry point, and you can write functions in GLSL that accept parameters and return values. Vertex & fragment shader Figure 3.1 from Chapter 3 is repeated here as Figure 6.1 and shows our basic shader architecture. Application Code: C/C++, etc. OpenGL API Client Texture Data Texture Data Uniforms Uniforms Vertex Shader void main() { Positions } Vertex Primitive Assembly (Ins) Attributes Outs Server ptg Ins Fragment Shader void main() { } FIGURE 6.1 Our basic shader architecture. 9

10 perspective. Variables and Data Types A good place to start for learning GLSL is to discuss the data types available to you. There are only four: integers (both signed and unsigned), floats (single precision only as of OpenGL 3.3), and Booleans (bool). There are no pointers in GLSL, and there are no strings or characters of any kind. Functions can return any of these data types but can also be declared as void, but again, no void pointers allowed. The use of these data types in GLSL mirrors their usage in C/C++. Tipos de variáveis 6 bool bdone = false; // Boolean true or false int ivalue = 42; // Signed integer 232 CHAPTER uint uivalue 6 Thinking = 3929u; Outside // the unsigned Box: Nonstock integer Shaders float fvalue = 42.0f; // Floating point value 232 CHAPTER 6 Thinking Outside the Box: Nonstock Shaders Types Tipos de TABLE vetores 6.1 GLSL Vector built-in Data Types vec2, vec3, vec4 Construtores TABLE Vector 6.1 TypesGLSL Vector Data Types An exciting and unique feature Description of GLSL (as compared to C/C++) is the availability of vector data types. All four of the basic data types can be stored in two-, three-, or fourdimensional 2, 3, and 4 component floating-point vectors Types vectors. The Description complete list of vector data types is listed in Table 6.1. ivec2, ivec3, ivec4 2, 3, and 4 component integer vectors vec2, uvec2, vec3, uvec3, vec4 uvec4 2, 3, 2, and 3, and 4 4 component floating-point unsigned integer vectors vectors ivec2, bvec2, ivec3, bvec3, ivec4 bvec4 2, 3, 2, and 3, and 4 component 4 component integer Boolean vectors vectors uvec2, uvec3, uvec4 2, 3, and 4 component unsigned integer vectors bvec2, bvec3, bvec4 2, 3, and 4 component Boolean vectors A vector data type can be declared just like any other kind of variable; for example, you would declare a vertex position as a four-component floating-point vector like this: A vector data type can be declared just like any other kind of variable; for example, you would vec4 declare vvertexpos; a vertex position as a four-component floating-point vector like this: Download from vec4 You vvertexpos; can also initialize a vector with a constructor: You vec4 can vvertexpos also initialize = vec4(39.0f, a vector with 10.0f, a constructor: 0.0f, 1.0f); vec4 vvertexpos = vec4(39.0f, 10.0f, 0.0f, 1.0f); This should not be confused with C++ class constructors. GLSL vector data types are not classes; they are their own built-in data type. Vectors can be assigned to one another, This should not be confused with C++ class constructors. GLSL vector data types are not added together, scaled by a scalar (nonvector type), and so on. classes; they are their own built-in data type. Vectors can be assigned to one another, added vvertexpos together, = scaled voldpos by + a scalar voffset; (nonvector type), and so on. 10

11 Vetores built-in Sufixos: vvertexpos.x xyzw, rgba, = 3.0f; stpq Swizzling classes; they are their own built-in data type. Vectors can be assigned to one another, vvertexpos added together, = voldpos scaled by + voffset; a scalar (nonvector type), and so on. added together, scaled by a scalar (nonvector type), and so on. vvertexpos = vnewpos; vvertexpos voldpos + voffset; vvertexpos += = voldpos vec4(1.0f, + voffset; 1.0f, 0.0f, 0.0f); vvertexpos = vnewpos; vvertexpos *= = vnewpos; 5.0f; vvertexpos += vec4(1.0f, 1.0f, 0.0f, 0.0f); vvertexpos *= += 5.0f; vec4(1.0f, 1.0f, 0.0f, 0.0f); Another vvertexpos unique *= 5.0f; feature to GLSL is how we can address individual elements of a vector. If you Another are familiar unique feature with the union to GLSL is construct how we from can address C/C++, individual vectors are elements like unions of a on vector. steroids. If We Another you use are the familiar unique dot notation with feature the to to address union GLSL construct is up how to from four we can C/C++, vector address elements, vectors individual are but like we unions elements can use on any of steroids. a of vector. the If following you We use are the three familiar dot notation sets of identifiers: with the to union address xyzw, construct up to rgba, four from vector or stpq. C/C++, elements, Typically vectors but we are we would can like use use unions any the xyzw of on the set steroids. of We following identifiers use the three when dot sets referring notation of identifiers: to vertex to address xyzw, type up rgba, data. to four or stpq. vector Typically elements, we would but we use can the use xyzw any set of the following of identifiers three when sets referring of identifiers: to vertex xyzw, type rgba, data. or stpq. Typically we would use the xyzw set vvertexpos.xy of vvertexpos.x identifiers = when = vec2(3.0f, 3.0f; referring 5.0f); to vertex type data. vvertexpos.xyz = vnewpos.xyz; vvertexpos.xy = 3.0f; vec2(3.0f, 5.0f); GLSL vvertexpos.xy vvertexpos.xyz = vnewpos.xyz; vec2(3.0f, 5.0f); Then rgba when doing color work. vvertexpos.xyz = vnewpos.xyz; voutputcolor.r Then choice rgba when of which = doing 1.0f; set color of identifiers work. you use is completely arbitrary as far as GLSL is voutputcolor.rgba concerned; for example, Then voutputcolor.r rgba when = 1.0f; doing = vec4(1.0f, you could color work. 1.0f, easily 0.5f, do something 1.0f); like this: GLSL vtexcoord.st voutputcolor.rgba = vvertex.st; = vec4(1.0f, 1.0f, 0.5f, 1.0f); And voutputcolor.r finally, when = working 1.0f; with texture coordinates, stpq. The choice of which set of identifiers you use is completely arbitrary as far as GLSL is voutputcolor.rgba = vec4(1.0f, 1.0f, 0.5f, 1.0f); vtexcoord.st However, And concerned; finally, what for when = example, you vec2(1.0f, working cannot you with could do 0.0f); is texture easily mix the do coordinates, something different like groups stpq. this: within a single vector access, such as this: And vtexcoord.st finally, when = vec2(1.0f, vvertex.st; working 0.0f); with texture coordinates, stpq. vtexcoord.st = vvertex.xt; // mixing of x and t is not allowed! vtexcoord.st However, what = you vec2(1.0f, cannot do is 0.0f); mix the different groups within a single vector access, such as this: Vector data types also support swizzling. A swizzle is when you swap two or more vector vtexcoord.st = vvertex.xt; // mixing of x and t is not allowed! elements. For example, if you were converting color data from RGB ordering to BGR ordering, Vector the data following types also line support of code swizzling. would A do swizzle the trick: is when you swap two or more vector elements. For example, if you were converting color data from RGB ordering to BGR Download ordering, the following line of code would do the trick: Download from from vnewcolor.bgra = voldcolor.rgba; Vector vnewcolor.bgra data types = are voldcolor.rgba; not only native to GLSL, they are native to the hardware. They are fast, and operations are performed on all the components at once. For example, Download the from Vector data types are not only native to GLSL, they are native to the hardware. They are following fast, and operations operation are performed on all the components at once. For example, the following operation vvertex.x = vothervertex.x INF f; - W. Celes - PUC-Rio 11

12 TABLE 6.2 Matrizes built-in Matrix Types In addition to the vector data types, GLSL supports a number of matrix types. Unlike the vector types, however, the matrix types are all floating-point only sorry, no integer or Boolean matrices, as these are not practically useful. Table 6.2 lists the supported matrix types. Type mat2, mat2x2 mat3, mat3x3 mat4, mat4x4 CHAPTER mat2x3 6 mat2x4 mat3x2 GLSL Matrix Types Description 2 columns and 2 rows 3 columns and 3 rows 4 columns and 4 rows Thinking Outside 2 columns the Box: and Nonstock 3 rows Shaders 2 columns and 4 rows 3 columns and 2 rows A mat3x4 matrix is essentially an array 3 columns of vectors and 4 rows in GLSL column vectors, in fact (a review of column mat4x2 4 columns and 2 rows CHAPTER major 6 Thinking vector Outside ordering the from Box: Chapter Nonstock 4, Shaders Basic Transformations: A Vector/Matrix Primer, mat4x3 may be in order here). 4 columns For and example, 3 rows to set the last column of a 4 x 4 matrix, you would write code similar to this: mmodelview[3] A matrix is essentially = vec4(0.0f, an array 0.0f, of vectors 0.0f, in 1.0f); GLSL column vectors, in fact (a review of column major vector ordering from Chapter 4, Basic Transformations: A Vector/Matrix Conversely, Primer, may to be retrieve in order the here). last column For example, of a matrix: to set the last column of a 4 x 4 matrix, you would write code similar to this: Download from vec4 vtranslation = mmodelview[3]; mmodelview[3] = vec4(0.0f, 0.0f, 0.0f, 1.0f); Essencialmente, array de vetores por coluna Or even a finer grained query: Conversely, to retrieve the last column of a matrix: vec3 vtranslation = mmodelview[3].xyz; vec4 vtranslation = mmodelview[3]; Matrices can be multiplied by vectors too; a common use of this is to transform a vertex by Or the even ModelViewProjection a finer grained query: matrix, such as: vec3 vtranslation = mmodelview[3].xyz; vec4 vvertex; mat4 mvpmatrix; 12

13 234 Matrizes built-in Construtores Matrices can be multiplied by vectors too; a common use of this is to transform a vertex Matrices by the ModelViewProjection can be multiplied by matrix, vectors such too; as: a common use of this is to transform a vertex by the ModelViewProjection matrix, such as: vec4 vvertex; vec4 mat4 vvertex; mvpmatrix; mat4 CHAPTER mvpmatrix; 6 Thinking Outside the Box: Nonstock Shaders voutpos = mvpmatrix * vvertex; voutpos A matrix = is mvpmatrix essentially * an vvertex; array of vectors in GLSL column vectors, in fact (a review of Also, column just major like vectors, ordering the matrix from data Chapter types have 4, Basic their Transformations: own constructors A too. Vector/Matrix For example, Also, to Primer, hard just code may like an vectors, be inline order the 4 x here). matrix 4 matrix, For data example, you types can have write to set their code the own last like column constructors this: of a 4 too. x 4 For matrix, example, you to hard code an inline 4 x 4 matrix, you can write code like this: mat4 would vtransform write code = similar mat4(1.0f, to this: 0.0f, 0.0f, 0.0f, mat4 mmodelview[3] vtransform = = vec4(0.0f, mat4(1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f); 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, Conversely, to retrieve the 0.0f, last column 0.0f, 1.0f, 0.0f, of a matrix: 0.0f, 1.0f); 0.0f, 0.0f, 0.0f, 1.0f); In vec4 this vtranslation case we made = the mmodelview[3]; transformation matrix the identity matrix. A quicker constructor In for this matrices case we that made fills the in just transformation the diagonal matrix with a the single identity value matrix. can also A be quicker used. constructor for Or mat4 matrices even a finer vtransform that grained fills = mat4(1.0f); in just query: the diagonal with a single value can also be used. vec3 vtranslation = mmodelview[3].xyz; mat4 vtransform = mat4(1.0f); Operações Storage com Qualifiers vetores Matrices can be multiplied by vectors too; a common use of this is to transform a vertex Storage Shader by the ModelViewProjection variable Qualifiers declarations may matrix, optionally such as: have a storage qualifier specified. Qualifiers are used to flag variables as input variables (in or uniform), output variables (out), or Shader vec4 vvertex; variable declarations may optionally have a storage qualifier specified. Qualifiers constants (const). Input variables receive data either from the OpenGL client (attributes are mat4 used mvpmatrix; to flag variables as input variables (in or uniform), output variables (out), or submitted via C/C++) or from the previous shader stage (for example, variables passed constants (const). Input variables receive data either from the OpenGL client (attributes from the vertex shader to the fragment shader). Output variables are variables you write to submitted via C/C++) or from the previous shader stage (for example, variables passed in any of the shader stages that you want to be seen by the subsequent shader stages, for from voutpos the = vertex mvpmatrix shader * to vvertex; the fragment shader). Output variables are variables you write to example, passing data from the vertex shader to the fragment shader or writing the final in any of the shader stages that you want to be seen by the subsequent shader stages, for fragment color by the fragment shader. Table 6.3 lists the primary variable qualifiers. example, Also, just passing like vectors, data from the matrix the vertex data shader types have to the their fragment own constructors shader or writing too. For the example, final fragment to hard code color an by inline the fragment 4 x 4 matrix, shader. you Table can write 6.3 lists code the like primary this: variable qualifiers. mat4 vtransform = mat4(1.0f, 0.0f, 0.0f, 0.0f, 13

14 ?$%&#9+5296$+',$GJ&9#66-2'6?;7 %&# Operadores M*-(KN-+OP(H*9"#+?(P9+?79?-(*9.($*-(C%22%<#+?(%N-&9$%&.5 K9#:#,#':# %&#9+529$41+66 %&# N662:-+5->-5C ((4(e*#?*-.$f N9&-+$*-$#/92(?&%7N#+? O*P ((((((W6 A F 9&&9I(.7Y./&#N$ C7+/$#%+(/922(9+"(/%+.$&7/$%&(.$&7/$7&-( C#-2"(%&(@-$*%"(.-2-/$%&0(.<# 2-& N%.$(C#Q(#+/&-@-+$(9+"("-/&-@-+$ N&-C#Q(#+/&-@-+$(9+"("-/&-@-+$ 7+9&I M*N O*P, GG**AA GG**AA G**A**V**X P-C$($%(=#?*$ =#?*$($%(P-C$ I***H****J P-C$($%(=#?*$ D 9""#$#:- G**A P-C$($%(=#?*$ G Y#$X<#.-(.*#C$ KK****LL P-C$($%(=#?*$ T &-29$#%+92 K****L****KW***LW P-C$($%(=#?*$ U -]792#$I WW***XW P-C$($%(=#?*$ [ Y#$X<#.-(9+"( U P-C$($%(=#?*$ 4J Y#$X<#.-(-Q/27.#:-(%&( S P-C$($%(=#?*$ 44 Y#$X<#.-(#+/27.#:-(%&( T P-C$($%(=#?*$ 4A 2%?#/92(9+" UU P-C$($%(=#?*$ 4F 2%?#/92(-Q/27.#:-(%& SS P-C$($%(=#?*$ 4E 2%?#/92(#+/27.#:-(%& T*T P-C$($%(=#?*$ 4D.-2-/$#%+ [*Y =#?*$($%(P-C$ 4G 6..#?+@-+$ 9&#$*@-$#/(9..#?+@-+$. W GW**AW IW**HW JW****KKW***LLW UW**SW**TW =#?*$($%(P-C$ 4T(e2%<-.$f.-]7-+/- D P-C$($%(=#?*$ M*-&-(#.(+%(9""&-..X%C(%N-&9$%&(+%&(9("-&-C-&-+/-(%N-&9$%&5((M*-&-(#.(+%($IN-/9.$(%N-&9$%&i(/%+.$&7/$%&.( 14

15 Qualificadores de tipos <none>: TABLE variável 6.3 Variable local, Storage sem Qualifiers visibilidade externa in out const Global: variável passada por estágio anterior Parâmetro: in centroid variável local regular Global: uniform variável passada para próximo estágio Parâmetro: variável de saída inout Qualifier Description <none> Just a normal local variable, no outside visibility or access. in out A compile-time constant, or a read-only parameter to a function. A variable passed in from a previous stage. Passed in from a previous state, uses centroid interpolation. Passed out to the next processing stage or assigned a return value in a function. out centroid Passed out to the next processing stage, uses centroid interpolation. inout A read/write variable. Only valid for local function parameters. Value is passed in from client code and does not change across vertices. One variable qualifier inout can only be used when declaring a parameter to a function. Because GLSL does not support pointers (or references), this is the only way to pass a value to a function and allow the function to modify and return the value of the same variable. For example, this function declaration Parâmetro: variável de entrada e saída GLSL const int CalculateSometing(float ftime, float fstepsize, inout float fvariance); would return an integer (perhaps a pass/fail flag), but also could modify the value of the fvariance variable, and the calling code could read the new value back from the variable as well. In C/C++, to allow modification of a parameter, you might well declare the function this way using a pointer: Global: constante para tempo de compilação Parâmetro: read-only int CalculateSomething(float ftime, float fstepsize, float* fvariance); 6 The centroid qualifier has no effect unless rendering is being done to a multisampled 15

16 as well. In C/C++, to allow modification of a parameter, you might well tion this way using a pointer: int CalculateSomething(float ftime, float fstepsize, float* fvaria Qualificadores The centroid qualifier has no effect unless rendering is being done to a buffer. In a single sampled buffer, interpolation is always performed from pixel. With multisampling, when the centroid qualifier is used, the inte selected so that it falls within the primitive and the pixel. See Chapter 9 Buffers: Beyond the Basics, for more details about how multisampling w Especificação de interpolação entre estágios <none>, smooth: interpolados com correção perspectiva noperspective: interpolados linearmente By default parameters are interpolated between shader stages in a perspe manner. You can specify nonperspective interpolation with the nopersp even no interpolation at all with the flat keyword. You can also option keyword to explicitly state the variable is smoothly interpolated in a per manner, but that is already the default. Here are a few example declarat flat: não interpolados centroid: usado em interpolação para multi-samples smooth out vec3 vsmoothvalue; flat out vec3 vflatcolor; noperspective float vlinearlysmoothed; 16

17 Variáveis built-in Vertex shader in int gl_vertexid; in int gl_instanceid; out vec4 gl_position; out float gl_pointsize; out float gl_clipdistance[]; Fragment shader in vec4 gl_fragcoord; in bool gl_frontfacing; in float gl_clipdistance; in float gl_pointsize; in float gl_clipdistance[]; in int gl_primitiveid; in int gl_sampleid; OpenGL 2.*: Vertex shader in: attribute out: varying Fragment shader in: varying in vec2 gl_sampleposition; out vec4 gl_fragcolor; out vec4 gl_fragdata[]; out float gl_fragdepth; out int gl_samplemask[]; 17

18 Exemplo de shader Vertex shader #version 330 in vec4 vvertex; in vec4 vcolor; out vec4 vvaryingcolor; // Vertex position attribute // Vertex color attribute // Color value passed to fragment shader void main(void) { vvaryingcolor = vcolor; gl Position = vvertex; } Fragment shader 240 CHAPTER 6 Thinking Outside the Box: Nonstock Shaders // Simply copy the color value // Simply pass along the vertex position #version 330 in vec4 vvaryingcolor; void main(void) { gl FragColor = vvaryingcolor; } // Interpolated color to fragment FIGURE 6.2 Output from the ShadedTriangle program. 18

19 Shader Uniforms While attributes are needed for per-vertex positions, surface normals, texture coordinates, // Incoming per vertex and so on, a uniform is how we pass data into a shader that stays the same is uniform in vec4 vvertex; for the entire primitive batch. Probably the single most common uniform for a vertex shader is the transformation matrix. Previously, we allowed the GLShaderManager class to void main(void) do this for us, with built-in support for the stock shaders and their needed uniforms. Now { that we are writing our own shaders, we need to be able to set our own uniforms, and not // This is pretty much it, transform the geo just for matrix values; any shader variable can be specified as a uniform, and uniforms can gl_position = mvpmatrix * vvertex; be in any of the three shader stages (even though we only talk about vertex and fragment shaders in this chapter). Making a uniform is as simple as placing the keyword uniform at the beginning of the variable declaration: Variáveis uniforms } Constantes por primitivas de desenho uniform float ftime; LISTING 6.5 The Flat Shader Fragment Program uniform int iindex; // Flat Shader uniform vec4 vcolorvalue; // Fragment Shader uniform mat4 mvpmatrix; // Richard S. Wright Jr. // OpenGL SuperBible Shader Uniforms 253 Uniforms cannot be marked as in or out, they cannot be interpolated (although you can #version 130 copy them into interpolated variables) between shader stages, and they are always readonly. // Transformation Matrix // Make geometry solid uniform mat4 mvpmatrix; uniform vec4 vcolorvalue; Exemplo: flat shader Finding Your Uniforms uniform mat4 mvpmatrix; // Incoming After a shader per vertex has been compiled and linked, you must find // Output the uniform fragment location color in the in vec4 shader. vvertex; This is done with the function glgetuniformlocation. out vec4 vfragcolor; GLint glgetuniformlocation(gluint shaderid, const GLchar* varname); void main(void) void main(void) { { // This is pretty much it, transform the geometry gl_fragcolor = vcolorvalue; gl_position = mvpmatrix * vvertex; } } 6 In the vertex program shown in Listing 6.4 we have 19 transformation matrix.

20 256 CHAPTER 6 Thinking Outside the Box: Nonstock Shaders Funções built-in Trigonometry Functions Funções trigonométricas Table 6.4 lists the trigonometry functions that are supported by GLSL. These functions are defined for float, vec2, vec3, and vec4 data types. Here we denote the data type by anyfloat, meaning any of these four floating-point data types. anyfloat: float, vec2, vec3, vec4 Componente a componente TABLE 6.4 Function Trigonometric Functions anyfloat radians(anyfloat degrees) anyfloat degrees(anyfloat radians) anyfloat sin(anyfloat angle) anyfloat cos(anyfloat angle) anyfloat tan(anyfloat angle) anyfloat asin(anyfloat x) anyfloat acos(anyfloat x) anyfloat atan(anyfloat y, anyfloat x) anyfloat atan(anyfloat y_over_x) anyfloat sinh(anyfloat x) anyfloat cosh(anyfloat x) anyfloat tanh(anyfloat x) anyfloat asinh(anyfloat x) anyfloat acosh(anyfloat x) anyfloat atanh(anyfloat x) Description Converts degrees to radians Converts radians to degrees Trigonometric sine Trigonometric cosine Trigonometric tangent Arc sine Arc cosine Arc tangent of y / x Arc tangent of y_over_x Hyperbolic sine Hyperbolic cosine Hyperbolic tangent Arc hyperbolic sine Arc hyperbolic cosine Arc hyperbolic tangent Exponential Functions 20

21 6 GLSL anyfloat acosh(anyfloat x) anyfloat atanh(anyfloat x) Exponential Functions Funções given in built-in Table 6.5. TABLE 6.5 Exponential Functions Funções de exponenciação TABLE 6.6 Funções geométricas Arc hyperbolic cosine Arc hyperbolic tangent Like the trigonometric functions, the exponential functions work on the floating-point data types (floats and floating-point vectors). The complete list of exponential functions is Function anyfloat pow(anyfloat x, anyfloat y) anyfloat exp(anyfloat x) Geometric Functions anyfloat log(anyfloat x) Description x raised to the y power Natural exponent of x The natural logarithm of x A anyfloat number exp2(anyfloat of general purpose x) geometric 2 functions raised to the are power also of included x in GLSL. Some of these anyfloat functions log2(anyfloat have angle) specific argument types Base 2 (cross logarithm product of x for example); others accept any anyfloat of the sqrt(anyfloat floating-point x) vector types (vec2, Square vec3, root of and x vec4), which we refer to here only as anyfloat vec. These inversesqrt(anyfloat functions are x) listed in Table Inverse 6.6. square root of x Function Geometric Functions float length(vec2/vec3/vec4 x) float distance(vec p0, vec p1) float dot(vec x, vec y) vec3 cross(vec3 x, vec3 y) Description Returns the length of the vector x Returns the distance between p0 and p1 Returns the dot product of x and y Returns the cross product of x and y vec normalize(vec x) Returns a unit length vector in the same direction as x Download from vec faceforward(vec N, vec I, vec nref) if dot(nref, I) < 0 return N, else return N vec reflect(vec I, vec N) vec refract(vec I, vec N, float eta) Returns reflection direction for incident vector I and surface orientation N Returns refraction vector for incident vector I, surface orientation N, and ratio of indices of refraction eta Built-In Functions 257 Matrix Functions 21

22 vec refract(vec I, vec N, float eta) surface orientation N Returns refraction vector for incident vector I, surface orientation N, and ratio of indices of refraction eta Matrix Functions Funções built-in Many matrix operations are done using the regular mathematical operators. Some useful matrix functions, however, are listed in Table 6.7. Each of these functions is specific and takes a specific argument data type, which is shown in the table. TABLE Funções 6.7 Matrix algébricas Functions Function Description mat matrixcompmult(mat x, mat y) Multiplies two matrices together component by component. This is not the same as the linear algebraic matrix multiply. mat2 outerproduct(vec2 c, vec2 r) Returns a matrix that is the outer product of the two vectors specified. mat3 outerproduct(vec3 c, vec3 r) mat4 outerproduct(vec4 c, vec4 r) mat2x3 outerproduct(vec3 c, vec2 r) mat3x2 outerproduct(vec2 c, vec3 r) mat2x4 outerproduct(vec4 c, vec2 r) mat4x2 outerproduct(vec2 c, vec4 r) mat3x4 outerproduct(vec4 c, vec3 r) mat4x3 outerproduct(vec3 c, vec4 r) 6 Download from 22

23 258 CHAPTER 6 Funções built-in Funções algébricas Thinking Outside the Box: Nonstock Shaders TABLE 6.7 Matrix Functions continued Function Description mat2 transpose(mat2 m) Returns a matrix that is the transpose of the matrix specified. mat3 transpose(mat3 m) mat4 transpose(mat4 m) mat2x3 transpose(mat3x2 m) mat3x2 transpose(mat2x3 m) mat2x4 transpose(mat4x2 m) mat4x2 transpose(mat2x4 m) mat3x4 transpose(mat4x3 m) mat4x3 transpose(mat3x4 m) float determinant(mat2 m) float determinant(mat3 m) float determinant(mat4 m) Returns the determinant of the matrix specified. mat2 inverse(mat2 m) mat3 inverse(mat3 m) mat4 inverse(mat4 m) Returns a matrix that is the inverse of the matrix specified. Vector Relational Functions Scalar values can be compared using the standard equality operators (<, <=, >, >=, ++,!=). For vector comparisons, the functions listed in Table 6.8 are provided. All of these functions return a Boolean vector of the same number of dimensions as the arguments. TABLE 6.8 Vector Relational Functions 23

24 float determinant(mat4 m) GLSL mat2 inverse(mat2 m) mat3 inverse(mat3 m) mat4 inverse(mat4 m) Returns a matrix that is the inverse of the matrix specified. Vector Relational Functions Funções built-in Scalar values can be compared using the standard equality operators (<, <=, >, >=, ++,!=). For vector comparisons, the functions listed in Table 6.8 are provided. All of these functions return a Boolean vector of the same number of dimensions as the arguments. Funções TABLE 6.8 relacionais Vector Relational Functions para vetores Function Description bvec lessthan(vec x, vec y) Returns component by component the result of x < y. bvec lessthan(ivec x, ivec y) bvec lessthan(uvec x, uvec y) ptg bvec lessthanequal(vec x, vec y) Returns component by component the result of x <= y. bvec lessthanequal(ivec x, ivec y) bvec lessthanequal(uvec x, uvec y) Built-In Functions 259 bvec greaterthan(vec x, vec y) Returns component by component the result of x > y. bvec greaterthan(ivec x, ivec y) bvec Function greaterthan(uvec x, uvec y) Description bvec greaterthanequal(vec x, vec y) Returns component by component the result of x >= y. bvec greaterthanequal(ivec x, ivec y) bvec greaterthanequal(uvec x, uvec y) bvec equal(vec x, vec y) Returns component by component the result of x == y. bvec equal(ivec x, ivec y) bvec equal(uvec x, uvec y) bvec equal(bvec x, bvec y) Download from bvec notequal(vec x, vec y) Returns component by component the result of x!= y. bvec notequal(ivec x, ivec y) bvec notequal(uvec x, uvec y) bvec notequal(bvec x, bvec y) bool any(bvec x) Returns true if any component of x is true. bool all(bvec x) Returns true if all components of x are true. bvec not(bvec x) Returns component wise complement of x. 24

25 bvec notequal(bvec x, bvec y) GLSL bool any(bvec x) Returns true if any component of x is true. bool all(bvec x) Returns true if all components of x are true. bvec not(bvec x) Returns component wise complement of x. Funções built-in Common Functions Finally we present the list of general purpose functions. All of these functions work on and return both scalar and vector data types (see Table 6.9). Funções TABLE gerais 6.9 Common Functions Function Description anyfloat abs(anyfloat x) Returns the absolute value of x. anyint abs(anyint x) 6 p anyfloat sign(anyfloat x) Returns 1.0 or -1.0 depending on the sign of x. anyint sign(anyint x) anyfloat floor(anyfloat x) Returns the lowest whole number not larger than x. anyfloat trunc(anyfloat x) Returns the nearest whole number not larger than the absolute value of x. anyfloat round(anyfloat x) Returns the value of the nearest integer to x. The fraction 0.5 may round in either direction. (This is implementation-dependent.) anyfloat roundeven(anyfloat x) Returns the value of the nearest integer to x. The fraction 0.5 rounds to the nearest even integer. anyfloat ceil(anyfloat x) Returns the value of the nearest integer greater than x. anyfloat fract(anyfloat x) Returns the fractional part of x. Download from 25

26 260 CHAPTER 6 Funções built-in Funções gerais Thinking Outside the Box: Nonstock Shaders TABLE 6.9 Common Functions continued Function Description anyfloat mod(anyfloat x, float y) Returns the modulus of x mod y. anyfloat mod(anyfloat x, anyfloat y) anyfloat modf(anyfloat x, out anyfloat i) Returns the fractional part of x and sets i to be the integer remainder. anyfloat min(anyfloat x, anyfloat y) Returns the smaller of x and y. anyfloat min(anyfloat x, float y) anyint min(anyint x, anyint y) anyint min(anyint x, int y) anyuint min(anyuint x, anyuint y) anyuint min(anyuint x, uint y) anyfloat max(anyfloat x, anyfloat y) Returns the larger of x and y. anyfloat max(anyfloat x, float y) anyint max(anyint x, anyint y) anyint max(anyint x, int y) anyuint max(anyuint x, anyuint y) anyuint max(anyuint x, uint y) anyfloat clamp(anyfloat x, anyfloat minval, anyfloat maxval) anyfloat clamp(anyfloat x, float minval, Returns x clamped to the range minval to maxval. 26

27 anyint min(anyint x, anyint y) anyint min(anyint x, int y) anyuint min(anyuint x, anyuint y) anyuint min(anyuint x, uint y) anyfloat max(anyfloat x, anyfloat y) Returns the larger of x and y. anyfloat max(anyfloat x, float y) Funções built-in anyint max(anyint x, anyint y) anyint max(anyint x, int y) Funções gerais anyuint max(anyuint x, anyuint y) anyuint max(anyuint x, uint y) anyfloat clamp(anyfloat x, anyfloat minval, anyfloat maxval) anyfloat clamp(anyfloat x, float minval, float maxval); anyint clamp(anyint x, anyint minval, anyint maxval) anyint clamp(anyint x, int minval, int maxval) anyuint clamp(anyuint x, anyuint minval, anyuint maxval); anyuint clamp(anyuint x, uint minval, uint maxval) Returns x clamped to the range minval to maxval. 27

28 Funções built-in Built-In Functions 261 Funções gerais Function Description anyfloat mix(anyfloat x, Returns the linear blend of x and y, as a varies from 0 to 1 anyfloat y, anyfloat a) anyfloat mix(anyfloat x, anyfloat y, float a) anyfloat mix(anyfloat x, anyfloat y, anybool a) Returns the components of x where a is false and the components of y where a is true. anyfloat step(anyfloat edge, anyfloat x) anyfloat step(float edge, anyfloat x) Returns 0.0 if x is less than edge, or 1.0 otherwise. anyfloat smoothstep(anyfloat edge0, anyfloat edge1, anyfloat x) anyfloat smoothstep(float edge0, float edge1, anyfloat x) Returns 0.0 if x <= edge0, and 1.0 if x >= edge1, and a smooth Hermite interpolation between 0.0 and 1.0 in between. ptg anybool isnan(anyfloat x) anybool isinf(anyfloat x) Returns true if x is Nan. Returns true if x is positive or negative infinity. 6 anyint floatbitstoint(anyfloat x) anyuint floatbitstouint(anyfloat x) Converts floating-point values to integer values. anyfloat intbitstofloat(anyint x) anyfloat uintbitstofloat(anyuint x) Converts integers to floating-point values. 28

29 Exemplo: iluminação difusa por vértice Simulatin // diffuse ilumination in vec4 vvertex; in vec3 vnormal; uniform vec4 diffusecolor; uniform vec3 vlightposition; uniform mat4 mvpmatrix; uniform mat4 mvmatrix; uniform mat3 normalmatrix; smooth out vec4 vvaryingcolor; void main(void) { vec3 veyenormal = normalmatrix vnormal; vec4 vposition4 = mvmatrix vvertex; FIGURE 6.6 vec3 vposition3 = vposition4.xyz / vposition4.w; } The ADS Light Model vec3 vlightdir = normalize(vlightposition Position3); float diff = max(0.0, dot(veyenormal, vlightdir)); vvaryingcolor.xyz = diff diffusecolor.xyz; vvaryingcolor.a = 1.0; gl Position = mvpmatrix vvertex; The DiffuseLight example program. One of the most common lighting models, especially to those familiar with the now deprecated fixed function pipeline, is the ADS lighting model. ADS stands for Ambie Diffuse, and Specular. It works on a simple principle, which is that objects have three material properties, which are the Ambient, Diffuse, and Specular reflectivity. These p erties are assigned color values, with brighter colors representing a higher amount of reflectivity. Light sources have these same three properties and are again assigned col values that represent the brightness of the light. The final color value of a vertex is t the sum of the lighting and material interactions of these three properties. Ambient Light Ambient light doesn t come from any particular direction. It has an original source s where, but the rays of light have bounced around the room or scene and 29 become dir

30 For a given triangle, there are only three vertices and many more fragments that fill o the triangle. This makes vertex lighting and Gouraud shading very efficient, as all the computations are done only once per vertex. Figure 6.7 shows the output of the ADSGouraud example program. Exemplo: iluminação ADS por vértice in vec4 vvertex; in vec3 vnormal; uniform vec4 ambientcolor; uniform vec4 diffusecolor; uniform vec4 specularcolor; uniform vec3 vlightposition; uniform mat4 mvpmatrix; uniform mat4 mvmatrix; uniform mat3 normalmatrix; smooth out vec4 vvaryingcolor; void main (void) { FIGURE 6.7 vec3 veyenormal = normalmatrix vnormal; vec4 vposition4 = mvmatrix vvertex; vec3 vposition3 = vposition4.xyz Phong Shading / vposition4.w; } vec3 vlightdir = normalize(vlightposition vposition3); float diff = max(0.0, dot(veyenormal, vlightdir)); vvaryingcolor = diff diffusecolor; vvaryingcolor += ambientcolor; vec3 vreflection = normalize(reflect( vlightdir, veyenormal)); float spec = max(0.0, dot(veyenormal, vreflection)); if(diff!= 0) { float fspec = pow(spec, program (Figures 128.0); 6.7 and 6.8 are shown side-by-side in Color Plate 5). vvaryingcolor.rgb += vec3(fspec, fspec, fspec); } gl Position = mvpmatrix vvertex; Per-vertex-based lighting (Gouraud shading). One of the drawbacks to Gouraud shading is clearly apparent in Figure 6.7. Note the s burst pattern of the specular highlight. On a still image, this might almost pass as an intentional artistic effect. The running sample program, however, rotates the sphere a shows a characteristic flashing that is a bit distracting and generally undesirable. This caused by the discontinuity between triangles because the color values are being inter lated linearly through color space. The bright lines are actually the seams between ind ual triangles. One way to reduce this effect is to use more and more vertices in your geometry. Another, and higher quality, method is called Phong shading. With Phong shading, instead of interpolating the color values between vertices, we interpolate the surface normals between vertices. Figure 6.8 shows the output from the ADSPhong sa Download from w 30

31 Exemplo: iluminação ADS por pixel (Phong shading) Vertex shader in vec4 vvertex; in vec3 vnormal; uniform mat4 mvpmatrix; uniform mat4 mvmatrix; uniform mat3 normalmatrix; uniform vec3 vlightposition; smooth out vec3 vvaryingnormal; smooth out vec3 vvaryinglightdir; void main (void) { vvaryingnormal = normalmatrix vnormal; vec4 vposition4 = mvmatrix vvertex; vec3 vposition3 = vposition4.xyz / vposition4.w; vvaryinglightdir = normalize(vlightposition vposition3); gl Position = mvpmatrix vvertex; } 31

32 Exemplo: iluminação ADS por pixel (Phong shading) Fragment shader 274 CHAPTER 6 Thinking Outside the Box: Nonstock Shaders uniform vec4 ambientcolor; uniform vec4 diffusecolor; uniform vec4 specularcolor; in vec3 vvaryingnormal; in vec3 vvaryinglightdir; void main (void) { float diff = max(0.0, dot(normalize(vvaryingnormal), normalize(vvaryinglightdir))); gl FragColor = diff diffusecolor; gl FragColor += ambientcolor; vec3 vreflection = normalize(reflect( normalize(vvaryinglightdir), } normalize(vvaryingnormal))); program. float spec = max(0.0, dot(normalize(vvaryingnormal), Reflection)); LISTING 6.10 ADSPhong Vertex Shader if(diff!= 0) { // ADS Point lighting Shader float fspec = pow(spec, 128.0); // Vertex Shader gl FragColor.rgb += vec3(fspec, fspec, fspec); } FIGURE 6.8 Per-pixel-based lighting (Phong shading). The trade-off is of course we are now doing significantly more work in the fragment program, which is going to be executed significantly more times than the vertex program The basic code is the same as for the ADSGouraud example program, but this time there i some significant rearranging of the shader code. Listing 6.10 shows the new vertex // Richard S. Wright Jr. // OpenGL SuperBible #version 330 // Incoming per vertex... position and normal in vec4 vvertex; in vec3 vnormal; uniform mat4 mvpmatrix; 32

33 API Programs & shaders API para shader object uint glcreateshader (enum type); // type: {VERTEX,FRAGMENT,GEOMETRY} SHADER, TESS {EVALUATION,CONTROL} SHADER void glshadersource (uint shader, sizei count, const char string, const int length); void glcompileshader (uint shader); void gldeleteshader (uint shader); API para program object uint glcreateprogram (void); void glattachshader (uint program, uint shader); void gldetachshader (uint program, uint shader); void gllinkprogram(uint program); void gluseprogram(uint program); void gldeleteprogram(uint program); 33

34 API API para atributos de vértices // Before linking void glbindattriblocation (uint program, uint index, const char name); // After linking void glgetactiveattrib (uint program, uint index, sizei bufsize, sizei length, int size, enum type, char name); // type returns: FLOAT,FLOAT{VECn,MATn,MATnxm}, INT,INT VECn,UNSIGNED {INT,INT VECn} int glgetattriblocation (uint program, const char name); API para carga de variáveis uniformes // After linking the program int glgetuniformlocation (uint program, const char name); // load uniform variables in default uniform block on bound program void gluniform{1234}{ifd} (int location, T value); void gluniform{1234}{ifd}v (int location, sizei count, T value); void gluniform{1234}ui (int location, T value); void gluniform{1234}uiv (int location, sizei count, T value); void gluniformmatrix{234}{fd}v (int location, sizei count, boolean transpose, const T value); void gluniformmatrix{2x3,3x2,2x4,4x2, 3x4,4x3}{fd}v (int location, sizei count, boolean transpose, const T value); 34

35 Exercício Executável que renderiza um grid com os shaders (vertex & fragment) dados via comando de linha usage: trab filename.vs filename.fs Recomendação para desenvolvimento classe VGeometry Abstração para representar geometria de objetos classe VShader Abstração para encapsular API de definição de shaders 35

36 Referências OpenGL Super Bible, 5th edition Richard S. Wright, Jr. Nicholas Haemel, Graham Sellers, Benjamin Lipchak The OpenGL Graphics System: A Specification (Version 4.1 (Core Profile) - July 25, 2010) Mark Segal, Kurt Akeley 36

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science Laboratory University of New Mexico 1 Programming

More information

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg

Image Processing and Computer Graphics. Rendering Pipeline. Matthias Teschner. Computer Science Department University of Freiburg Image Processing and Computer Graphics Rendering Pipeline Matthias Teschner Computer Science Department University of Freiburg Outline introduction rendering pipeline vertex processing primitive processing

More information

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group

Shader Model 3.0. Ashu Rege. NVIDIA Developer Technology Group Shader Model 3.0 Ashu Rege NVIDIA Developer Technology Group Talk Outline Quick Intro GeForce 6 Series (NV4X family) New Vertex Shader Features Vertex Texture Fetch Longer Programs and Dynamic Flow Control

More information

CS418 GLSL Shader Programming Tutorial (I) Shader Introduction. Presented by : Wei-Wen Feng 3/12/2008

CS418 GLSL Shader Programming Tutorial (I) Shader Introduction. Presented by : Wei-Wen Feng 3/12/2008 CS418 GLSL Shader Programming Tutorial (I) Shader Introduction Presented by : Wei-Wen Feng 3/12/2008 MP3 MP3 will be available around Spring Break Don t worry, you got two more weeks after break. Use shader

More information

Vertex and fragment programs

Vertex and fragment programs Vertex and fragment programs Jon Hjelmervik email: jonmi@ifi.uio.no 1 Fixed function transform and lighting Each vertex is treated separately Affine transformation transforms the vertex by matrix multiplication

More information

Introduction to GPGPU. Tiziano Diamanti t.diamanti@cineca.it

Introduction to GPGPU. Tiziano Diamanti t.diamanti@cineca.it t.diamanti@cineca.it Agenda From GPUs to GPGPUs GPGPU architecture CUDA programming model Perspective projection Vectors that connect the vanishing point to every point of the 3D model will intersecate

More information

Introduction to Computer Graphics

Introduction to Computer Graphics Introduction to Computer Graphics Torsten Möller TASC 8021 778-782-2215 torsten@sfu.ca www.cs.sfu.ca/~torsten Today What is computer graphics? Contents of this course Syllabus Overview of course topics

More information

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007

Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Sample Exam Questions 2007 Monash University Clayton s School of Information Technology CSE3313 Computer Graphics Questions 2007 INSTRUCTIONS: Answer all questions. Spend approximately 1 minute per mark. Question 1 30 Marks Total

More information

Thnkwell s Homeschool Precalculus Course Lesson Plan: 36 weeks

Thnkwell s Homeschool Precalculus Course Lesson Plan: 36 weeks Thnkwell s Homeschool Precalculus Course Lesson Plan: 36 weeks Welcome to Thinkwell s Homeschool Precalculus! We re thrilled that you ve decided to make us part of your homeschool curriculum. This lesson

More information

INTRODUCTION TO RENDERING TECHNIQUES

INTRODUCTION TO RENDERING TECHNIQUES INTRODUCTION TO RENDERING TECHNIQUES 22 Mar. 212 Yanir Kleiman What is 3D Graphics? Why 3D? Draw one frame at a time Model only once X 24 frames per second Color / texture only once 15, frames for a feature

More information

Precalculus REVERSE CORRELATION. Content Expectations for. Precalculus. Michigan CONTENT EXPECTATIONS FOR PRECALCULUS CHAPTER/LESSON TITLES

Precalculus REVERSE CORRELATION. Content Expectations for. Precalculus. Michigan CONTENT EXPECTATIONS FOR PRECALCULUS CHAPTER/LESSON TITLES Content Expectations for Precalculus Michigan Precalculus 2011 REVERSE CORRELATION CHAPTER/LESSON TITLES Chapter 0 Preparing for Precalculus 0-1 Sets There are no state-mandated Precalculus 0-2 Operations

More information

Algebra and Geometry Review (61 topics, no due date)

Algebra and Geometry Review (61 topics, no due date) Course Name: Math 112 Credit Exam LA Tech University Course Code: ALEKS Course: Trigonometry Instructor: Course Dates: Course Content: 159 topics Algebra and Geometry Review (61 topics, no due date) Properties

More information

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University

CSE 564: Visualization. GPU Programming (First Steps) GPU Generations. Klaus Mueller. Computer Science Department Stony Brook University GPU Generations CSE 564: Visualization GPU Programming (First Steps) Klaus Mueller Computer Science Department Stony Brook University For the labs, 4th generation is desirable Graphics Hardware Pipeline

More information

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering

Computer Applications in Textile Engineering. Computer Applications in Textile Engineering 3. Computer Graphics Sungmin Kim http://latam.jnu.ac.kr Computer Graphics Definition Introduction Research field related to the activities that includes graphics as input and output Importance Interactive

More information

Computer Graphics CS 543 Lecture 12 (Part 1) Curves. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI)

Computer Graphics CS 543 Lecture 12 (Part 1) Curves. Prof Emmanuel Agu. Computer Science Dept. Worcester Polytechnic Institute (WPI) Computer Graphics CS 54 Lecture 1 (Part 1) Curves Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) So Far Dealt with straight lines and flat surfaces Real world objects include

More information

Essential Mathematics for Computer Graphics fast

Essential Mathematics for Computer Graphics fast John Vince Essential Mathematics for Computer Graphics fast Springer Contents 1. MATHEMATICS 1 Is mathematics difficult? 3 Who should read this book? 4 Aims and objectives of this book 4 Assumptions made

More information

South Carolina College- and Career-Ready (SCCCR) Pre-Calculus

South Carolina College- and Career-Ready (SCCCR) Pre-Calculus South Carolina College- and Career-Ready (SCCCR) Pre-Calculus Key Concepts Arithmetic with Polynomials and Rational Expressions PC.AAPR.2 PC.AAPR.3 PC.AAPR.4 PC.AAPR.5 PC.AAPR.6 PC.AAPR.7 Standards Know

More information

OpenGL Performance Tuning

OpenGL Performance Tuning OpenGL Performance Tuning Evan Hart ATI Pipeline slides courtesy John Spitzer - NVIDIA Overview What to look for in tuning How it relates to the graphics pipeline Modern areas of interest Vertex Buffer

More information

A Pipeline From COLLADA to WebGL for Skeletal Animation

A Pipeline From COLLADA to WebGL for Skeletal Animation A Pipeline From COLLADA to WebGL for Skeletal Animation Jeffery McRiffey, Ralph M. Butler, and Chrisila C. Pettey Computer Science Department, Middle Tennessee State University, Murfreesboro, TN, USA Abstract

More information

GPUs Under the Hood. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology

GPUs Under the Hood. Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology GPUs Under the Hood Prof. Aaron Lanterman School of Electrical and Computer Engineering Georgia Institute of Technology Bandwidth Gravity of modern computer systems The bandwidth between key components

More information

Higher Education Math Placement

Higher Education Math Placement Higher Education Math Placement Placement Assessment Problem Types 1. Whole Numbers, Fractions, and Decimals 1.1 Operations with Whole Numbers Addition with carry Subtraction with borrowing Multiplication

More information

The OpenGL R Graphics System: A Specification (Version 3.3 (Core Profile) - March 11, 2010)

The OpenGL R Graphics System: A Specification (Version 3.3 (Core Profile) - March 11, 2010) The OpenGL R Graphics System: A Specification (Version 3.3 (Core Profile) - March 11, 2010) Mark Segal Kurt Akeley Editor (version 1.1): Chris Frazier Editor (versions 1.2-3.3): Jon Leech Editor (version

More information

NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA

NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA NVPRO-PIPELINE A RESEARCH RENDERING PIPELINE MARKUS TAVENRATH MATAVENRATH@NVIDIA.COM SENIOR DEVELOPER TECHNOLOGY ENGINEER, NVIDIA GFLOPS 3500 3000 NVPRO-PIPELINE Peak Double Precision FLOPS GPU perf improved

More information

Math Placement Test Study Guide. 2. The test consists entirely of multiple choice questions, each with five choices.

Math Placement Test Study Guide. 2. The test consists entirely of multiple choice questions, each with five choices. Math Placement Test Study Guide General Characteristics of the Test 1. All items are to be completed by all students. The items are roughly ordered from elementary to advanced. The expectation is that

More information

GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series. By: Binesh Tuladhar Clay Smith

GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series. By: Binesh Tuladhar Clay Smith GPU(Graphics Processing Unit) with a Focus on Nvidia GeForce 6 Series By: Binesh Tuladhar Clay Smith Overview History of GPU s GPU Definition Classical Graphics Pipeline Geforce 6 Series Architecture Vertex

More information

Estimated Pre Calculus Pacing Timeline

Estimated Pre Calculus Pacing Timeline Estimated Pre Calculus Pacing Timeline 2010-2011 School Year The timeframes listed on this calendar are estimates based on a fifty-minute class period. You may need to adjust some of them from time to

More information

Classe AGI - PHP 5.x

Classe AGI - PHP 5.x Classe AGI - PHP 5.x Contents Package AGI Procedural Elements 2 agi_lib_v5x.php 2 Package AGI Classes 3 Class AGI 3 Constructor construct 3 Method exec_command 4 Method getagi_env 4 Method getdebug 4 Method

More information

OpenGL Shading Language Course. Chapter 5 Appendix. By Jacobo Rodriguez Villar jacobo.rodriguez@typhoonlabs.com

OpenGL Shading Language Course. Chapter 5 Appendix. By Jacobo Rodriguez Villar jacobo.rodriguez@typhoonlabs.com OpenGL Shading Language Course Chapter 5 Appendix By Jacobo Rodriguez Villar jacobo.rodriguez@typhoonlabs.com TyphoonLabs GLSL Course 1/1 APPENDIX INDEX Using GLSL Shaders Within OpenGL Applications 2

More information

GUI GRAPHICS AND USER INTERFACES. Welcome to GUI! Mechanics. Mihail Gaianu 26/02/2014 1

GUI GRAPHICS AND USER INTERFACES. Welcome to GUI! Mechanics. Mihail Gaianu 26/02/2014 1 Welcome to GUI! Mechanics 26/02/2014 1 Requirements Info If you don t know C++, you CAN take this class additional time investment required early on GUI Java to C++ transition tutorial on course website

More information

Writing Applications for the GPU Using the RapidMind Development Platform

Writing Applications for the GPU Using the RapidMind Development Platform Writing Applications for the GPU Using the RapidMind Development Platform Contents Introduction... 1 Graphics Processing Units... 1 RapidMind Development Platform... 2 Writing RapidMind Enabled Applications...

More information

Android and OpenGL. Android Smartphone Programming. Matthias Keil. University of Freiburg

Android and OpenGL. Android Smartphone Programming. Matthias Keil. University of Freiburg Android and OpenGL Android Smartphone Programming Matthias Keil Institute for Computer Science Faculty of Engineering 16. Dezember 2013 Outline 1 OpenGL Introduction 2 Displaying Graphics 3 Interaction

More information

Tutorial 9: Skeletal Animation

Tutorial 9: Skeletal Animation Tutorial 9: Skeletal Animation Summary In the last couple of tutorials, you ve seen how to create a scene graph, and implemented a simple animating cube robot using them. You re probably wondering how

More information

Solving Simultaneous Equations and Matrices

Solving Simultaneous Equations and Matrices Solving Simultaneous Equations and Matrices The following represents a systematic investigation for the steps used to solve two simultaneous linear equations in two unknowns. The motivation for considering

More information

Image Synthesis. Transparency. computer graphics & visualization

Image Synthesis. Transparency. computer graphics & visualization Image Synthesis Transparency Inter-Object realism Covers different kinds of interactions between objects Increasing realism in the scene Relationships between objects easier to understand Shadows, Reflections,

More information

Recent Advances and Future Trends in Graphics Hardware. Michael Doggett Architect November 23, 2005

Recent Advances and Future Trends in Graphics Hardware. Michael Doggett Architect November 23, 2005 Recent Advances and Future Trends in Graphics Hardware Michael Doggett Architect November 23, 2005 Overview XBOX360 GPU : Xenos Rendering performance GPU architecture Unified shader Memory Export Texture/Vertex

More information

COMP175: Computer Graphics. Lecture 1 Introduction and Display Technologies

COMP175: Computer Graphics. Lecture 1 Introduction and Display Technologies COMP175: Computer Graphics Lecture 1 Introduction and Display Technologies Course mechanics Number: COMP 175-01, Fall 2009 Meetings: TR 1:30-2:45pm Instructor: Sara Su (sarasu@cs.tufts.edu) TA: Matt Menke

More information

Vector Math Computer Graphics Scott D. Anderson

Vector Math Computer Graphics Scott D. Anderson Vector Math Computer Graphics Scott D. Anderson 1 Dot Product The notation v w means the dot product or scalar product or inner product of two vectors, v and w. In abstract mathematics, we can talk about

More information

Content. Chapter 4 Functions 61 4.1 Basic concepts on real functions 62. Credits 11

Content. Chapter 4 Functions 61 4.1 Basic concepts on real functions 62. Credits 11 Content Credits 11 Chapter 1 Arithmetic Refresher 13 1.1 Algebra 14 Real Numbers 14 Real Polynomials 19 1.2 Equations in one variable 21 Linear Equations 21 Quadratic Equations 22 1.3 Exercises 28 Chapter

More information

Prentice Hall Mathematics: Algebra 2 2007 Correlated to: Utah Core Curriculum for Math, Intermediate Algebra (Secondary)

Prentice Hall Mathematics: Algebra 2 2007 Correlated to: Utah Core Curriculum for Math, Intermediate Algebra (Secondary) Core Standards of the Course Standard 1 Students will acquire number sense and perform operations with real and complex numbers. Objective 1.1 Compute fluently and make reasonable estimates. 1. Simplify

More information

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT

2: Introducing image synthesis. Some orientation how did we get here? Graphics system architecture Overview of OpenGL / GLU / GLUT COMP27112 Computer Graphics and Image Processing 2: Introducing image synthesis Toby.Howard@manchester.ac.uk 1 Introduction In these notes we ll cover: Some orientation how did we get here? Graphics system

More information

Advanced Visual Effects with Direct3D

Advanced Visual Effects with Direct3D Advanced Visual Effects with Direct3D Presenters: Mike Burrows, Sim Dietrich, David Gosselin, Kev Gee, Jeff Grills, Shawn Hargreaves, Richard Huddy, Gary McTaggart, Jason Mitchell, Ashutosh Rege and Matthias

More information

Dhiren Bhatia Carnegie Mellon University

Dhiren Bhatia Carnegie Mellon University Dhiren Bhatia Carnegie Mellon University University Course Evaluations available online Please Fill! December 4 : In-class final exam Held during class time All students expected to give final this date

More information

3D Math Overview and 3D Graphics Foundations

3D Math Overview and 3D Graphics Foundations Freescale Semiconductor Application Note Document Number: AN4132 Rev. 0, 05/2010 3D Math Overview and 3D Graphics Foundations by Multimedia Applications Division Freescale Semiconductor, Inc. Austin, TX

More information

How To Teach Computer Graphics

How To Teach Computer Graphics Computer Graphics Thilo Kielmann Lecture 1: 1 Introduction (basic administrative information) Course Overview + Examples (a.o. Pixar, Blender, ) Graphics Systems Hands-on Session General Introduction http://www.cs.vu.nl/~graphics/

More information

Introduction to Computer Graphics

Introduction to Computer Graphics Introduction to Computer Graphics Version 1.1, January 2016 David J. Eck Hobart and William Smith Colleges This is a PDF version of a free, on-line book that is available at http://math.hws.edu/graphicsbook/.

More information

QCD as a Video Game?

QCD as a Video Game? QCD as a Video Game? Sándor D. Katz Eötvös University Budapest in collaboration with Győző Egri, Zoltán Fodor, Christian Hoelbling Dániel Nógrádi, Kálmán Szabó Outline 1. Introduction 2. GPU architecture

More information

Computer Graphics on Mobile Devices VL SS2010 3.0 ECTS

Computer Graphics on Mobile Devices VL SS2010 3.0 ECTS Computer Graphics on Mobile Devices VL SS2010 3.0 ECTS Peter Rautek Rückblick Motivation Vorbesprechung Spiel VL Framework Ablauf Android Basics Android Specifics Activity, Layouts, Service, Intent, Permission,

More information

Learning Modern 3D Graphics Programming. Jason L. McKesson

Learning Modern 3D Graphics Programming. Jason L. McKesson Learning Modern 3D Graphics Programming Jason L. McKesson Learning Modern 3D Graphics Programming Jason L. McKesson Copyright 2012 Jason L. McKesson Table of Contents About this Book... iv Why Read This

More information

GPU Architecture. Michael Doggett ATI

GPU Architecture. Michael Doggett ATI GPU Architecture Michael Doggett ATI GPU Architecture RADEON X1800/X1900 Microsoft s XBOX360 Xenos GPU GPU research areas ATI - Driving the Visual Experience Everywhere Products from cell phones to super

More information

The OpenGL Shading Language

The OpenGL Shading Language The OpenGL Shading Language Language Version: 1.50 Document Revision: 11 04-Dec-2009 John Kessenich Version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost Copyright (c) 2008-2009 The Khronos Group

More information

Interactive visualization of multi-dimensional data in R using OpenGL

Interactive visualization of multi-dimensional data in R using OpenGL Interactive visualization of multi-dimensional data in R using OpenGL 6-Monats-Arbeit im Rahmen der Prüfung für Diplom-Wirtschaftsinformatiker an der Universität Göttingen vorgelegt am 09.10.2002 von Daniel

More information

Programmable Graphics Hardware

Programmable Graphics Hardware Programmable Graphics Hardware Alessandro Martinelli alessandro.martinelli@unipv.it 6 November 2011 Rendering Pipeline (6): Programmable Graphics Hardware Rendering Architecture First Rendering Pipeline

More information

Affdex SDK for Windows!

Affdex SDK for Windows! Affdex SDK for Windows SDK Developer Guide 1 Introduction Affdex SDK is the culmination of years of scientific research into emotion detection, validated across thousands of tests worldwide on PC platforms,

More information

Web Based 3D Visualization for COMSOL Multiphysics

Web Based 3D Visualization for COMSOL Multiphysics Web Based 3D Visualization for COMSOL Multiphysics M. Jüttner* 1, S. Grabmaier 1, W. M. Rucker 1 1 University of Stuttgart Institute for Theory of Electrical Engineering *Corresponding author: Pfaffenwaldring

More information

The OpenGL ES Shading Language

The OpenGL ES Shading Language The OpenGL ES Shading Language Language Version: 3.10 Document Revision: 4 29 April 2015 Editor: Robert J. Simpson, Qualcomm OpenGL GLSL editor: John Kessenich, LunarG GLSL version 1.1 Authors: John Kessenich,

More information

Last lecture... Computer Graphics:

Last lecture... Computer Graphics: Last lecture... Computer Graphics: Visualisation can be greatly enhanced through the Introduction to the Visualisation use of 3D computer graphics Toolkit Visualisation Lecture 2 toby.breckon@ed.ac.uk

More information

Introduction to Matrices for Engineers

Introduction to Matrices for Engineers Introduction to Matrices for Engineers C.T.J. Dodson, School of Mathematics, Manchester Universit 1 What is a Matrix? A matrix is a rectangular arra of elements, usuall numbers, e.g. 1 0-8 4 0-1 1 0 11

More information

KEANSBURG SCHOOL DISTRICT KEANSBURG HIGH SCHOOL Mathematics Department. HSPA 10 Curriculum. September 2007

KEANSBURG SCHOOL DISTRICT KEANSBURG HIGH SCHOOL Mathematics Department. HSPA 10 Curriculum. September 2007 KEANSBURG HIGH SCHOOL Mathematics Department HSPA 10 Curriculum September 2007 Written by: Karen Egan Mathematics Supervisor: Ann Gagliardi 7 days Sample and Display Data (Chapter 1 pp. 4-47) Surveys and

More information

The OpenGL Shading Language

The OpenGL Shading Language The OpenGL Shading Language Language Version: 1.30 Document Revision: 10 22-Nov-2009 John Kessenich Version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost Copyright (c) 2008 The Khronos Group Inc.

More information

3D Augmented Reality Mobile Application Prototype for Visual Planning Support

3D Augmented Reality Mobile Application Prototype for Visual Planning Support 3D Augmented Reality Mobile Application Prototype for Visual Planning Support Arnau Fombuena Valero Master s of Science Thesis in Geoinformatics TRITA-GIT EX 11-010 School of Architecture and the Built

More information

NEW YORK STATE TEACHER CERTIFICATION EXAMINATIONS

NEW YORK STATE TEACHER CERTIFICATION EXAMINATIONS NEW YORK STATE TEACHER CERTIFICATION EXAMINATIONS TEST DESIGN AND FRAMEWORK September 2014 Authorized for Distribution by the New York State Education Department This test design and framework document

More information

The OpenGL Shading Language

The OpenGL Shading Language The OpenGL Shading Language Language Version: 1.20 Document Revision: 8 07-Sept-2006 John Kessenich Version 1.1 Authors: John Kessenich, Dave Baldwin, Randi Rost Copyright 2002-2006 3Dlabs, Inc. Ltd. This

More information

OpenGL & Delphi. Max Kleiner. http://max.kleiner.com/download/openssl_opengl.pdf 1/22

OpenGL & Delphi. Max Kleiner. http://max.kleiner.com/download/openssl_opengl.pdf 1/22 OpenGL & Delphi Max Kleiner http://max.kleiner.com/download/openssl_opengl.pdf 1/22 OpenGL http://www.opengl.org Evolution of Graphics Assembler (demo pascalspeed.exe) 2D 3D Animation, Simulation (Terrain_delphi.exe)

More information

Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions.

Algebra 2 Chapter 1 Vocabulary. identity - A statement that equates two equivalent expressions. Chapter 1 Vocabulary identity - A statement that equates two equivalent expressions. verbal model- A word equation that represents a real-life problem. algebraic expression - An expression with variables.

More information

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER

DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER DATA VISUALIZATION OF THE GRAPHICS PIPELINE: TRACKING STATE WITH THE STATEVIEWER RAMA HOETZLEIN, DEVELOPER TECHNOLOGY, NVIDIA Data Visualizations assist humans with data analysis by representing information

More information

X On record with the USOE.

X On record with the USOE. Textbook Alignment to the Utah Core Algebra 2 Name of Company and Individual Conducting Alignment: Chris McHugh, McHugh Inc. A Credential Sheet has been completed on the above company/evaluator and is

More information

Optimizing AAA Games for Mobile Platforms

Optimizing AAA Games for Mobile Platforms Optimizing AAA Games for Mobile Platforms Niklas Smedberg Senior Engine Programmer, Epic Games Who Am I A.k.a. Smedis Epic Games, Unreal Engine 15 years in the industry 30 years of programming C64 demo

More information

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch.

Course Overview. CSCI 480 Computer Graphics Lecture 1. Administrative Issues Modeling Animation Rendering OpenGL Programming [Angel Ch. CSCI 480 Computer Graphics Lecture 1 Course Overview January 14, 2013 Jernej Barbic University of Southern California http://www-bcf.usc.edu/~jbarbic/cs480-s13/ Administrative Issues Modeling Animation

More information

MATLAB Basics MATLAB numbers and numeric formats

MATLAB Basics MATLAB numbers and numeric formats MATLAB Basics MATLAB numbers and numeric formats All numerical variables are stored in MATLAB in double precision floating-point form. (In fact it is possible to force some variables to be of other types

More information

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Data Storage 3.1. Foundations of Computer Science Cengage Learning 3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how

More information

Biggar High School Mathematics Department. National 5 Learning Intentions & Success Criteria: Assessing My Progress

Biggar High School Mathematics Department. National 5 Learning Intentions & Success Criteria: Assessing My Progress Biggar High School Mathematics Department National 5 Learning Intentions & Success Criteria: Assessing My Progress Expressions & Formulae Topic Learning Intention Success Criteria I understand this Approximation

More information

Computer Graphics Hardware An Overview

Computer Graphics Hardware An Overview Computer Graphics Hardware An Overview Graphics System Monitor Input devices CPU/Memory GPU Raster Graphics System Raster: An array of picture elements Based on raster-scan TV technology The screen (and

More information

A Crash Course on Programmable Graphics Hardware

A Crash Course on Programmable Graphics Hardware A Crash Course on Programmable Graphics Hardware Li-Yi Wei Abstract Recent years have witnessed tremendous growth for programmable graphics hardware (GPU), both in terms of performance and functionality.

More information

Shear :: Blocks (Video and Image Processing Blockset )

Shear :: Blocks (Video and Image Processing Blockset ) 1 of 6 15/12/2009 11:15 Shear Shift rows or columns of image by linearly varying offset Library Geometric Transformations Description The Shear block shifts the rows or columns of an image by a gradually

More information

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA

The Evolution of Computer Graphics. SVP, Content & Technology, NVIDIA The Evolution of Computer Graphics Tony Tamasi SVP, Content & Technology, NVIDIA Graphics Make great images intricate shapes complex optical effects seamless motion Make them fast invent clever techniques

More information

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form

A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form Section 1.3 Matrix Products A linear combination is a sum of scalars times quantities. Such expressions arise quite frequently and have the form (scalar #1)(quantity #1) + (scalar #2)(quantity #2) +...

More information

How To Use An Amd Graphics Card In Greece 2.5.1 And 2.4.1 (Amd) With Greege 2.3.5 (Greege) With An Amd Greeper 2.2.

How To Use An Amd Graphics Card In Greece 2.5.1 And 2.4.1 (Amd) With Greege 2.3.5 (Greege) With An Amd Greeper 2.2. AMD GPU Association Targeting GPUs for Load Balancing in OpenGL The contents of this document are provided in connection with Advanced Micro Devices, Inc. ( AMD ) products. THE INFORMATION IN THIS PUBLICATION

More information

The Australian Curriculum Mathematics

The Australian Curriculum Mathematics The Australian Curriculum Mathematics Mathematics ACARA The Australian Curriculum Number Algebra Number place value Fractions decimals Real numbers Foundation Year Year 1 Year 2 Year 3 Year 4 Year 5 Year

More information

PURSUITS IN MATHEMATICS often produce elementary functions as solutions that need to be

PURSUITS IN MATHEMATICS often produce elementary functions as solutions that need to be Fast Approximation of the Tangent, Hyperbolic Tangent, Exponential and Logarithmic Functions 2007 Ron Doerfler http://www.myreckonings.com June 27, 2007 Abstract There are some of us who enjoy using our

More information

OpenGL "Hello, world!"

OpenGL Hello, world! OpenGL "Hello, world!" by Ian Romanick This work is licensed under the Creative Commons Attribution Non-commercial Share Alike (by-nc-sa) License. To view a copy of this license, (a) visit http://creativecommons.org/licenses/by-nc-sa/3.0/;

More information

Graphical displays are generally of two types: vector displays and raster displays. Vector displays

Graphical displays are generally of two types: vector displays and raster displays. Vector displays Display technology Graphical displays are generally of two types: vector displays and raster displays. Vector displays Vector displays generally display lines, specified by their endpoints. Vector display

More information

Masters of Science in Software & Information Systems

Masters of Science in Software & Information Systems Masters of Science in Software & Information Systems To be developed and delivered in conjunction with Regis University, School for Professional Studies Graphics Programming December, 2005 1 Table of Contents

More information

CUDAMat: a CUDA-based matrix class for Python

CUDAMat: a CUDA-based matrix class for Python Department of Computer Science 6 King s College Rd, Toronto University of Toronto M5S 3G4, Canada http://learning.cs.toronto.edu fax: +1 416 978 1455 November 25, 2009 UTML TR 2009 004 CUDAMat: a CUDA-based

More information

Realtime 3D Computer Graphics Virtual Reality

Realtime 3D Computer Graphics Virtual Reality Realtime 3D Computer Graphics Virtual Realit Viewing and projection Classical and General Viewing Transformation Pipeline CPU Pol. DL Pixel Per Vertex Texture Raster Frag FB object ee clip normalized device

More information

Chapter 8 Geometry We will discuss following concepts in this chapter.

Chapter 8 Geometry We will discuss following concepts in this chapter. Mat College Mathematics Updated on Nov 5, 009 Chapter 8 Geometry We will discuss following concepts in this chapter. Two Dimensional Geometry: Straight lines (parallel and perpendicular), Rays, Angles

More information

Optimizing Unity Games for Mobile Platforms. Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August

Optimizing Unity Games for Mobile Platforms. Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August Optimizing Unity Games for Mobile Platforms Angelo Theodorou Software Engineer Unite 2013, 28 th -30 th August Agenda Introduction The author and ARM Preliminary knowledge Unity Pro, OpenGL ES 3.0 Identify

More information

NVIDIA Material Definition Language 1.1

NVIDIA Material Definition Language 1.1 NVIDIA Material Definition Language 1.1 Technical Introduction Document version 1.0 12 May 2014 NVIDIA Advanced Rendering Center Fasanenstraße 81 10623 Berlin phone +49.30.315.99.70 fax +49.30.315.99.733

More information

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to:

Data Storage. Chapter 3. Objectives. 3-1 Data Types. Data Inside the Computer. After studying this chapter, students should be able to: Chapter 3 Data Storage Objectives After studying this chapter, students should be able to: List five different data types used in a computer. Describe how integers are stored in a computer. Describe how

More information

CS 4204 Computer Graphics

CS 4204 Computer Graphics CS 4204 Computer Graphics Computer Animation Adapted from notes by Yong Cao Virginia Tech 1 Outline Principles of Animation Keyframe Animation Additional challenges in animation 2 Classic animation Luxo

More information

PRE-CALCULUS GRADE 12

PRE-CALCULUS GRADE 12 PRE-CALCULUS GRADE 12 [C] Communication Trigonometry General Outcome: Develop trigonometric reasoning. A1. Demonstrate an understanding of angles in standard position, expressed in degrees and radians.

More information

LLVM for OpenGL and other stuff. Chris Lattner Apple Computer clattner@apple.com

LLVM for OpenGL and other stuff. Chris Lattner Apple Computer clattner@apple.com LLVM for OpenGL and other stuff Chris Lattner Apple Computer clattner@apple.com OpenGL JIT OpenGL Vertex/Pixel Shaders OpenGL Pixel/Vertex Shaders Small program, provided at run-time, to be run on each

More information

Java Programming Fundamentals

Java Programming Fundamentals Lecture 1 Part I Java Programming Fundamentals Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Introduction to Java We start by making a few

More information

GPU Shading and Rendering: Introduction & Graphics Hardware

GPU Shading and Rendering: Introduction & Graphics Hardware GPU Shading and Rendering: Introduction & Graphics Hardware Marc Olano Computer Science and Electrical Engineering University of Maryland, Baltimore County SIGGRAPH 2005 Schedule Shading Technolgy 8:30

More information

A Proposal for OpenEXR Color Management

A Proposal for OpenEXR Color Management A Proposal for OpenEXR Color Management Florian Kainz, Industrial Light & Magic Revision 5, 08/05/2004 Abstract We propose a practical color management scheme for the OpenEXR image file format as used

More information

CS3220 Lecture Notes: QR factorization and orthogonal transformations

CS3220 Lecture Notes: QR factorization and orthogonal transformations CS3220 Lecture Notes: QR factorization and orthogonal transformations Steve Marschner Cornell University 11 March 2009 In this lecture I ll talk about orthogonal matrices and their properties, discuss

More information

Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping. Lecture 15 Taku Komura

Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping. Lecture 15 Taku Komura Computer Graphics Global Illumination (2): Monte-Carlo Ray Tracing and Photon Mapping Lecture 15 Taku Komura In the previous lectures We did ray tracing and radiosity Ray tracing is good to render specular

More information

5: Magnitude 6: Convert to Polar 7: Convert to Rectangular

5: Magnitude 6: Convert to Polar 7: Convert to Rectangular TI-NSPIRE CALCULATOR MENUS 1: Tools > 1: Define 2: Recall Definition --------------- 3: Delete Variable 4: Clear a-z 5: Clear History --------------- 6: Insert Comment 2: Number > 1: Convert to Decimal

More information

TRIGONOMETRY FOR ANIMATION

TRIGONOMETRY FOR ANIMATION TRIGONOMETRY FOR ANIMATION What is Trigonometry? Trigonometry is basically the study of triangles and the relationship of their sides and angles. For example, if you take any triangle and make one of the

More information

B2.53-R3: COMPUTER GRAPHICS. NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions.

B2.53-R3: COMPUTER GRAPHICS. NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. B2.53-R3: COMPUTER GRAPHICS NOTE: 1. There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains FIVE questions. 2. PART ONE is to be answered in the TEAR-OFF ANSWER

More information

A Short Introduction to Computer Graphics

A Short Introduction to Computer Graphics A Short Introduction to Computer Graphics Frédo Durand MIT Laboratory for Computer Science 1 Introduction Chapter I: Basics Although computer graphics is a vast field that encompasses almost any graphical

More information