300 likes | 504 Vues
Last Time. Sub-structuring Adaptive Meshing Hierarchical Radiosity. Today. Importance Better Form Factors Different Basis Functions Meshing. Importance. For a single image, only the visible surfaces are directly important Don’t care what’s “down the hall”
E N D
Last Time • Sub-structuring • Adaptive Meshing • Hierarchical Radiosity © 2003 University of Wisconsin
Today • Importance • Better Form Factors • Different Basis Functions • Meshing © 2003 University of Wisconsin
Importance • For a single image, only the visible surfaces are directly important • Don’t care what’s “down the hall” • Surfaces illuminating visible surfaces are also important, and other surfaces illuminating those surfaces… • Importance propagates backwards from the “primary” sources of importance • Visible surfaces are typically prime sources of importance © 2003 University of Wisconsin
Solving for Importance • Ri is the inherent importance of a given element • When radiosity is gathered, importance is shot • Note the form factor in the above equation, and the reflectance term • Use BIF as error estimate in determining subdivision • Combine with multi-grid method • Note: must use different push-pull operations for importance • Push down area-weighted, pull up non-weighted © 2003 University of Wisconsin
Form Factor Errors • Hemicube replaces the form factor double integral with a point to area form factor • Assumes small changes over the source patch (Fij is Fsource-receive) • Violated if patches are close – cosine terms and distances vary greatly • Violated if visibility varies across source patch • Limited hemicube resolution results in aliasing • Small patches may not be seen, or may “beat” • We talked about this last time • Reciprocity relation used to compute progressive radiosity form factor is applied incorrectly © 2003 University of Wisconsin
Hemicube Beating Raw patch intensities Interpolated © 2003 University of Wisconsin
Decoupling Hemicube Duties • Hemicube computes two distinct things: • Visibility • Sub-area form factors – uses pixel form factor to estimate point to element form factor • Replace one of both with alternate methods • Use hemicube visibility but compute patch to element form factors accurately • Visibility from ray-casting • Sub-area form factors from disc approximation © 2003 University of Wisconsin
Shooting to Vertices • “Standard” progressive radiosity shoots from points to areas (due to hemicubes) • Point is middle of shooting patch • Area is the area of a receiving element • Better to shoot from area to points: • Area is source patch, point is receiving vertex • Progressive radiosity really needs Fji • Less aliasing under certain circumstances • Radiosity is needed at vertices for display • Greater control over receivers © 2003 University of Wisconsin
Patch-to-Element Form Factors • Use hemi-cube to determine visible elements • For each pixel, compute form factor from visible point back to the source patch, ie compute Fji directly • Each pixel is a small piece of receiving element, and source patch may be large, so point-patch form factor is more accurate • For each receiving element, area-weight sum the point-patch radiosities • Which violated assumption of hemicube does this address? © 2003 University of Wisconsin
Ray-casting • Aim: compute • Cast rays from y to sub-patches, Pik, of Pi: • Ray determines (constant) visibility for each sub-patch • Then: © 2003 University of Wisconsin
Delta Form Factors • We need to compute Fk • Several possibilities • Assume constant, evaluated using angles and radius for a point at the center of the patch (can be very bad) • Use analytic methods, point-polygon (costly) • Use disc approximation • Assume sub-patch is a small disc • Form factor for point-disc is known © 2003 University of Wisconsin
Enhancements • Sample points on source can be varied • Keep subdividing source patch until the estimate for each sub-patch is similar to that for its children • Place receiving vertices on all surfaces - no chance to miss surfaces entirely • Stratified sampling • Arbitrary precision with more rays • But eventually the “constant radiosity over patch/element” assumption bites © 2003 University of Wisconsin
More ways to improve • Ray casting is expensive • Visibility and all the standard ray-tracing speedups apply • Note that test for visibility is like shadow-ray test, so use caching • Spatial subdivisions (eg octree) help too • We are still assuming constant radiosity across patches, and computing meshes on the fly • Allow different basis functions (non constant) • Better meshing © 2003 University of Wisconsin
Return to Assumptions • Recall the two fundamental assumptions of the standard radiosity approach: • Constant radiosity over each element • Perfectly diffuse surfaces • We wish to more accurately represent the radiosity at every point: • Regardless of the quality of the solution (form factors, subdivision, etc.), if the correct radiosity cannot be represented, it won’t be computed © 2003 University of Wisconsin
Better Radiosity Representations • Two approaches: • Work around the constant radiosity assumption by constructing meshes where elements really should have constant (or bilinear) radiosity • Use more expressive representations for radiosity (work under different assumptions) © 2003 University of Wisconsin
Meshing Artifacts • Where does poor meshing really show? • Find the (many) artifacts in the image © 2003 University of Wisconsin
Typical Meshing • Lays down an orthogonal grid in some orientation • May subdivide, but the principle directions remain unchanged • Require subdivision down to pixel resolution to remove artifacts © 2003 University of Wisconsin
Staircase Effect • Most evident at shadow boundaries: • Elements are dark if they have more than half shadow, light otherwise • Solution: • Subdivide the mesh to sub-pixel resolution (costly) • Blur the boundaries (introduces other problems) • Align element boundaries with the shadow boundaries (discontinuity meshing, later) © 2003 University of Wisconsin
Staircase Effect © 2003 University of Wisconsin
Light and Shadow Leaks • Occur when the mesh does not respect geometric boundaries • Interior walls meeting the floor • The wall appears to float • Shadows leaking out from under objects • No reasonable perceptual interpretation – these look worse • Solutions: • Ensure that there are element boundaries at geometric intersections (hard to do without user help) • Discontinuity meshing © 2003 University of Wisconsin
Shadow Leaks © 2003 University of Wisconsin
Interpolation Artifacts • Have to “fill in” radiosity between vertices, or blur element boundaries • Interpolation schemes are frequently poorly implemented, particularly those in hardware • Solutions: • Meshes that make interpolation easier • More expensive interpolation © 2003 University of Wisconsin
Poor Interpolation © 2003 University of Wisconsin
Preprocessing the Mesh • Seek to remove inconsistencies before starting the solution • Ensure invariants are met: • Objects are solid • Objects don’t intersect • This is very hard to do automatically - it should be part of the modeling process • But, commercial modelers are generally poor in this regard © 2003 University of Wisconsin
Fixing Interpolation • Pre-process to remove concave polygons • Replace them with triangles - not too hard • Enforce subdivision constraints • Neighboring patches cannot differ by more than one subdivision level • Post-process the remove T-vertices • Subdivide mismatched neighbors and interpolate new vertices correctly © 2003 University of Wisconsin
Smoother Interpolants • Bi-linear (hardware accelerated) interpolation uses only vertices of given polygon • Build higher order interpolants • Must make sure not to use a high-order interpolant across a low order discontinuity • Gather to a texture or cloud of points • Gather to pixels in the image (slow, but good results) © 2003 University of Wisconsin
Discontinuity Meshing • Identify expected discontinuities and mesh around them • Sharp boundaries due to point light sources or object contact • Derivative discontinuities due to area sources and multi-object shadows • Related to aspect graphs in computer vision • Places where the set of visible things changes © 2003 University of Wisconsin
Two Types of Discontinuities • Assume polygonal environment • Vertex-Edge events • Discontinuities where the plane defined by a vertex and an edge intersects other objects • Edge-Edge-Edge • Higher order discontinuities at places where three edges appear to meet at a point • Produce quadric curves as shadow boundaries, which are hard to mesh • Generally ignored © 2003 University of Wisconsin
Meshing With Discontinuities • Construct VE planes • Intersect them with surfaces • Mesh the resulting edges • Constrained triangulation is a difficult problem • Mesh must be able to store different radiosity values at one point, because radiosity is different on each side of the edge © 2003 University of Wisconsin
Using Discontinuity Meshes • Very high number of possible discontinuities: O(n6) for n vertices • Only find discontinuities due to bright light sources • Try to only find visible discontinuities • Research topic: Integrate into hierarchical scheme • Use discontinuities as splitting planes in hierarchy © 2003 University of Wisconsin