Sky Rendering The actual physics is very complicated and costly to calculate. Several cheap approaches for very distant skies: –Constant backdrop –Skybox.

Slides:



Advertisements
Similar presentations
MAT 594CM S2010Fundamentals of Spatial ComputingAngus Forbes Overview Goals of the course: 1. to introduce real-time 3D graphics programming with openGL.
Advertisements

Graphics Pipeline.
Computer Graphic Creator: Mohsen Asghari Session 2 Fall 2014.
Projective Texture Mapping
Texture Mapping. Texturing  process that modifies the appearance of each point on a surface using an image or function  any aspect of appearance can.
Week 7 - Monday.  What did we talk about last time?  Specular shading  Aliasing and antialiasing.
Projection Matrix Tricks Eric Lengyel Outline  Projection Matrix Internals  Infinite Projection Matrix  Depth Modification  Oblique Near Clipping.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2007 Tamara Munzner Viewing/Projections I.
OpenGL (II). How to Draw a 3-D object on Screen?
CHAPTER 7 Viewing and Transformations © 2008 Cengage Learning EMEA.
2/26/04© University of Wisconsin, CS559 Spring 2004 Last Time General Orthographic Viewing –Specifying cameras in world coordinates –Building world  view.
09/18/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Bump Mapping Multi-pass algorithms.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
CSE 381 – Advanced Game Programming Basic 3D Graphics
Geometric Objects and Transformations. Coordinate systems rial.html.
3D Objects Subject:T0934 / Multimedia Programming Foundation Session:12 Tahun:2009 Versi:1/0.
02/26/02 (c) 2002 University of Wisconsin, CS 559 Last Time Canonical view pipeline Orthographic projection –There was an error in the matrix for taking.
Programmable Pipelines. 2 Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Week 2 - Wednesday CS361.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
Image Synthesis Rabie A. Ramadan, PhD 2. 2 Java OpenGL Using JOGL: Using JOGL: Wiki: You can download JOGL from.
1 SIC / CoC / Georgia Tech MAGIC Lab Rossignac Textures and shadows  Generation  Mipmap  Texture coordinates,
Buffers Textures and more Rendering Paul Taylor & Barry La Trobe University 2009.
Week 5 - Wednesday.  What did we talk about last time?  Project 2  Normal transforms  Euler angles  Quaternions.
CS559: Computer Graphics Lecture 9: Projection Li Zhang Spring 2008.
Foundations of Computer Graphics (Fall 2012) CS 184, Lectures 13,14: Reviews Transforms, OpenGL
CS 638, Fall 2001 Multi-Pass Rendering The pipeline takes one triangle at a time, so only local information, and pre-computed maps, are available Multi-Pass.
Computer Graphics The Rendering Pipeline - Review CO2409 Computer Graphics Week 15.
CAP4730: Computational Structures in Computer Graphics 3D Transformations.
10/3/02 (c) 2002 University of Wisconsin, CS 559 Last Time 2D Coordinate systems and transformations.
Programmable Pipelines Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
Games Development 1 Camera Projection / Picking CO3301 Week 8.
CS 450: COMPUTER GRAPHICS PROJECTIONS SPRING 2015 DR. MICHAEL J. REALE.
10/7/04© University of Wisconsin, CS559 Fall 2004 Last Time Transformations Homogeneous coordinates Directions Rotation Geometry 101 – Points, edges, triangles/polygons.
OpenGL The Viewing Pipeline: Definition: a series of operations that are applied to the OpenGL matrices, in order to create a 2D representation from 3D.
Sky Boxes and Vector Math 2 Course Information CVG: Programming 4 My Name: Mark Walsh Website:
OpenGL Viewing and Modeling Transformation Geb Thomas Adapted from the OpenGL Programming Guidethe OpenGL Programming Guide.
Basic Perspective Projection Watt Section 5.2, some typos Define a focal distance, d, and shift the origin to be at that distance (note d is negative)
Computer Graphics Camera Projection / Picking CO2409 Week 8 - Optional Advanced Material Not on Exam.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Lecture 3 Transformations. 2D Object Transformations The functions used for modifying the size, location, and orientation of objects or of the camera.
The Camera Analogy ► Set up your tripod and point the camera at the scene (viewing transformation) ► Arrange the scene to be photographed into the desired.
Chapters 5 2 March Classical & Computer Viewing Same elements –objects –viewer –projectors –projection plane.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 5: Viewing
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
©2005, Lee Iverson Lee Iverson UBC Dept. of ECE EECE 478 Viewing and Projection.
Image-based Rendering Ref: RTRv2. 2 Introduction Sprite, billboard, overview.
Taxonomy of Projections FVFHP Figure Taxonomy of Projections.
Transformations: Projection CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
What are shaders? In the field of computer graphics, a shader is a computer program that runs on the graphics processing unit(GPU) and is used to do shading.
Coordinate Systems Lecture 1 Fri, Sep 2, The Coordinate Systems The points we create are transformed through a series of coordinate systems before.
Digital Image Processing Additional Material : Imaging Geometry 11 September 2006 Digital Image Processing Additional Material : Imaging Geometry 11 September.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
OpenGL and You I Cast, Therefore I Am. Ray Casting Idea is simple, implementation takes some work –Cast rays as if you were the camera –Determine intersection.
Viewing and Projection. The topics Interior parameters Projection type Field of view Clipping Frustum… Exterior parameters Camera position Camera orientation.
3D GRAPHICS RENDERING PIPELINE CS / TECHNICAL BACKGROUND PAGE 11.
Some Notes on 3-D Glenn G. Chappell U. of Alaska Fairbanks CS 381 Lecture Notes Friday, October 24, 2003.
GLSL Review Monday, Nov OpenGL pipeline Command Stream Vertex Processing Geometry processing Rasterization Fragment processing Fragment Ops/Blending.
OpenGL LAB III.
Visible Surface Detection
Perspective projection
3D Computer Graphics (3080/GV10) Week 5-6 Tutorial 3
CSCE 441 Computer Graphics 3-D Viewing
Modeling 101 For the moment assume that all geometry consists of points, lines and faces Line: A segment between two endpoints Face: A planar area bounded.
CENG 477 Introduction to Computer Graphics
Chapter VII Rasterizer
Last Time Canonical view pipeline Projection Local Coordinate Space
Viewing/Projections I Week 3, Fri Jan 25
Presentation transcript:

Sky Rendering The actual physics is very complicated and costly to calculate. Several cheap approaches for very distant skies: –Constant backdrop –Skybox – outer box with the viewer inside. –Skydome – outer hemi-sphere with the viewer inside.

Sky box Start with a box (or half-box) that covers your world. Ensure that the camera stays within this box.

Skybox Map textures to box. Left Top BackRightFront

Skydome Use a hemi-sphere instead. Search web for textures.

OpenGL Projection Matrix –n, f = distances to near, far planes –e = focal length = 1 / tan(FOV / 2) –a = viewport height / width

Take limit as f goes to infinityTake limit as f goes to infinity Infinite Projection Matrix

Directions are mapped to points on the infinitely distant far planeDirections are mapped to points on the infinitely distant far plane A direction is a 4D vector with w = 0 (and at least one nonzero x, y, z)A direction is a 4D vector with w = 0 (and at least one nonzero x, y, z) Good for rendering sky objectsGood for rendering sky objects –Skybox, sun, moon, stars

Infinite Projection Matrix The important fact is that z and w are equal after transformation to clip space:The important fact is that z and w are equal after transformation to clip space:

Infinite Projection Matrix After perspective divide, the z coordinate should be exactly 1.0, meaning that the projected point is precisely on the far plane:After perspective divide, the z coordinate should be exactly 1.0, meaning that the projected point is precisely on the far plane:

Infinite Projection Matrix Ordinarily, z is mapped from the range [−1, 1] in NDC to [0, 1] in viewport space by multiplying by 0.5 and adding 0.5Ordinarily, z is mapped from the range [−1, 1] in NDC to [0, 1] in viewport space by multiplying by 0.5 and adding 0.5 This operation can result in a loss of precision in the lowest bitsThis operation can result in a loss of precision in the lowest bits Result is a depth slightly smaller than 1.0 or slightly bigger than 1.0Result is a depth slightly smaller than 1.0 or slightly bigger than 1.0

Infinite Projection Matrix If the viewport-space z coordinate is slightly bigger than 1.0, then fragment culling occursIf the viewport-space z coordinate is slightly bigger than 1.0, then fragment culling occurs The hardware thinks the fragments are beyond the far planeThe hardware thinks the fragments are beyond the far plane Can be corrected by enabling GL_DEPTH_CLAMP_NV, but this is a vendor-specific solutionCan be corrected by enabling GL_DEPTH_CLAMP_NV, but this is a vendor-specific solution

Infinite Projection Matrix Universal solution is to modify projection matrix so that viewport-space z is always slightly less than 1.0 for points on the far plane:Universal solution is to modify projection matrix so that viewport-space z is always slightly less than 1.0 for points on the far plane:

Infinite Projection Matrix This matrix still maps the near plane to −1, but the infinite far plane is now mapped to 1 − This matrix still maps the near plane to −1, but the infinite far plane is now mapped to 1 − 

Infinite Projection Matrix Because we’re calculating  − 1 and  − 2, we need to chooseBecause we’re calculating  − 1 and  − 2, we need to choose so that 32-bit floating-point precision limits aren’t exceeded

Texture Atlas Find patches on the 3D model Place these (map them) on the texture map image. Space them apart to avoid neighboring influences.

Texture Atlas Add the color image (or bump, …) to the texture map. Each polygon, thus has two sets of coordinates: –x,y,z world –u,v texture

Example 2

Sprites and Billboards Sprites – usually refer to 2D animated characters that move across the screen. –Like Pacman Three types (or styles) of billboards –Screen-aligned (parallel to top of screen) –World aligned (allows for head-tilt) –Axial-aligned (not parallel to the screen)

Creating Billboards in OpenGL Annotated polygons do not exist with OpenGL 1.3 directly. If you specify the billboards for one viewing direction, they will not work when rotated.

Example

Example 2 The alpha test is required to remove the background. More on this example when we look at depth textures.

Re-orienting Billboards need to be re-oriented as the camera moves. This requires immediate mode (or a vertex shader program). Can either: –Recalculate all of the geometry. –Change the transformation matrices.

Re-calculating the Geometry Need a projected point (say the lower-left), the projected up-direction, and the projected scale of the billboard. Difficulties arise if we are looking directly at the ground plane.

Undo the Camera Rotations Extract the projection and model view matrices. Determine the pure rotation component of the combined matrix. Take the inverse. Multiply it by the current model-view matrix to undo the rotations.

Screen-aligned Billboards Alternatively, we can think of this as two rotations. First rotate around the up-vector to get the normal of the billboard to point towards the eye. Then rotate about a vector perpendicular to the new normal orientation and the new up-vector to align the top of the sprite with the edge of the screen. This gives a more spherical orientation. –Useful for placing text on the screen.

World Aligned Billboards Allow for a final rotation about the eye- space z-axis to orient the billboard towards some world direction. Allows for a head tilt.

Example Lastra

Example Lastra

Axial-Aligned Billboards The up-vector is constrained in world- space. Rotation about the up vector to point normal towards the eye as much as possible. Assuming a ground plane, and always perpendicular to that. Typically used for trees.