Teaser: natural waters using wind-based wave generation Rendering Transparent and Turbid Fluids PhD Course on the Deformable Simplicial Complex Method Jeppe Revall Frisvad August 2010 To learn more about rendering, see Recommended reference http://www.imm.dtu.dk/courses/02576/ - Premoˇ ze, S., and Ashikhmin, M. Rendering natural waters. Computer Graphics Forum 20 (4), pp. 189–199, 2001. Teaser: direct-able breaking waves Teaser: watch Surf’s Up if you didn’t � Recommended reference - Bredow, R., Schaub, D., Kramer, D., Hausman, M., Dimian, D., and Duguid, R. S. Surf’s Up: The Making Recommended reference of an Animated Documentary , ACM SIGGRAPH 2007 Course Notes, Course 12, 2007. - Bredow, R., Schaub, D., Kramer, D., Hausman, M., Dimian, D., and Duguid, R. S. Surf’s Up: The Making of an Animated Documentary , ACM SIGGRAPH 2007 Course Notes, Course 12, 2007.
Models needed for physically based rendering Materials (scattering and absorption of light) ◮ Optical properties (index of refraction, n ( λ ) = n ′ ( λ ) + i n ′′ ( λ ) ). ◮ Reflectance distribution functions, f ( x i , x o , � ω i , � ω o ). ◮ Think of the experiment: “taking a picture”. ◮ What do we need to model it? ◮ Camera ◮ Scene geometry n 1 ◮ Light sources x i x o ◮ Light propagation ◮ Materials ◮ Mathematical models for these physical phenomena are n 2 required as a minimum in order to render an image. ◮ We can use very simple models, but, if we desire a high level of realism, more complicated models are required. n 1 ◮ To get started, we will go through the simpler models (in opposite order). n 2 Light propagation Light sources ◮ A light source is described by a spectrum of light L e ,λ ( x , � ω o ) ◮ Visible light is electromagnetic waves of wavelengths ( λ ) from which is emitted from each point on the emissive object. 380 nm to 780 nm . ◮ A simple model is a light source that from each point emits the same amount of light in all directions and at all wavelengths, L e ,λ = const . ◮ The spectrum of heat-based light sources can be estimated using Planck’s law of radiation. Examples: ◮ Electromagnetic waves in transparent media propagate as rays of light for λ → 0. ◮ Rays of light follow the path of least time (Fermat). ◮ How does light propagate in air? In straight lines (almost). ◮ The parametrisation of a straight line in 3D is therefore a ◮ The surface geometry of light sources is modelled in the same good, simple model for light propagation. way as other geometry in the scene.
Scene geometry Examples of fluid geometry ◮ Surface geometry is often modelled by a collection of triangles some of which share edges (a triangle mesh). ◮ Triangles provide a discrete representation of an arbitrary surface. A quick example: ◮ Triangles are useful as they are defined by only three vertices. Reference for the two renderings in the second row And ray-triangle intersection is simple. - Bredow, R., Schaub, D., Kramer, D., Hausman, M., Dimian, D., and Duguid, R. S. Surf’s Up: The Making of an Animated Documentary , ACM SIGGRAPH 2007 Course Notes, Course 12, 2007. Camera Ray casting ◮ A camera consists of a light sensitive area, a processing unit, ◮ Camera description: and a storage for saving the captured images. ◮ The simplest model of a camera is a rectangle, which models Extrinsic parameters Intrinsic parameters the light sensitive area (the chip/film), placed in front of an e Eye point φ Vertical field of view eye point where light is gathered. p View point d Camera constant � Up direction W , H Camera resolution u ◮ Sketch of ray generation: image plane film u e d h v e φ p ◮ We can use this model in two different ways: ray film ◮ Follow rays from the eye point through the rectangle and pixel ( i , j ) onwards (ray casting). ◮ Project the geometry on the image plane and find the ◮ For each ray, find the closest point where it intersects a triangle. geometry that ends up in the rectangle (rasterization).
What is a ray? Ray tracing ◮ Parametrisation of a line: x ( t ) = e + t � r . ◮ What do you need in a ray tracer? ◮ Camera (ray generation and lens effects) ◮ Camera provides origin ( e ) and direction ( � r ) of “eye rays”. ◮ Ray-object intersection (and accelleration) ◮ Light distribution (different source types) ◮ Visibility testing (for shadows) ◮ Surface scattering (reflection models) ◮ Recursive ray tracing (rays spawn new rays) ◮ How to use a ray tracer? Trace radiant energy. ◮ The energy travelling along a ray of direction � r = − � ω is measured in radiance ( flux per projected area per solid angle ). ◮ The outgoing radiance L o at a surface point x is the sum of ◮ The user sets origin and direction when tracing rays recursively. emitted radiance L e and reflected radiance L r : ◮ But we need more properties: ◮ Maximum distance (max t ) for visibility detection. L o ( x , � ω ) = L e ( x , � ω ) + L r ( x , � ω ) . ◮ Information about what was hit and where (hit normal, position, distance, material, etc.). ◮ Reflected radiance is computed using the BRDF ( f r ) and an ◮ A counter to tell us the trace depth: how many reflections or estimate of incident radiance L i at the surface point. refractions the ray suffered from (no. of recursions). The rendering equation A Monte Carlo estimator for the rendering equation ◮ Surface scattering is defined in terms of ◮ The rendering equation: ◮ Radiance: � d 2 Φ ω ′ ) cos θ d ω ′ . ω ′ , � L o ( x , � ω ) = L e ( x , � ω ) + f r ( x , � ω ) L i ( x , � L = cos θ d A d ω . 2 π ◮ Irradiance: ◮ The Monte Carlo estimator: d Φ E = d E = L cos θ d ω . , d A N ω ′ ω ′ ω ) + 1 f r ( x , � i , � ω ) L i ( x , � i ) cos θ ◮ BRDF: � L N ( x , � ω ) = L e ( x , � . ω ′ ω ) = d L r ( x , � ω ) pdf( � i ) N f r ( x , � ω ′ , � ω ′ ) . i =1 d E ( x , � ◮ The Lambertian (perfectly diffuse) BRDF: ◮ The rendering equation then emerges from L o = L e + L r : ω ′ , � � f r ( x , � ω ) = ρ d /π . ω ) cos θ ′ d ω ′ . ω ′ , � L o ( x , � ω ) = L e ( x , � ω ) + f r ( x , � ω ) L i ( x , � 2 π ◮ A good choice of pdf would be: ◮ This is an integral equation. ω ′ pdf( � i ) = cos θ/π . ◮ Integral equations are recursive in nature.
Cosine-weighted hemisphere sampling Ambient occlusion ◮ Sampling directions according to the distribution: ω ′ pdf( � i ) = cos θ/π . ◮ In spherical coordinates: pdf( θ, φ ) = cos θ sin θ/π . ◮ With two uniform random variables ξ 1 , ξ 2 ∈ [0 , 1], this pdf is sampled by ( θ, φ ) = (cos − 1 � ξ 1 , 2 πξ 2 ) . ◮ In a local coordinate system, where the z -axis is the zenith ◮ Using the Lambertian BRDF for materials, f r = ρ d /π ; the direction, the corresponding direction vector is ω ′ cosine weighted hemisphere for sampling, pdf( � i ) = cos θ/π ; and a visibility term V for incident illumination, the Monte ( x , y , z ) = (sin θ cos φ, sin θ sin φ, cos θ ) . Carlo estimator for ambient occlusion is simply: ◮ If we find an orthonormal basis { � b 1 ,� b 2 ,� n } which includes the N N ω ′ ω ′ ω ) = 1 f r ( x , � i , � ω ) L i ( x , � i ) cos θ = ρ d ( x ) 1 surface normal � n , we can rotate to world coordinates by a � � ω ′ L N ( x , � V ( � i ) . ω ′ N pdf( � i ) N change of basis i =1 i =1 ω ′ i = x � b 1 + y � b 2 + z � � n . Sampling a triangle mesh Soft shadows ◮ Uniformly sample a triangle (pdf = 1 / n , where n is the number of triangle faces in the mesh). ◮ Uniformly sample a position on the triangle (pdf = 1 / A ∆ , where A ∆ is the triangle area): 1. Sample barycentric coordinates ( u , v , w = 1 − u − v ): � 1 − u = ξ 1 � v = (1 − ξ 2 ) ξ 1 ◮ From solid angle to area: d ω ′ = cos θ light d A . � w = ξ 2 ξ 1 r 2 ◮ Using the Lambertian BRDF, f r = ρ d /π , and triangle mesh 2. Use the barycentric coordinates for trilinear interpolation of sampling of a point x i on the light, pdf = 1 / ( nA ∆ , i ), the triangle vertices to obtain a point on the triangle. Monte Carlo estimator for area lights is: 3. Use the barycentric coordinates for trilinear interpolation of triangle vertex normals to obtain the normal at the sampled N L e ( x i → x ) V ( x i ↔ x )cos θ cos θ light ω ) = ρ d ( x ) 1 � surface point. L N ( x , � nA ∆ , i . � x − x i � 2 π N i =1
Recommend
More recommend