Transparency CISC 3620 May 15, 2017
Outline
Reading Real-Time Rendering, 5.7
Semitransparent object ◮ View-based effects: semitransparent object itself is rendered ◮ Light-based effects: object causes light to be weakened or bent, which causes other objects in the scene to be lit and rendered differently Simplest form: view-based: semitransparent object acts as color filter of the view of the objects behind it
A-buffer Depth of closest fragment is stored in Z-buffer Limitation: Only one object stored per pixel A -buffer : has “deep pixels” that store n fragments that are resolved to single pixel color after all objects are rendered Can also work with Z-buffer.
Screen-door transparency render semitransparent polygon with checkerboard fill pattern: render every other pixel, so object behind it is partially visible pixels on screen will be close enough together that checkerboard pattern itself is not visible.
Screen-door transparency ◮ Faster ◮ Some visual quality is sacrificed ◮ Limits number of transparent objects that can be layered
Alpha coverage Transparency = how many samples inside pixels are covered Like screen-door transparency but at sub-pixel level Used to antialias edges of cutout textures: ◮ Suppose a fragment covers a pixel but is 25% transparent due to cutout texture ◮ Render fragment as fully opaque, but covering only three of the four samples ◮ No sorting necessary ◮ Object silhouette will hide objects behind it in consistent way along its edges
Alpha coverage
Alpha test Only allows for two levels of transparency: opaque or not (no translucency) Sorting not necessary
Blending Alpha value is used to combine color of 2+ fragments. Without blending: each new fragment overwrites existing colors in framebuffer With blending: combine color of old fragment and new fragment Let source RGBA color be: c s , destination color be c d Final blended color: c o = α s c s + (1 − α s ) c d Requires sorting : first opaque objects rendered, then transparent objects blended on top in back to front order
Blending
Blending without sorting vs. depth peeling
Depth peeling Everitt, "Interactive order-independent transparency"
Sorting ◮ Painter’s algorithm ◮ Z-buffer testing without z-depth replacement for transparent objects. ◮ Render transparent objects twice, first backfaces and then frontfaces ◮ A-buffer: combine fragments in sorted order for high-quality transparency
Depth peeling First render opaque surfaces, store depths in z-buffer Then render transparent surfaces with depth greater than in z-buffer but less than some threshold Then another pass with closer threshold Etc.
Anti-aliasing If opaque fragment covers 30% of screen grid cell, have alpha of 0.3, used to blend object’s edge with the scene.
Recommend
More recommend