The Effects Framework. October 31, Composed of the following components:

Size: px
Start display at page:

Download "The Effects Framework. October 31, Composed of the following components:"

Transcription

1 Game Programming The Effects Framework October 31, 2005 Rendering Effect Composed of the following components: one ore more rendering passes a list of device states a vertex and/or pixel shader Effect file can be changed without recompiling source code encapsulate a complete effect including possible hardware fallbacks ASCII file format just like HLSL programs

2 Effect Edit DXSDK \Samples \C++ \Direct3D \Bin Objectives To gain an understanding of the structure and organization of an effect file To find out about some additional intrinsic objects in HLSL To learn how device states are specified in an effect file To learn how to create and use an effect To gain some experience working with the effects framework by studying some sample programs

3 Techniques and Passes (1) Technique particular way of rendering some special effect Why Why the the need for for several different implementations of of the the same effect? Some HW might not support a particular implementation of an effect Rendering pass encapsulate the device states, samplers, and/or shaders can use fixed function pipeline Techniques and Passes (2) ex) // effect.txt... technique T0 // first and only pass for this technique pass P0... [specify pass device states, shaders, samplers, etc.] technique T1 // first pass pass P0... [specify pass device states, shaders, samplers, etc.] // second pass pass P1... [specify pass device states, shaders, samplers, etc.]

4 More HLSL Intrinsic Objects Texture objects Sampler objects and sampler states Vertex and pixel shader objects Strings Annotations Texture Objects texture type represent an IDirect3DTexture9 object associate the texture for a particular sampler stage directly in the effect file Data members: type the type of texture (e.g. 2D, 3D) format the pixel format of the texture width the width of the texture in pixels height the height of the texture in pixels depth the depth (if a 3D a volume texture) of the texture in pixels

5 Sampler Objects and Sampler States sampler type sampler_state type ex) initialize a sampler object texture Tex; sampler S0 = sampler_state Texture = (Tex MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; ; Vertex and Pixel Shader Objects vertexshader and pixelshader HLSL intrinsic types represent vertex and pixel shaders respectively can be written directly into the effect file compile keyword ex) // Define Main: PS_OUTPUT PS_Main(PS_INPUT input)... // Compile Main: pixelshader ps = compile ps_2_0 PS_Main( // Define Main: VS_OUTPUT VS_Main(VS_INPUT input)... technique T0 pass P0 vertexshader vs = compile vs_1_1 VS_Main(...

6 Strings and Annotations string type ex) to encapsulating references to data files <annotation> syntax ex) string filename = texname.bmp ; texture tex0 < string filename = texname.bmp >; to associate a string with the variable (namely the filename that stores the texture data) can be accessed by the application ID3DXEffect::GetAnnotationByName( hobject, hobject, LPCSTR LPCSTR pname pname Device States in an Effect File Setting device states: ex) render states, texture states, materials, lights, and textures FillMode = WIREFRAME; FillMode = POINT; FillMode = SOLID; State State = Value; Value; same values without D3DFILL_ prefix DirectX SDK documentation DirectX Graphics \ Reference \ Effect Reference \ Effect Format \ Effect States

7 Creating an Effect ex) WINAPI WINAPI D3DXCreateEffectFromFile( D3DXCreateEffectFromFile( LPDIRECT3DDEVICE9 LPDIRECT3DDEVICE9 pdevice, pdevice, LPCTSTR LPCTSTR psrcfile, psrcfile, const const D3DXMACRO D3DXMACRO *pdefines, *pdefines, LPD3DXINCLUDE LPD3DXINCLUDE pinclude, pinclude, DWORD DWORD Flags, Flags, LPD3DXEFFECTPOOL LPD3DXEFFECTPOOL ppool, ppool, LPD3DXEFFECT LPD3DXEFFECT *ppeffect, *ppeffect, LPD3DXBUFFER LPD3DXBUFFER *ppcompilationerrors *ppcompilationerrors ID3DXEffect* Effect = 0; ID3DXBuffer* errorbuffer = 0; hr = D3DXCreateEffectFromFile( Device, // associated device "effect.txt", // effect filename 0, // no preprocessor definitions 0, // no ID3DXInclude interface D3DXSHADER_DEBUG,// compile flags 0, // don't share parameters &Effect, // return effect &errorbuffer // return error messages // output any error messages if( errorbuffer ) ::MessageBox(0,(char*)errorBuffer->GetBufferPointer(),0,0 d3d::release<id3dxbuffer*>(errorbuffer if(failed(hr)) ::MessageBox(0,"D3DXCreateEffectFromFile() - FAILED",0,0 return false;

8 Setting Constants (1) Intrinsic methods for setting variables instead of using a constant table ID3DXEffect::SetFloat( ID3DXEffect::SetFloat( FLOAT FLOAT f f ID3DXEffect::SetString( ID3DXEffect::SetString( CONST CONST LPCSTR LPCSTR pstring pstring ID3DXEffect::SetVector( ID3DXEffect::SetVector( CONST CONST D3DXVECTOR4 D3DXVECTOR4 *pvector *pvector ID3DXEffect::SetMatrix( ID3DXEffect::SetMatrix( CONST CONST D3DXMATRIX D3DXMATRIX *pmatrix *pmatrix ID3DXEffect::SetTexture( ID3DXEffect::SetTexture( LPDIRECT3DBASETEXTURE9 LPDIRECT3DBASETEXTURE9 ptexture ptexture ID3DXEffect::SetVertexShader( ID3DXEffect::SetVertexShader( LPDIRECT3DVERTEXSHADER9 LPDIRECT3DVERTEXSHADER9 pvshader pvshader ID3DXEffect::SetPixelShader( ID3DXEffect::SetPixelShader( LPDIRECT3DPIXELSHADER9 LPDIRECT3DPIXELSHADER9 ppshader ppshader Setting Constants (2) Obtaining handles to variables ex) ID3DXEffect::GetParameterByName ( hconstant, hconstant, LPCSTR LPCSTR pname pname D3DXMATRIX M; D3DXMatrixIdentity(&M D3DXVECTOR4 color(1.0f, 0.0f, 1.0f, 1.0f IDirect3DTexture9 *tex = 0; D3DXCreateTextureFromFile(Device, shade.bmp, &tex MatrixHandle MtrlHandle TexHandle = Effect->GetParameterByName(0, "Matrix" = Effect->GetParameterByName(0, "Mtrl" = Effect->GetParameterByName(0, "Tex" Effect->SetMatrix(MatrixHandle, &M Effect->SetVector(MtrlHandle, &color Effect->SetTexture(TexHandle, tex

9 Using an Effect (1) Obtain a handle to the technique in the effect file Activate the desired technique Begin the currently active technique For each rendering pass in the active technique, render the desired geometry End the currently active technique Using an Effect (2) Obtaining a handle to an effect ID3DXEffect::GetTechniqueByName ( LPCSTR LPCSTR pname pname Activating an effect ID3DXEffect::SetTechnique ( htechnique htechnique validating a technique with the current device ID3DXEffect::ValidateTechnique ( htechnique htechnique

10 Using an Effect (3) Beginning an effect Setting the current rendering pass Ending an effect ID3DXEffect::Begin ( UINT UINT *ppasses, *ppasses, DWORD DWORD Flags Flags ID3DXEffect::Pass ( UINT UINT ipass, ipass, ID3DXEffect::End(VOID Example Using an Effect // In effect file: technique T0 pass P0... // In application code: // Get technique handle htech = 0; htech = Effect->GetTechniqueByName( T0 // Activate technique Effect->SetTechnique(hTech // Begin the active technique UINT numpasses = 0; Effect->Begin(&numPasses, 0 // For each rendering pass for(int i=0; i<numpasses; i++) // Set the current pass Effect->Pass(i // Render the geometry for the ith pass Sphere->Draw( // End the effect Effect->End(

11 Sample: Lighting and Texturing in an Effect File Shader: light_tex.txt (1) matrix WorldMatrix; matrix ViewMatrix; matrix ProjMatrix; texture Tex; sampler S0 = sampler_state Texture = (Tex MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; ; technique LightAndTexture pass P0 pixelshader = null; vertexshader = null; fvf = XYZ Normal Tex1; Lighting = true; NormalizeNormals = true; SpecularEnable = false; WorldTransform[0] = (WorldMatrix ViewTransform = (ViewMatrix ProjectionTransform = (ProjMatrix

12 Shader: light_tex.txt (2) LightType[0] = Directional; LightAmbient[0] = 0.2f, 0.2f, 0.2f, 1.0f; LightDiffuse[0] = 1.0f, 1.0f, 1.0f, 1.0f; LightSpecular[0] = 0.0f, 0.0f, 0.0f, 1.0f; LightDirection[0] = 1.0f, -1.0f, 1.0f, 0.0f; LightPosition[0] = 0.0f, 0.0f, 0.0f, 0.0f; LightFalloff[0] = 0.0f; LightRange[0] = 0.0f; LightTheta[0] = 0.0f; LightPhi[0] = 0.0f; LightAttenuation0[0] = 1.0f; LightAttenuation1[0] = 0.0f; LightAttenuation2[0] = 0.0f; LightEnable[0] = true; MaterialAmbient = 1.0f, 1.0f, 1.0f, 1.0f; MaterialDiffuse = 1.0f, 1.0f, 1.0f, 1.0f; MaterialEmissive = 0.0f, 0.0f, 0.0f, 0.0f; MaterialPower = 1.0f; MaterialSpecular = 1.0f, 1.0f, 1.0f, 1.0f; Sampler[0] = (S0 Global Variables IDirect3DDevice9* Device = 0; const int Width = 640; const int Height = 480; ID3DXMesh* Mesh = 0; std::vector<d3dmaterial9> Mtrls(0 std::vector<idirect3dtexture9*> Textures(0 ID3DXEffect* LightTexEffect = 0; WorldMatrixHandle = 0; ViewMatrixHandle = 0; ProjMatrixHandle = 0; TexHandle = 0; LightTexTechHandle = 0;

13 Creating an Effect bool Setup() hr = 0; // Load the XFile data: code snipped... ID3DXBuffer* errorbuffer = 0; hr = D3DXCreateEffectFromFile( Device, "light_tex.txt", 0, // no preprocessor definitions 0, // no ID3DXInclude interface D3DXSHADER_DEBUG, // compile flags 0, // don't share parameters &LightTexEffect, &errorbuffer if( errorbuffer ) ::MessageBox(0, (char*)errorbuffer->getbufferpointer(), 0, 0 d3d::release<id3dxbuffer*>(errorbuffer if(failed(hr)) ::MessageBox(0, "D3DXCreateEffectFromFile() - FAILED", 0, 0 return false; Obtaining Handles and Initializing Effect Parameters WorldMatrixHandle ViewMatrixHandle ProjMatrixHandle TexHandle = LightTexEffect->GetParameterByName(0, "WorldMatrix" = LightTexEffect->GetParameterByName(0, "ViewMatrix" = LightTexEffect->GetParameterByName(0, "ProjMatrix" = LightTexEffect->GetParameterByName(0, "Tex" LightTexTechHandle = LightTexEffect->GetTechniqueByName("LightAndTexture" D3DXMATRIX W, P; D3DXMatrixIdentity(&W LightTexEffect->SetMatrix( WorldMatrixHandle, &W D3DXMatrixPerspectiveFovLH( &P, D3DX_PI * 0.25f, // 45 - degree (float)width / (float)height, 1.0f, f LightTexEffect->SetMatrix( ProjMatrixHandle, &P IDirect3DTexture9* tex = 0; D3DXCreateTextureFromFile(Device, "Terrain_3x_diffcol.jpg", &tex LightTexEffect->SetTexture(TexHandle, tex d3d::release<idirect3dtexture9*>(tex return true;

14 Display ( ) bool Display(float timedelta) if( Device ) // Update the scene: code snipped... Device->Clear(0, 0, D3DCLEAR_TARGET D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0 Device->BeginScene( LightTexEffect->SetTechnique( LightTexTechHandle UINT numpasses = 0; LightTexEffect->Begin(&numPasses, 0 for(int i = 0; i < numpasses; i++) LightTexEffect->Pass(i for(int j = 0; j < Mtrls.size( j++) Mesh->DrawSubset(j LightTexEffect->End( Device->EndScene( Device->Present(0, 0, 0, 0 return true; Cleanup ( ) void Cleanup() d3d::release<id3dxmesh*>(mesh for(int i = 0; i < Textures.size( i++) d3d::release<idirect3dtexture9*>( Textures[i] d3d::release<id3dxeffect*>(lighttexeffect

15 Sample: Fog Effect Direct3D Fog Vertex fog part of the fixed function pipeline Fog functions FogVertexMode = LINEAR end d f = end start FogVertexMode = EXP 1 d f = d ( density ) = e e FogVertexMode = EXP2 f = e ( d ( density )) 2 ( density ) 1 density = e ( d ( )) 2 d: distance from the viewpoint

16 Shader: fog.txt technique Fog pass P0 // Set Misc render states. pixelshader = null; vertexshader = null; fvf = XYZ Normal; Lighting = true; NormalizeNormals = true; SpecularEnable = false; // Fog States FogVertexMode = LINEAR; // linear fog function FogStart = 50.0f; // fog starts 50 units away from viewpoint FogEnd = 300.0f; // fog ends 300 units away from viewpoint FogColor = 0x00CCCCCC; // gray FogEnable = true; // enable Global Variables #include "d3dutility.h" #include "terrain.h" #include "camera.h" IDirect3DDevice9* Device = 0; const int Width = 640; const int Height = 480; Terrain* TheTerrain = 0; Camera TheCamera(Camera::AIRCRAFT ID3DXEffect* FogEffect = 0; FogTechHandle = 0; bool Setup() hr = 0; D3DXVECTOR3 lightdirection(0.0f, 1.0f, 0.0f TheTerrain = new Terrain(Device, "coastmountain64.raw", 64, 64, 6, 0.5f TheTerrain->genTexture(&lightDirection Device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR Device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR Device->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_LINEAR D3DXVECTOR3 pos(100.0f, 100.0f, f TheCamera.setPosition(&pos

17 Creating an Effect and Initializing Effect Parameters ID3DXBuffer* errorbuffer = 0; hr = D3DXCreateEffectFromFile( Device, "fog.txt", 0, // no preprocessor definitions 0, // no ID3DXInclude interface D3DXSHADER_DEBUG, // compile flags 0, // don't share parameters &FogEffect, &errorbuffer if( errorbuffer ) ::MessageBox(0, (char*)errorbuffer->getbufferpointer(), 0, 0 d3d::release<id3dxbuffer*>(errorbuffer if(failed(hr)) ::MessageBox(0, "D3DXCreateEffectFromFile() - FAILED", 0, 0 return false; FogTechHandle = FogEffect->GetTechniqueByName("Fog" D3DXMATRIX P; D3DXMatrixPerspectiveFovLH( &P, D3DX_PI * 0.25f, // 45 - degree (float)width / (float)height, 1.0f, f Device->SetTransform(D3DTS_PROJECTION, &P return true; Display ( ) bool Display(float timedelta) if( Device ) // Update the scene: code snipped... Device->Clear(0, 0, D3DCLEAR_TARGET D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0 Device->BeginScene( FogEffect->SetTechnique( FogTechHandle UINT numpasses = 0; FogEffect->Begin(&numPasses, 0 D3DXMATRIX I; D3DXMatrixIdentity(&I for(int i = 0; i < numpasses; i++) FogEffect->Pass(i if( TheTerrain ) TheTerrain->draw(&I, false FogEffect->End( Device->EndScene( Device->Present(0, 0, 0, 0 return true;

18 Cleanup ( ) void Cleanup() d3d::delete<terrain*>(theterrain d3d::release<id3dxeffect*>(fogeffect Sample: Cartoon Effect

19 Shader: tooneffect.txt (1) extern matrix WorldViewMatrix; extern matrix WorldViewProjMatrix; extern vector Color; extern vector LightDirection; extern texture ShadeTex; struct VS_INPUT vector position POSITION; vector normal : NORMAL; ; struct VS_OUTPUT vector position POSITION; float2 uvcoords TEXCOORD; vector diffuse : COLOR; ; VS_OUTPUT Main(VS_INPUT input) VS_OUTPUT output = (VS_OUTPUT)0; output.position mul(input.position, WorldViewProjMatrix LightDirection.w = 0.0f; input.normal.w LightDirection input.normal 0.0f; mul(lightdirection, WorldViewMatrix = mul(input.normal, WorldViewMatrix float u = dot(lightdirection, input.normal if( u < 0.0f ) u = 0.0f; float v = 0.5f; output.uvcoords.x = u; output.uvcoords.y = v; output.diffuse = Color; return output; Shader: tooneffect.txt (2) sampler ShadeSampler = sampler_state Texture = (ShadeTex MinFilter = POINT; // no filtering for cartoon shading MagFilter = POINT; MipFilter = NONE; ; technique Toon pass P0 vertexshader = compile vs_1_1 Main( Sampler[0] = (ShadeSampler

20 Global Variables IDirect3DDevice9* Device = 0; const int Width = 640; const int Height = 480; ID3DXEffect* ToonEffect = 0; ID3DXMesh* Meshes[4] = 0, 0, 0, 0; D3DXMATRIX WorldMatrices[4]; D3DXVECTOR4 MeshColors[4]; D3DXMATRIX ProjMatrix; IDirect3DTexture9* ShadeTex = 0; WorldViewHandle = 0; WorldViewProjHandle = 0; ColorHandle = 0; LightDirHandle = 0; ShadeTexHandle = 0; ToonTechHandle = 0; Creating an Effect bool Setup() hr = 0; // Create geometry: code snipped... ID3DXBuffer* errorbuffer = 0; hr = D3DXCreateEffectFromFile( Device, // associated device "tooneffect.txt", // effect filename 0, // no preprocessor definitions 0, // no ID3DXInclude interface D3DXSHADER_DEBUG, // compile flags 0, // don't share parameters &ToonEffect, // return effect &errorbuffer // return error messages if( errorbuffer ) ::MessageBox(0, (char*)errorbuffer->getbufferpointer(), 0, 0 d3d::release<id3dxbuffer*>(errorbuffer if(failed(hr)) ::MessageBox(0, "D3DXCreateEffectFromFile() - FAILED", 0, 0 return false;

21 Obtaining Handles and Initializing Effect Parameters ToonTechHandle = ToonEffect->GetTechniqueByName("Toon" ShadeTexHandle = ToonEffect->GetParameterByName(0, "ShadeTex" WorldViewHandle = ToonEffect->GetParameterByName(0, "WorldViewMatrix" WorldViewProjHandle = ToonEffect->GetParameterByName(0, "WorldViewProjMatrix" ColorHandle = ToonEffect->GetParameterByName(0, "Color" LightDirHandle = ToonEffect->GetParameterByName(0, "LightDirection" D3DXMatrixPerspectiveFovLH( &ProjMatrix, D3DX_PI * 0.25f, // 45 - degree (float)width / (float)height, 1.0f, f D3DXVECTOR4 lightdirection(-0.57f, 0.57f, -0.57f, 0.0f ToonEffect->SetVector(LightDirHandle, &lightdirection IDirect3DTexture9* tex = 0; D3DXCreateTextureFromFile(Device, "toonshade.bmp", &tex ToonEffect->SetTexture(ShadeTexHandle, tex d3d::release<idirect3dtexture9*>(tex return true; Display ( ) bool Display(float timedelta) if( Device ) // Update the scene: code snipped... Device->Clear(0, 0, D3DCLEAR_TARGET D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0 Device->BeginScene( ToonEffect->SetTechnique( ToonTechHandle UINT numpasses = 0; ToonEffect->Begin(&numPasses, 0 D3DXMATRIX WorldView; D3DXMATRIX WorldViewProj; for(int i = 0; i < numpasses; i++) ToonEffect->Pass(i for(int j = 0; j < 4; j++) WorldView = WorldMatrices[j] * view; WorldViewProj = WorldMatrices[j] * view * ProjMatrix; ToonEffect->SetMatrix(WorldViewHandle, &WorldView ToonEffect->SetMatrix(WorldViewProjHandle, &WorldViewProj ToonEffect->SetVector(ColorHandle, &MeshColors[j] Meshes[j]->DrawSubset(0 ToonEffect->End( Device->EndScene( Device->Present(0, 0, 0, 0 return true;

22 Cleanup ( ) void Cleanup() for(int i = 0; i < 4; i++) d3d::release<id3dxmesh*>(meshes[i] d3d::release<idirect3dtexture9*>(shadetex d3d::release<id3dxeffect*>(tooneffect Exercise Modify your program for Phong shading using an effect (Chap18.zip)

23 Environmental Maps Obtaining an image that approximates the desired reflection highly reflective surfaces specular reflections that mirror the environment 2 steps: to obtain environment images without objects to project the scene onto the surface Cube Map Compute 6 projections Cube Environmental map was computed on a box and then mapped to Geri s glasses

Shaders Part II. Traditional Rendering Pipeline

Shaders Part II. Traditional Rendering Pipeline Shaders Part II Doron Nussbaum Doron Nussbaum COMP 3501 - Shaders Part II 1 Traditional Rendering Pipeline Traditional pipeline (older graphics cards) restricts developer to texture and the 3-term lighting

More information

DirectX Programming #4. Kang, Seongtae Computer Graphics, 2009 Spring

DirectX Programming #4. Kang, Seongtae Computer Graphics, 2009 Spring DirectX Programming #4 Kang, Seongtae Computer Graphics, 2009 Spring Programmable Shader For recent hardwares, vertex and pixel processing stage of the graphics pipeline is programmable Programmable Vertex

More information

Font. Overview. ID3DXFont. ID3DXFont. ID3DXFont 인터페이스를이용해텍스트를렌더링하는방법

Font. Overview. ID3DXFont. ID3DXFont. ID3DXFont 인터페이스를이용해텍스트를렌더링하는방법 Overview Font 인터페이스를이용해텍스트를렌더링하는방법 클래스를이용해텍스트를렌더링하는방법 초당렌더링되는프레임수 (fps) 를계산하는방법 D3DXCreateText 함수를이용해 3D 텍스트를만들고렌더링하는방법 305890 2009년봄학기 5/6/2009 박경신 글꼴출력방법 내부적으로 GDI를이용. 복잡한글꼴과포맷을지원함. GDI가아닌Direct3D를이용.

More information

!" "!#$!"%!&% ' ( )) * ) )+( ( ))+ ))(, ) ( - +,./ )) ) ) $( -( 1), , ) ( -)) ') 5 ' +) 67 4 ) ' 8, ( ) ( 9 :! ; $) ) ; 5<4,4$6 ( =) >

! !#$!%!&% ' ( )) * ) )+( ( ))+ ))(, ) ( - +,./ )) ) ) $( -( 1), , ) ( -)) ') 5 ' +) 67 4 ) ' 8, ( ) ( 9 :! ; $) ) ; 5<4,4$6 ( =) > !" "!#$!"%!&% ' ( )) * ) )+( ( ))+ ))(, ) ( - +,./ )) ) ) ( ))) 0 $( -( 1),2, ) ( -))+- 3 4 ') 5 ' +) 67 4 ) ' 8, ( ) ( 9 :! ; $) ) ; 5 " + ) &)) >( ))( -*( /( *( 1 =?/+) *( : == ) + /))(

More information

DirectX Programming #2. Hyunna Lee Computer Graphics, 2010 Spring

DirectX Programming #2. Hyunna Lee Computer Graphics, 2010 Spring DirectX Programming #2 Hyunna Lee Computer Graphics, 2010 Spring Lights and Materials Lights and Materials } Lighting } To illuminate objects in a scene } Calculates the color of each object vertex based

More information

Sébastien Dominé, NVIDIA. CgFX

Sébastien Dominé, NVIDIA. CgFX Sébastien Dominé, NVIDIA CgFX Overview What is CgFX? CgFX runtime Production pipeline with CgFX CgFX Tools set Demo What is CgFX? Supports Microsoft.fx files Cg plus: Multi-pass Hardware fallbacks (techniques)

More information

Lab 3 Shadow Mapping. Giuseppe Maggiore

Lab 3 Shadow Mapping. Giuseppe Maggiore Lab 3 Shadow Giuseppe Maggiore Adding Shadows to the Scene First we need to declare a very useful helper object that will allow us to draw textures to the screen without creating a quad vertex buffer //

More information

Shader Programming CgFX, OpenGL 2.0. Michael Haller 2003

Shader Programming CgFX, OpenGL 2.0. Michael Haller 2003 Shader Programming CgFX, OpenGL 2.0 Michael Haller 2003 Outline What is CgFX? CgFX runtime Production pipeline with CgFX CgFX Tools set OpenGL 2.0 What is CgFX? CgFX (C for Graphics Effekt File) Supports

More information

Meshes Part II. June 13, 2005

Meshes Part II. June 13, 2005 Game Programming Meshes Part II June 13, 2005 Objectives To learn how to load the data of an XFile into an ID3DXMesh object To gain an understanding of the benefits of using progressive meshes and how

More information

TentamensKod: (Ifylles av student) Tentamensdatum: Tid: 10:00 12:00. Hjälpmedel: Inga hjälpmedel

TentamensKod: (Ifylles av student) Tentamensdatum: Tid: 10:00 12:00. Hjälpmedel: Inga hjälpmedel Computer Graphics Provmoment: Ladokkod: Tentamen ges för: Teoretisk tentamen 21DG2B Systemarkitektprogrammet 7,5 högskolepoäng TentamensKod: (Ifylles av student) Tentamensdatum: 2017-05-29 Tid: 10:00 12:00

More information

Kang, Seong-tae Computer Graphics, 2007 Spring. Texture mapping Texture mapping on Direct3D. CGLab

Kang, Seong-tae Computer Graphics, 2007 Spring. Texture mapping Texture mapping on Direct3D. CGLab DirectX Programming #4 Kang, Seong-tae Computer Graphics, 2007 Spring Contents Texture mapping Texture mapping on Direct3D Texture Mapping Kang, Seong-tae Computer Graphics, 2007 Spring Texture In real

More information

DirectX Programming #1. Hyunna Lee Computer Graphics, 2010 Spring

DirectX Programming #1. Hyunna Lee Computer Graphics, 2010 Spring DirectX Programming #1 Hyunna Lee Computer Graphics, 2010 Spring Contents } Installation and Settings } Introduction to Direct3D 9 Graphics } Initializing Direct3D } Rendering Vertices } The D3D coordinate

More information

Meshes. 9 th Week, To gain an understanding of the internal data organization of an ID3DXMesh object

Meshes. 9 th Week, To gain an understanding of the internal data organization of an ID3DXMesh object Meshes 9 th Week, 2009 Objectives To gain an understanding of the internal data organization of an ID3DXMesh object To find out how to create, optimize, i and render an ID3DXMesh object To learn how to

More information

Shaders (some slides taken from David M. course)

Shaders (some slides taken from David M. course) Shaders (some slides taken from David M. course) Doron Nussbaum Doron Nussbaum COMP 3501 - Shaders 1 Traditional Rendering Pipeline Traditional pipeline (older graphics cards) restricts developer to texture

More information

Meshes. Meshes what are they? How to use them? Progressive Meshes? Doron Nussbaum COMP Meshes 1. Doron Nussbaum COMP Meshes 2

Meshes. Meshes what are they? How to use them? Progressive Meshes? Doron Nussbaum COMP Meshes 1. Doron Nussbaum COMP Meshes 2 Meshes Doron Nussbaum COMP 3501 - Meshes 1 Meshes what are they? How to use them? Progressive Meshes? Doron Nussbaum COMP 3501 - Meshes 2 Meshes Doron Nussbaum COMP 3501 - Meshes 3 What is a mesh? A collection

More information

DirectX 11 First Elements

DirectX 11 First Elements DirectX 11 First Elements 0. Project changes changed Dx11Base.h void Update( float dt ); void Render( ); to virtual void Update( float dt ) = 0; virtual void Render( ) = 0; new App3D.h #ifndef _APP_3D_H_

More information

Introduction to Programmable GPUs CPSC 314. Real Time Graphics

Introduction to Programmable GPUs CPSC 314. Real Time Graphics Introduction to Programmable GPUs CPSC 314 Introduction to GPU Programming CS314 Gordon Wetzstein, 02/2011 Real Time Graphics Introduction to GPU Programming CS314 Gordon Wetzstein, 02/2011 1 GPUs vs CPUs

More information

CS 418: Interactive Computer Graphics. Basic Shading in WebGL. Eric Shaffer

CS 418: Interactive Computer Graphics. Basic Shading in WebGL. Eric Shaffer CS 48: Interactive Computer Graphics Basic Shading in WebGL Eric Shaffer Some slides adapted from Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 205 Phong Reflectance Model Blinn-Phong

More information

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express

Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express Shader Series Primer: Fundamentals of the Programmable Pipeline in XNA Game Studio Express Level: Intermediate Area: Graphics Programming Summary This document is an introduction to the series of samples,

More information

Geometry Shader - Silhouette edge rendering

Geometry Shader - Silhouette edge rendering Geometry Shader - Silhouette edge rendering Introduction This paper will describe the process of making an outline shader, using the Geometry Shader. The shader is designed for DirectX10 applications (and

More information

Nothing is ever said that has not been said before. Terence: Eunuchus, prologue, c. 160 B.C.

Nothing is ever said that has not been said before. Terence: Eunuchus, prologue, c. 160 B.C. Chapter 15 D3DX Utility Library Nothing is ever said that has not been said before. Terence: Eunuchus, prologue, c. 160 B.C. 15.1 Overview D3DX is a static library designed for production use in shipping

More information

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Shader Languages Currently 3 major shader languages Cg (Nvidia) HLSL (Microsoft) Derived from Cg GLSL (OpenGL) Main influences

More information

DirectX Programming #1. Kang, Seong-tae Computer Graphics, 2007 Fall

DirectX Programming #1. Kang, Seong-tae Computer Graphics, 2007 Fall DirectX Programming #1 Kang, Seong-tae Computer Graphics, 2007 Fall Contents Installation and Settings Introduction to Direct3D 9 Graphics Initializing Direct3D Rendering Vertices The D3D coordinate system

More information

Evolution of GPUs Chris Seitz

Evolution of GPUs Chris Seitz Evolution of GPUs Chris Seitz Overview Concepts: Real-time rendering Hardware graphics pipeline Evolution of the PC hardware graphics pipeline: 1995-1998: Texture mapping and z-buffer 1998: Multitexturing

More information

Introduction to Programmable GPUs CPSC 314. Introduction to GPU Programming CS314 Gordon Wetzstein, 09/03/09

Introduction to Programmable GPUs CPSC 314. Introduction to GPU Programming CS314 Gordon Wetzstein, 09/03/09 Introduction to Programmable GPUs CPSC 314 News Homework: no new homework this week (focus on quiz prep) Quiz 2 this Friday topics: everything after transformations up until last Friday's lecture questions

More information

Designing a Modern GPU Interface

Designing a Modern GPU Interface Designing a Modern GPU Interface Brooke Hodgman ( @BrookeHodgman) http://tiny.cc/gpuinterface How to make a wrapper for D3D9/11/12, GL2/3/4, GL ES2/3, Metal, Mantle, Vulkan, GNM & GCM without going (completely)

More information

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people

GLSL Introduction. Fu-Chung Huang. Thanks for materials from many other people GLSL Introduction Fu-Chung Huang Thanks for materials from many other people Programmable Shaders //per vertex inputs from main attribute aposition; attribute anormal; //outputs to frag. program varying

More information

Beginning Direct3D Game Programming: 6. First Steps to Animation. Division of Digital Contents, DongSeo University.

Beginning Direct3D Game Programming: 6. First Steps to Animation. Division of Digital Contents, DongSeo University. Beginning Direct3D Game Programming: 6. First Steps to Animation jintaeks@gmail.com Division of Digital Contents, DongSeo University. April 2016 Understanding Transformations At the head of the pipeline,

More information

Providing Direct3D Features over the Desktop OpenGL

Providing Direct3D Features over the Desktop OpenGL Providing Direct3D Features over the Desktop OpenGL Nakhoon Baek 1 and Kwan-Hee Yoo 2,* 1 Kyungpook National University, Daegu 702-701, Korea oceancru@gmail.com 2 Chungbuk National University, Cheongju

More information

Programming Graphics Hardware

Programming Graphics Hardware Tutorial 5 Programming Graphics Hardware Randy Fernando, Mark Harris, Matthias Wloka, Cyril Zeller Overview of the Tutorial: Morning 8:30 9:30 10:15 10:45 Introduction to the Hardware Graphics Pipeline

More information

Implementing Fog in Direct3D Douglas Rogers NVIDIA Corportaion

Implementing Fog in Direct3D Douglas Rogers NVIDIA Corportaion Implementing Fog in Direct3D Douglas Rogers NVIDIA Corportaion drogers@nvidia.com Fog is a special effect that is used to blend a scene into a predefined color to give the impression that "fog" is present

More information

CS GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1. Markus Hadwiger, KAUST

CS GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1. Markus Hadwiger, KAUST CS 380 - GPU and GPGPU Programming Lecture 7: Shading and Compute APIs 1 Markus Hadwiger, KAUST Reading Assignment #4 (until Feb. 23) Read (required): Programming Massively Parallel Processors book, Chapter

More information

Advanced Rendering & Shading

Advanced Rendering & Shading Advanced Rendering & Shading Seminar 3 Advanced Rendering and Shading Pluto Computer room with NVidia 6600 graphics cards All remaining assignment examination slots are in this room Advanced Rendering

More information

Game Graphics & Real-time Rendering

Game Graphics & Real-time Rendering Game Graphics & Real-time Rendering CMPM 163, W2018 Prof. Angus Forbes (instructor) angus@ucsc.edu Lucas Ferreira (TA) lferreira@ucsc.edu creativecoding.soe.ucsc.edu/courses/cmpm163 github.com/creativecodinglab

More information

The Application Stage. The Game Loop, Resource Management and Renderer Design

The Application Stage. The Game Loop, Resource Management and Renderer Design 1 The Application Stage The Game Loop, Resource Management and Renderer Design Application Stage Responsibilities 2 Set up the rendering pipeline Resource Management 3D meshes Textures etc. Prepare data

More information

D3DX Mesh Objects. Chapter Overview

D3DX Mesh Objects. Chapter Overview Chapter 19 D3DX Mesh Objects net, n.: Anything reticulated or decussated at equal distances, with interstices between the intersections Samuel Johnson: Dictionary, 1755 19.1 Overview A surface modelled

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS SESSION 12 PROGRAMMABLE SHADERS Announcement Programming Assignment #2 deadline next week: Session #7 Review of project proposals 2 Lecture Overview GPU programming 3 GPU Pipeline

More information

Chapter Answers. Appendix A. Chapter 1. This appendix provides answers to all of the book s chapter review questions.

Chapter Answers. Appendix A. Chapter 1. This appendix provides answers to all of the book s chapter review questions. Appendix A Chapter Answers This appendix provides answers to all of the book s chapter review questions. Chapter 1 1. What was the original name for the first version of DirectX? B. Games SDK 2. Which

More information

IWKS 3400 LAB 11 1 JK Bennett

IWKS 3400 LAB 11 1 JK Bennett IWKS 3400 LAB 11 1 JK Bennett This lab dives a little bit deeper into HLSL effects, particularly as they relate to lighting and shading. We will begin by reviewing some basic 3D principles, and then move

More information

DX10, Batching, and Performance Considerations. Bryan Dudash NVIDIA Developer Technology

DX10, Batching, and Performance Considerations. Bryan Dudash NVIDIA Developer Technology DX10, Batching, and Performance Considerations Bryan Dudash NVIDIA Developer Technology The Point of this talk The attempt to combine wisdom and power has only rarely been successful and then only for

More information

Direct3D API Issues: Instancing and Floating-point Specials. Cem Cebenoyan NVIDIA Corporation

Direct3D API Issues: Instancing and Floating-point Specials. Cem Cebenoyan NVIDIA Corporation Direct3D API Issues: Instancing and Floating-point Specials Cem Cebenoyan NVIDIA Corporation Agenda Really two mini-talks today Instancing API Usage Performance / pitfalls Floating-point specials DirectX

More information

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics

Graphics Hardware. Graphics Processing Unit (GPU) is a Subsidiary hardware. With massively multi-threaded many-core. Dedicated to 2D and 3D graphics Why GPU? Chapter 1 Graphics Hardware Graphics Processing Unit (GPU) is a Subsidiary hardware With massively multi-threaded many-core Dedicated to 2D and 3D graphics Special purpose low functionality, high

More information

Ch 10: Game Event Management. Quiz # 4 Discussion

Ch 10: Game Event Management. Quiz # 4 Discussion Ch 10: Game Event Management Quiz # 4 Discussion Moving the Camera Toggle between first and third person view Translate object Transformations ò Quaternion: rotation around arbitrary axis ò Advantages

More information

Objectives. Introduce the OpenGL shading Methods 1) Light and material functions on MV.js 2) per vertex vs per fragment shading 3) Where to carry out

Objectives. Introduce the OpenGL shading Methods 1) Light and material functions on MV.js 2) per vertex vs per fragment shading 3) Where to carry out Objectives Introduce the OpenGL shading Methods 1) Light and material functions on MV.js 2) per vertex vs per fragment shading 3) Where to carry out 1 Steps in OpenGL shading Enable shading and select

More information

Introduction to Computer Graphics with WebGL

Introduction to Computer Graphics with WebGL 1 Introduction to Computer Graphics with WebGL Ed Angel Lighting in WebGL WebGL lighting Application must specify - Normals - Material properties - Lights State-based shading functions have been deprecated

More information

Shaders in Eve Online Páll Ragnar Pálsson

Shaders in Eve Online Páll Ragnar Pálsson Shaders in Eve Online Páll Ragnar Pálsson EVE Online Eve Online Trinity First released 2003 Proprietary graphics engine DirectX 9 (DX11 on its way) Shader Model 3 (4 & 5 in development) HLSL Turning this

More information

CS452/552; EE465/505. Lighting & Shading

CS452/552; EE465/505. Lighting & Shading CS452/552; EE465/505 Lighting & Shading 2-17 15 Outline! More on Lighting and Shading Read: Angel Chapter 6 Lab2: due tonight use ASDW to move a 2D shape around; 1 to center Local Illumination! Approximate

More information

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel,

EDAF80 Introduction to Computer Graphics. Seminar 3. Shaders. Michael Doggett. Slides by Carl Johan Gribel, EDAF80 Introduction to Computer Graphics Seminar 3 Shaders Michael Doggett 2017 Slides by Carl Johan Gribel, 2010-13 Today OpenGL Shader Language (GLSL) Shading theory Assignment 3: (you guessed it) writing

More information

Programming With D3DX. Anuj Gosalia Development Lead DirectX Graphics Microsoft Corporation

Programming With D3DX. Anuj Gosalia Development Lead DirectX Graphics Microsoft Corporation Programming With D3DX Anuj Gosalia Development Lead DirectX Graphics Microsoft Corporation Talk Overview D3DX 8.0 Overview Mesh functions Skinning using D3DX Effect Framework Preview of what s coming in

More information

Could you make the XNA functions yourself?

Could you make the XNA functions yourself? 1 Could you make the XNA functions yourself? For the second and especially the third assignment, you need to globally understand what s going on inside the graphics hardware. You will write shaders, which

More information

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models

3D Programming. 3D Programming Concepts. Outline. 3D Concepts. 3D Concepts -- Coordinate Systems. 3D Concepts Displaying 3D Models 3D Programming Concepts Outline 3D Concepts Displaying 3D Models 3D Programming CS 4390 3D Computer 1 2 3D Concepts 3D Model is a 3D simulation of an object. Coordinate Systems 3D Models 3D Shapes 3D Concepts

More information

INSTANCE VARIABLES (1/2) P. 1

INSTANCE VARIABLES (1/2) P. 1 SHADOWS: THE CODE 1 OUTLINE 2 INSTANCE VARIABLES (1/2) P. 1 private GLCanvas mycanvas; private Material thismaterial; private String[] vblinn1shadersource, vblinn2shadersource, fblinn2shadersource; private

More information

Lab 1 Sample Code. Giuseppe Maggiore

Lab 1 Sample Code. Giuseppe Maggiore Lab 1 Sample Code Giuseppe Maggiore Preliminaries using Vertex = VertexPositionColor; First we define a shortcut for the type VertexPositionColor. This way we could change the type of Vertices used without

More information

D3DX Helper Objects. Chapter Overview Matrix Stacks. For a man to help another is to be a god. Pliny the Elder, Natural History, II, 77

D3DX Helper Objects. Chapter Overview Matrix Stacks. For a man to help another is to be a god. Pliny the Elder, Natural History, II, 77 Chapter 17 D3DX Helper Objects For a man to help another is to be a god. Pliny the Elder, Natural History, II, 77 17.1 Overview In addition to the objects provided by D3DX as concrete classes, D3DX provides

More information

Efficient and Scalable Shading for Many Lights

Efficient and Scalable Shading for Many Lights Efficient and Scalable Shading for Many Lights 1. GPU Overview 2. Shading recap 3. Forward Shading 4. Deferred Shading 5. Tiled Deferred Shading 6. And more! First GPU Shaders Unified Shaders CUDA OpenCL

More information

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY

TSBK 07! Computer Graphics! Ingemar Ragnemalm, ISY 1(84) Information Coding / Computer Graphics, ISY, LiTH TSBK 07 Computer Graphics Ingemar Ragnemalm, ISY 1(84) Lecture 5 3D graphics part 3 Illumination Illumination applied: Shading Surface detail: Mappings

More information

DirectX10 Effects. Sarah Tariq

DirectX10 Effects. Sarah Tariq DirectX10 Effects Sarah Tariq Motivation Direct3D 10 is Microsoft s next graphics API Driving the feature set of next generation GPUs New driver model Improved performance Many new features New programmability,

More information

Underwater Manager (Optional)

Underwater Manager (Optional) Underwater Shaders - Version 1.5 Thank you for purchasing Underwater Shaders! Underwater Manager (Optional) The Underwater Manager prefab can be dragged into your scene. It is a simple game object with

More information

Canonical Shaders for Optimal Performance. Sébastien Dominé Manager of Developer Technology Tools

Canonical Shaders for Optimal Performance. Sébastien Dominé Manager of Developer Technology Tools Canonical Shaders for Optimal Performance Sébastien Dominé Manager of Developer Technology Tools Agenda Introduction FX Composer 1.0 High Performance Shaders Basics Vertex versus Pixel Talk to your compiler

More information

Ray Tracing Part 1. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar & Kevin Gibson

Ray Tracing Part 1. CSC418/2504 Introduction to Computer Graphics. TA: Muhammed Anwar & Kevin Gibson Ray Tracing Part 1 CSC418/2504 Introduction to Computer Graphics TA: Muhammed Anwar & Kevin Gibson Email: manwar@cs.toronto.edu Overview Introduction / Motivation Rasterization vs Ray Tracing Basic Pseudocode

More information

DirectX10 Effects and Performance. Bryan Dudash

DirectX10 Effects and Performance. Bryan Dudash DirectX10 Effects and Performance Bryan Dudash Today s sessions Now DX10のエフェクトとパフォーマンスならび使用法 Bryan Dudash NVIDIA 16:50 17:00 BREAK 17:00 18:30 NVIDIA GPUでの物理演算 Simon Green NVIDIA Motivation Direct3D 10

More information

Basics of GPU-Based Programming

Basics of GPU-Based Programming Module 1: Introduction to GPU-Based Methods Basics of GPU-Based Programming Overview Rendering pipeline on current GPUs Low-level languages Vertex programming Fragment programming High-level shading languages

More information

Fur Shader GRAPHICS PROGRAMMING 2

Fur Shader GRAPHICS PROGRAMMING 2 Fur Shader GRAPHICS PROGRAMMING 2 2DAE5 - GAMEDEVELEPMENT Academiejaar : 2015-2016 Inhoudsopgave Introduction... 2 Shells... 2 Fins... 2 The process... 2 The shader... 3 General... 3 Matrices... 3 Light...

More information

Shader Programming and Graphics Hardware

Shader Programming and Graphics Hardware Shader Programming and Graphics Hardware Marries van de Hoef Graphics 2012/2013, 4 th quarter 1 Practicals The first assignment was about the basics What is going on behind the XNA functions? The second

More information

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science

Texture Mapping. CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science Texture Mapping CS 537 Interactive Computer Graphics Prof. David E. Breen Department of Computer Science 1 Objectives Introduce Mapping Methods - Texture Mapping - Environment Mapping - Bump Mapping Consider

More information

CIS 536/636 Introduction to Computer Graphics. Kansas State University. CIS 536/636 Introduction to Computer Graphics

CIS 536/636 Introduction to Computer Graphics. Kansas State University. CIS 536/636 Introduction to Computer Graphics 2 Lecture Outline Introduction to DirectX & Direct3D Lab 2a: Direct3D Basics William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: http://bit.ly/hgvxlh / http://bit.ly/evizre

More information

MAXIS-mizing Darkspore*: A Case Study of Graphic Analysis and Optimizations in Maxis Deferred Renderer

MAXIS-mizing Darkspore*: A Case Study of Graphic Analysis and Optimizations in Maxis Deferred Renderer MAXIS-mizing Darkspore*: A Case Study of Graphic Analysis and Optimizations in Maxis Deferred Renderer A New Gaming Experience Made Possible With Processor Graphics Released in early 2011, the 2nd Generation

More information

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015

Lighting and Shading II. Angel and Shreiner: Interactive Computer Graphics 7E Addison-Wesley 2015 Lighting and Shading II 1 Objectives Continue discussion of shading Introduce modified Phong model Consider computation of required vectors 2 Ambient Light Ambient light is the result of multiple interactions

More information

Scheme Extensions Aa thru Lz

Scheme Extensions Aa thru Lz Chapter 2. Scheme Extensions Aa thru Lz Topic: Ignore Scheme is a public domain programming language, based on the LISP language, that uses an interpreter to run commands. ACIS provides extensions (written

More information

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping

Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping Computer Graphics (CS 543) Lecture 10: Soft Shadows (Maps and Volumes), Normal and Bump Mapping Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Shadow Buffer Theory Observation:

More information

Shaders. Slide credit to Prof. Zwicker

Shaders. Slide credit to Prof. Zwicker Shaders Slide credit to Prof. Zwicker 2 Today Shader programming 3 Complete model Blinn model with several light sources i diffuse specular ambient How is this implemented on the graphics processor (GPU)?

More information

OpenGL ES 2.0 : Start Developing Now. Dan Ginsburg Advanced Micro Devices, Inc.

OpenGL ES 2.0 : Start Developing Now. Dan Ginsburg Advanced Micro Devices, Inc. OpenGL ES 2.0 : Start Developing Now Dan Ginsburg Advanced Micro Devices, Inc. Agenda OpenGL ES 2.0 Brief Overview Tools OpenGL ES 2.0 Emulator RenderMonkey w/ OES 2.0 Support OpenGL ES 2.0 3D Engine Case

More information

Surface Rendering. Surface Rendering

Surface Rendering. Surface Rendering Surface Rendering Surface Rendering Introduce Mapping Methods - Texture Mapping - Environmental Mapping - Bump Mapping Go over strategies for - Forward vs backward mapping 2 1 The Limits of Geometric Modeling

More information

Supplement to Lecture 22

Supplement to Lecture 22 Supplement to Lecture 22 Programmable GPUs Programmable Pipelines Introduce programmable pipelines - Vertex shaders - Fragment shaders Introduce shading languages - Needed to describe shaders - RenderMan

More information

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! ! The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 4! stanford.edu/class/ee267/! Lecture Overview! Review

More information

Technical Report. Mesh Instancing

Technical Report. Mesh Instancing Technical Report Mesh Instancing Abstract What is Mesh Instancing? Before we talk about instancing, let s briefly talk about the way that most D3D applications work. In order to draw a polygonal object

More information

5.2 Shading in OpenGL

5.2 Shading in OpenGL Fall 2017 CSCI 420: Computer Graphics 5.2 Shading in OpenGL Hao Li http://cs420.hao-li.com 1 Outline Normal Vectors in OpenGL Polygonal Shading Light Sources in OpenGL Material Properties in OpenGL Example:

More information

CSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016

CSE 167: Introduction to Computer Graphics Lecture #7: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 CSE 167: Introduction to Computer Graphics Lecture #7: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Spring Quarter 2016 Announcements Project 2 due Friday 4/22 at 2pm Midterm #1 on

More information

Game Graphics & Real-time Rendering

Game Graphics & Real-time Rendering Game Graphics & Real-time Rendering CMPM 163, W2018 Prof. Angus Forbes (instructor) angus@ucsc.edu Lucas Ferreira (TA) lferreira@ucsc.edu creativecoding.soe.ucsc.edu/courses/cmpm163 github.com/creativecodinglab

More information

Modern Hardware II, Curves. Week 12, Wed Apr 7

Modern Hardware II, Curves. Week 12, Wed Apr 7 University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2010 Tamara Munzner Modern Hardware II, Curves Week 12, Wed Apr 7 http://www.ugrad.cs.ubc.ca/~cs314/vjan2010 News Extra TA office hours

More information

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)!

The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! ! The Graphics Pipeline and OpenGL III: OpenGL Shading Language (GLSL 1.10)! Gordon Wetzstein! Stanford University! EE 267 Virtual Reality! Lecture 4! stanford.edu/class/ee267/! Updates! for 24h lab access:

More information

Shading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline

Shading in OpenGL. Outline. Defining and Maintaining Normals. Normalization. Enabling Lighting and Lights. Outline CSCI 420 Computer Graphics Lecture 10 Shading in OpenGL Normal Vectors in OpenGL Polygonal Shading Light Source in OpenGL Material Properties in OpenGL Approximating a Sphere [Angel Ch. 6.5-6.9] Jernej

More information

CS451Real-time Rendering Pipeline

CS451Real-time Rendering Pipeline 1 CS451Real-time Rendering Pipeline JYH-MING LIEN DEPARTMENT OF COMPUTER SCIENCE GEORGE MASON UNIVERSITY Based on Tomas Akenine-Möller s lecture note You say that you render a 3D 2 scene, but what does

More information

CSE 167: Introduction to Computer Graphics Lecture #13: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015

CSE 167: Introduction to Computer Graphics Lecture #13: GLSL. Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 CSE 167: Introduction to Computer Graphics Lecture #13: GLSL Jürgen P. Schulze, Ph.D. University of California, San Diego Fall Quarter 2015 Announcements Project 6 due Friday Next Thursday: Midterm #2

More information

Technical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics

Technical Game Development II. Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS 4731 Computer Graphics Shader Programming Technical Game Development II Professor Charles Rich Computer Science Department rich@wpi.edu Reference: Rost, OpenGL Shading Language, 2nd Ed., AW, 2006 The Orange Book Also take CS

More information

Recall: Indexing into Cube Map

Recall: Indexing into Cube Map Recall: Indexing into Cube Map Compute R = 2(N V)N-V Object at origin Use largest magnitude component of R to determine face of cube Other 2 components give texture coordinates V R Cube Map Layout Example

More information

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 6 Part 2 Lighting and Shading in OpenGL Matt Burlick - Drexel University - CS 430 1 OpenGL Shading Need Vertex Normals Material properties Lights Position of

More information

Deferred rendering using Compute shaders

Deferred rendering using Compute shaders Deferred rendering using Compute shaders A comparative study using shader model 4.0 and 5.0 Benjamin Golba 1 P a g e This thesis is submitted to the Department of Interaction and System Design at Blekinge

More information

Pixel Power (P2) Eliane Kabkab System Integrator Nageswar Keetha Language Guru Eric Liu Project Manager Kaushik Viswanathan System Architect

Pixel Power (P2) Eliane Kabkab System Integrator Nageswar Keetha Language Guru Eric Liu Project Manager Kaushik Viswanathan System Architect Pixel Power (P2) Eliane Kabkab System Integrator Nageswar Keetha Language Guru Eric Liu Project Manager Kaushik Viswanathan System Architect Today s Landscape Multi-core computers Increasing importance

More information

Deferred Rendering Due: Wednesday November 15 at 10pm

Deferred Rendering Due: Wednesday November 15 at 10pm CMSC 23700 Autumn 2017 Introduction to Computer Graphics Project 4 November 2, 2017 Deferred Rendering Due: Wednesday November 15 at 10pm 1 Summary This assignment uses the same application architecture

More information

RenderMonkey 1.6. Natalya Tatarchuk ATI Research

RenderMonkey 1.6. Natalya Tatarchuk ATI Research RenderMonkey 1.6 Natalya Tatarchuk ATI Research Game Developer Conference, San Francisco, CA, March 2005 Overview > What is RenderMonkey? > What s New In RenderMonkey 1.6? 2 What is RenderMonkey? > Shader

More information

CS195V Week 9. GPU Architecture and Other Shading Languages

CS195V Week 9. GPU Architecture and Other Shading Languages CS195V Week 9 GPU Architecture and Other Shading Languages GPU Architecture We will do a short overview of GPU hardware and architecture Relatively short journey into hardware, for more in depth information,

More information

CS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics

CS4621/5621 Fall Basics of OpenGL/GLSL Textures Basics CS4621/5621 Fall 2015 Basics of OpenGL/GLSL Textures Basics Professor: Kavita Bala Instructor: Nicolas Savva with slides from Balazs Kovacs, Eston Schweickart, Daniel Schroeder, Jiang Huang and Pramook

More information

Beginning Direct3D Game Programming: 1. The History of Direct3D Graphics

Beginning Direct3D Game Programming: 1. The History of Direct3D Graphics Beginning Direct3D Game Programming: 1. The History of Direct3D Graphics jintaeks@gmail.com Division of Digital Contents, DongSeo University. April 2016 Long time ago Before Windows, DOS was the most popular

More information

To Do. Demo for mytest3. Methodology for Lecture. Importance of Lighting. Brief primer on Color. Computer Graphics

To Do. Demo for mytest3. Methodology for Lecture. Importance of Lighting. Brief primer on Color. Computer Graphics Computer Graphics CSE 167 [Win 17], Lecture 7: OpenGL Shading Ravi Ramamoorthi http://viscomp.ucsd.edu/classes/cse167/wi17 To Do This week s lectures have all info for HW 2 Start EARLY Methodology for

More information

Shader Programming 1. Examples. Vertex displacement mapping. Daniel Wesslén 1. Post-processing, animated procedural textures

Shader Programming 1. Examples. Vertex displacement mapping. Daniel Wesslén 1. Post-processing, animated procedural textures Shader Programming 1 Examples Daniel Wesslén, dwn@hig.se Per-pixel lighting Texture convolution filtering Post-processing, animated procedural textures Vertex displacement mapping Daniel Wesslén 1 Fragment

More information

CS 432 Interactive Computer Graphics

CS 432 Interactive Computer Graphics CS 432 Interactive Computer Graphics Lecture 7 Part 2 Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 1 Topics Texture Mapping in OpenGL Matt Burlick - Drexel University - CS 432 2

More information

Rendering Objects. Need to transform all geometry then

Rendering Objects. Need to transform all geometry then Intro to OpenGL Rendering Objects Object has internal geometry (Model) Object relative to other objects (World) Object relative to camera (View) Object relative to screen (Projection) Need to transform

More information

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing

3D Graphics for Game Programming (J. Han) Chapter II Vertex Processing Chapter II Vertex Processing Rendering Pipeline Main stages in the pipeline The vertex processing stage operates on every input vertex stored in the vertex buffer and performs various operations such as

More information

Optimal Shaders Using High-Level Languages

Optimal Shaders Using High-Level Languages Optimal Shaders Using High-Level Languages The Good, The Bad, The Ugly All high level languages provide significant power and flexibility that: Make writing shaders easy Make writing slow shaders easy

More information