Download presentation
Presentation is loading. Please wait.
Published byKelly Harmon Modified over 8 years ago
1
Lecture 9 --- Rendering pipeline, shaders and effects 1Elias Holmlid
2
First part: The rendering pipeline Effects & shaders overview XNA, HLSL & Effects Shader authoring tools Particle Systems Second part Effect, texturing and particle system example Elias Holmlid2
3
3
4
Rasterization Taking vertex positions from the vertex shader and transforming them into pixels. Elias Holmlid4
5
Transform and shading of geometry Particles: motion + shading Intermediate buffers (textures) Post processing Elias Holmlid5
6
Texture Elias Holmlid6
7
Texture + Directional light Elias Holmlid7
8
Texture + Directional light + Spotlight Elias Holmlid8
9
Texture + Directional light + Spotlight + Normal map Elias Holmlid9
10
Texture + Directional light + Spotlight + Normal map + Pointlight Elias Holmlid10
11
Texture + Directional light + Spotlight + Normal map + Pointlight + Shadows Elias Holmlid11
12
Elias Holmlid12 Example: Heat texture
13
Elias Holmlid13 Example: Soft shadows
14
Bloom disabledBloom enabled Elias Holmlid14
15
C-like syntax No object orientation Functions can be used By using include-files, functions and datatypes can be reused Elias Holmlid15
16
Elias Holmlid16
17
Elias Holmlid17
18
Vertex shader Used to transform vertices ▪ Solids deforming ▪ Skeletal animation ▪ Particle motion Elias Holmlid18
19
Pixel shader Manipulates pixel color and optionally the pixel depth. Examples: ▪ Lighting ▪ Contrast ▪ Blur Elias Holmlid19
20
Easy to work with in XNA Represented by the class Effect Effect effect; effect.Load (”/effects/lightEffect”); You can then set the attributes of the effect effect.Parameters[”lightPosition”].SetValue() To make the code more robust and efficient, implement a helper class for each effect. After a while, you may want to find a faster way of adding new shaders Elias Holmlid20
21
Complete IDE´s available for developing shaders Elias Holmlid21
22
A way to simulate explosions, water, fire etc. Particles behave in a similar, yet slightly different way Elias Holmlid22
23
Particles created and killed on the CPU Custom vertex declaration used Pooling should be used (no memory allocation during runtime) Current position/color/size of each particle calculated in vertex shader Final color decided in pixel shader Elias Holmlid23
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.