24
cs4995- 1 2/11/20 Page 1 Special Image Effects • Particle Systems • Fog • Lens Flares • Shadows • Programmable Shaders

Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

Embed Size (px)

Citation preview

Page 1: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 1

Special Image Effects

• Particle Systems

• Fog• Lens Flares• Shadows• Programmable Shaders

Page 2: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 2

Particle Systems

• Each particle is a point, line, or textured polygons (with transparency).

• Polygons can be oriented to always face the viewpoint (fire, water spray, explosions, weapon fire, etc.)

• Or textured onto surfaces (splats)• Usually thousands of particles are used

Page 3: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 3

Particle Systems• Particle Source

• Particle Attributes (can be static or functional)– Position– Velocity (speed and direction) – Color– Lifetime– Age– Shape– Size– Transparency

Shape

Point

Page 4: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 4

Particle Systems

• Simple concept, simple to implement…• However, a good implementation requires

some careful thought and consideration since you need to dynamically manage thousands of objects.

Page 5: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 5

Particle Systems

• Some links– Particle Systems by Allen Martin

• http://www.cs.wpi.edu/~matt/courses/cs563/talks/psys.html

– Gammasutra: Building an Advanced Particle System• http://www.gamasutra.com/features/20000623/vanderburg_01.htm

– Particle Systems API• http://www.cs.unc.edu/~davemc/Particle/• (demo taken from here)

Page 6: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 6

Fog

• Function of distance from the camera (linear or exponential)– as distance increases, bring colors to grey

• Can be done just with Z-buffer• Also can be used to reduce scene

complexity• Same idea can be used to fade far objects in

and out (prevents flickering)

Page 7: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 7

Fog example 1

MechWarrior 4: Mercenaries

Page 8: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 8

Fog example 2

Page 9: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 9

Billboard objects

• Textured polygons that rotate to stay flat towards the eye.

• Used often for trees, trees, clouds, smoke, explosions, lens effects, etc.

Red Faction 3 - PC

Another way to do trees, bushes, telephone poles, etc. without reorienting polygons each frame

Page 10: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 10

Lens Effects• Billboards at varying levels of depth.• Usually rendered last.• Sometimes just an overlay on the screen.

From http://www.geocities.com/SiliconValley/Lakes/1434/lenseffects.html

Page 11: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 11

Lens animation

Page 12: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 12

Lens Effects – Asheron’s Call 2

Asheron’s Call 2

Page 13: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 13

Shadows

• Projected shadows on flat surfaces (project polygon onto surface)

Page 14: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 14

Soft Shadows

• Multiple light sources or area sources give soft shadows (umbra, penumbra)

penumbra

umbra

penumbra

umbra

Page 15: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 15

Soft Shadows

From http://www.stereopsis.com/shadow/

Page 16: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 16

Shadow Volumes

Page 17: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 17

Programmable Shaders

• Renderman was the first programmable shading language

• DirectX 8 featured vertex and pixel shaders• Nvidia and ATI boards now have

programmable shading capabilities

Page 18: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 18

Direct3D Pipeline

Page 19: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 19

Shaders

• Vertex Shaders: – procedural geometry deformation – range-based or radial fog effects – camera lens effects including fish eye, wide angle, and

water refraction effects.

• Pixel Shaders: – per-pixel reflections – per-pixel lighting using Phong-style shading or DOT3

effects – procedural textures

Page 20: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 20

Cg Vertex Shader Examples

Anisotropic Lighting Fog

Page 21: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 21

Cg Vertex Shader Examples

Stencil Shadow VolumesRefract Reflect Demo

Page 22: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 22

Cg Pixel Shader Examples

Soft Stencil Shadows Hardware Shadow Maps

Page 23: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 23

Cg Pixel Shader Examples

Water InteractionFlare

Page 24: Cs4995-1 2/11/2003 Page 1 Special Image Effects Particle Systems Fog Lens Flares Shadows Programmable Shaders

cs4995-12/11/2003 Page 24

Cg Shader Examples

Firehttp://www.cgshaders.org/shaders/show.php?id=39

Shadow volumes w/foghttp://www.cgshaders.org/shaders/show.php?id=49