Docsity

Multipass Rendering: Achieving Complex Visual Effects with Multiple Passes, Study notes of Computer Graphics

Toggle sidebar
bg1
Multipass Rendering Enables Many Things
But we can achieve many effects with multiple passes
• we’ve already seen a couple of examples of this
Multiple passes for environment maps
• first, we render the world to create an environment map
• then we render again to apply this “reflection”
Multiple passes for shadows
• shadow map algorithm we discussed is another good example
• we render the world from each light position
• and use multiple passes to generate shadows
pf3
pf4
pf5

Partial preview of the text

Download Multipass Rendering: Achieving Complex Visual Effects with Multiple Passes and more Study notes Computer Graphics in PDF only on Docsity!

Multipass Rendering Enables Many Things But we can achieve many effects with multiple passes^ • we’ve already seen a couple of examples of this Multiple passes for environment maps^ • first, we render the world to create an environment map• then we render again to apply this “reflection” Multiple passes for shadows^ • shadow map algorithm we discussed is another good example• we render the world from each light position• and use multiple passes to generate shadows

“Removing” Hidden Lines with 2 Passes Notice that we see

all^ the lines

  • even for triangles in back• which can be confusing There are many algorithms for this • was once an important problem But OpenGL provides us a nice trick • first, draw all the polygons• but in the background color• now draw all the wireframe lines To make this look nice • see glPolygonOffset()• make lines sit on top of polygons

The OpenGL Stencil Buffer Another buffer, alongside the frame buffer and depth buffer^ • typically <= 8 bits per pixel• can subject fragments to a stencil test during rasterization– those that fail the test don’t get written to frame buffer• turned on with glEnable(GL_STENCIL_TEST)• test selected with glStencilFunc()• control writing into stencil buffer with glStencilOp() Among other things, can be used to mask drawing operations^ • fill in the stencil pixels where drawing is allowed (say with 1)• draw scene with glStencilFunc(GL_EQUAL, 1, 1)• fragments where stencil is not 1 are discarded• see Red Book for more details

Accumulation Buffer Many multipass rendering methods have a similar structure:^ • render scene multiple times in different ways• sum/average corresponding pixels in the resulting images OpenGL’s accumulation buffer makes this easy^ • one downside is that it’s not always implemented in hardware

Accumulation Buffer Uses Scene antialiasing by super-sampling^ • clear the accumulation buffer• repeatedly render, moving the camera slightly each time• accumulate each image with glAccum(GL_ACCUM, 1/k) Motion blur by temporal super-sampling^ • same as above but perturb time instead of camera [see Red Book for implementation details]