CSE3AGT – Zones Portals and Anti-Portals, Fog and Ray Tracing Paul Taylor 2010.

Slides:



Advertisements
Similar presentations
8.1si31_2001 SI31 Advanced Computer Graphics AGR Lecture 8 Polygon Rendering.
Advertisements

Lecture 8 Transparency, Mirroring
Ray tracing. New Concepts The recursive ray tracing algorithm Generating eye rays Non Real-time rendering.
Graphics Pipeline.
Computer graphics & visualization Global Illumination Effects.
Lecture 14 Illumination II – Global Models
Week 10 - Monday.  What did we talk about last time?  Global illumination  Shadows  Projection shadows  Soft shadows.
3D Graphics Rendering and Terrain Modeling
CLASS 9 ADVANCE RENDERING RAY TRACING RADIOSITY LIGHT FIELD CS770/870.
Two Methods for Fast Ray-Cast Ambient Occlusion Samuli Laine and Tero Karras NVIDIA Research.
CAP4730: Computational Structures in Computer Graphics Visible Surface Determination.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Computer Graphics Visible Surface Determination. Goal of Visible Surface Determination To draw only the surfaces (triangles) that are visible, given a.
Part I: Basics of Computer Graphics
Illumination Models Radiosity Chapter 14 Section 14.7 Some of the material in these slides may have been adapted from University of Virginia, MIT, Colby.
Ray Tracing & Radiosity Dr. Amy H. Zhang. Outline  Ray tracing  Radiosity.
CS 4731: Computer Graphics Lecture 18: Hidden Surface Removal Emmanuel Agu.
Final Gathering on GPU Toshiya Hachisuka University of Tokyo Introduction Producing global illumination image without any noise.
Global Illumination May 7, Global Effects translucent surface shadow multiple reflection.
7M836 Animation & Rendering
Introduction to 3D Graphics John E. Laird. Basic Issues u Given a internal model of a 3D world, with textures and light sources how do you project it.
Hidden Surface Removal
Lecture 5: 3D Rendering Pipeline (II) Prof. Hsien-Hsin Sean Lee School of Electrical and Computer Engineering Georgia Institute of Technology.
Polygon Shading. Assigning color to a shape to make graphical scenes look realistic, or artistic, or whatever effect we’re attempting to achieve But first.
CS 450: Computer Graphics REVIEW: OVERVIEW OF POLYGONS
Pipelines are for Whimps Raycasting, Raytracing, and Hardcore Rendering.
COMP 175: Computer Graphics March 24, 2015
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Programmable Pipelines. Objectives Introduce programmable pipelines ­Vertex shaders ­Fragment shaders Introduce shading languages ­Needed to describe.
Computer Graphics World, View and Projection Matrices CO2409 Computer Graphics Week 8.
COMP 261 Lecture 16 3D Rendering. input: set of polygons viewing direction direction of light source(s) size of window. output: an image Actions rotate.
Buffers Textures and more Rendering Paul Taylor & Barry La Trobe University 2009.
-Global Illumination Techniques
CS 376 Introduction to Computer Graphics 04 / 16 / 2007 Instructor: Michael Eckmann.
CS447/ Realistic Rendering -- Radiosity Methods-- Introduction to 2D and 3D Computer Graphics.
CSC 461: Lecture 3 1 CSC461 Lecture 3: Models and Architectures  Objectives –Learn the basic design of a graphics system –Introduce pipeline architecture.
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.
Rendering Overview CSE 3541 Matt Boggus. Rendering Algorithmically generating a 2D image from 3D models Raster graphics.
Week 10 - Wednesday.  What did we talk about last time?  Shadow volumes and shadow mapping  Ambient occlusion.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 10/24/ :01 UML Graphics II Shadows Session 4.
Advanced Computer Graphics Advanced Shaders CO2409 Computer Graphics Week 16.
CSE 381 – Advanced Game Programming GLSL Lighting.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Graphics Lecture 13: Slide 1 Interactive Computer Graphics Lecture 13: Radiosity - Principles.
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
Advanced Computer Graphics Shadow Techniques CO2409 Computer Graphics Week 20.
04/30/02(c) 2002 University of Wisconsin Last Time Subdivision techniques for modeling We are now all done with modeling, the standard hardware pipeline.
Image Synthesis Rabie A. Ramadan, PhD 4. 2 Review Questions Q1: What are the two principal tasks required to create an image of a three-dimensional scene?
CS 325 Introduction to Computer Graphics 03 / 29 / 2010 Instructor: Michael Eckmann.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 Surface Rendering Methods 고려대학교 컴퓨터 그래픽스 연구실.
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)
Global Illumination. Local Illumination  the GPU pipeline is designed for local illumination  only the surface data at the visible point is needed to.
11/5/2002 (c) University of Wisconsin, CS 559 Last Time Local Shading –Diffuse term –Specular term –All together –OpenGL brief overview.
Local Illumination and Shading
COMPUTER GRAPHICS CS 482 – FALL 2015 SEPTEMBER 29, 2015 RENDERING RASTERIZATION RAY CASTING PROGRAMMABLE SHADERS.
CS 445 / 645 Introduction to Computer Graphics Lecture 16 Radiosity Radiosity.
RENDERING : Global Illumination
Global Illumination (3) Path Tracing. Overview Light Transport Notation Path Tracing Photon Mapping.
09/23/03CS679 - Fall Copyright Univ. of Wisconsin Last Time Reflections Shadows Part 1 Stage 1 is in.
CS 325 Introduction to Computer Graphics 04 / 07 / 2010 Instructor: Michael Eckmann.
Chapter 1 Graphics Systems and Models Models and Architectures.
Computer Graphics Ken-Yi Lee National Taiwan University (the slides are adapted from Bing-Yi Chen and Yung-Yu Chuang)
CS552: Computer Graphics Lecture 36: Ray Tracing.
- Introduction - Graphics Pipeline
3D Graphics Rendering PPT By Ricardo Veguilla.
The Graphics Rendering Pipeline
CS451Real-time Rendering Pipeline
Mike Merchant Nicholas Hilbert
Jim X. Chen George Mason University
Presentation transcript:

CSE3AGT – Zones Portals and Anti-Portals, Fog and Ray Tracing Paul Taylor 2010

Zones, Portals and Anti-Portals With Pictures!

Zones Air-tight areas of your level that constitute different areas. ng.htm

Portals These are the windows between your Zones You can either think of zones as airtight areas, or pretend to fill them with water

A more effective Zone / Portal combination

Occlusion Planes A newer advance in pre-rendering occlusion – This was one of the key technologies that enabled large open-world games to be created A plane which is inserted into any object which is large enough to be a ‘good’ occluder

The Bigger the Better!

Remember what occluders do

Get Creative! Don’t forget your ceilings and floors! You should keep your visible occluders down to only like 3 or 4

Fog is your friend!

Bonuses Much shorter Z-Depth Required before culling Heavy Fog can be used in situations of high complexity Even on a ‘Sunny Clear Day’ with huge draw- distances, fog can be used to stop pop-in

Negatives More code in your shaders Easily offset by the savings in polygons Some extra possible issues with artefacts Fatter Vertices

How? Two Main Methods: Vertex Based Fog - Cheaper Table Based Fog (Pixel Fog) - Expensive Important Attributes Distance (range / plane) Drop Off (Very similar to lighting!) Z or W based

Vertex Fog Functions in a similar way to Per Vertex Colours, or Per Vertex Lighting Fog values are interpolated across polygons based on Vertex Values All the usual per-vertex problems apply here too!

Plane Based Fog

Range Ranged based fog has a start and an end – Vertices before the FogStart are unfogged, Vertices after FogEnd are Completely obscured – A function is used to interpolate from FogStart to FogEnd Simplest: Linear Interpolation More complex: Eg: Exponential, quadratic, etc.

Range Based Fog

Linear Fog

Exponential Fog (2 types) D = distance from viewpoint Density = Variable from 0.0 to 1.0 The second equation has a steeper gradient through the middle section us/library/bb173401%28VS.85%29.aspx

Exponential Fog Curves Linear Fog

Vertex Based Fog Limitations

Polygon based Fog & Non Z Objects Fail!

A Tessellation Solution

Z-Fog The most basic Pixel Fog is Z-Fog (Depth-Fog) Things that can go wrong: Tilting on the Y axis results in:

Why does it happen? Side View of the previous slide

How can we solve it? We could Fix the rotation on the Y axis  Or we could calculate the true distance from eye to each pixel. It just so happens that we can get this value for free (Processing wise, we will need an extra float per vertex)

W-Fog (The DX9 Way) What is W? How do we make sure W exists? Both these matrices will work perfectly as an XYZ projection matrix. Below will create a W = Z * S. not exactly helpful. Above will Incorrect Projection Matrix for Accurate W Based Fog Correct Projection Matrix for Accurate W based Fog

W-Fog the DX10 Way W Fog is easy, we already use world coordinates for vertices in our lighting, so we can just add a float to pass the eye-vertex distance to the pixel shader

Newest Fog Technologies Technical Innovations to reduce your visibility! If you want to be ‘at the front’ you need to be looking for papers from Google Scholar! – Take each idea you like, figure out how it’s done, then figure out what you could do better! The following is from the latest build of the UDK

Exponential Height Fog New kind of global fog with density that decreases with height Never creates a hard line (unlike standard fog); supports one layer Can specify both "towards the light" and "away from the light" colours Rendering cost similar to two layers of constant density height fog Can now use different colours for the hemisphere facing the light and vice versa

Constant Density Height Fog

Exponential Height Fog ontentBlog/1ExpResized.jpg

Pipelines are for Chumps Raycasting and Raytracing

Ray Casting Definition Time There are two definitions of Ray Casting The Old and the New The old was related to 3D games back in the Wolfenstein / Doom 1 Era. Where gameplay was on a 2D platform The New definition is: – Non Recursive Ray Tracing

Ray Tracing Glass Ball

Rays from the Sun or from the Screen Rays could be programmed to work in either direction We choose from the screen to the Light – Only X x Y Pixels to trace From the Light we would need to emulate Millions of Rays to find the few thousand that reach the screen

Our Rays

Center of Projection (0,0)

Viewport (0,0) Screen Clipping Planes

Into World Coordinates (0,0) Screen Clipping Planes

Getting Each Initial Ray Origin = (0,0,0) Direction = ScreenX,screenY, zMin – ScreenX, ScreenY are the float locations of each pixel in projected world coordinates – zMin is the plane on which the screen exists

Surface Materials Surfaces must have their Material Properties set – Diffuse, Reflective, Emissive, and Colour need to be considered

For Each Pixel (the main Raytrace loop) For each pixel { Construct ray from camera through pixel Find first primitive hit by ray Determine colour at intersection point Draw colour to pixel Buffer }

Intersections The simplest way is to loop through all your primitives (All Polygons) – If the Polygon Normal DOT RayDirection(Cos Theta) < 0 // Face is opposite to Ray Ignore – Now we can Intersect the Ray with the Polygon – Or Intersect the Ray with the Polygons Plane

Ray / Polygon Intersection p0, p1 and p2 are verts of the triangle point(u,v) = (1-u-v)*p0 + u*p1 + v*p2 U > 0 V > 0 U + V <= 1.0

Line Representation point(t) = p + t * d t is any point on the line p is a known point on the line D is the direction vector Combined: p + t * d = (1-u-v) * p0 + u * p1 + v * p2 A Point on the line (p + t * d) which Is part of the triangle [(1-u-v) * p0 + u * p1 + v * p2]

Intersections Suck! etry/planeline/ etry/planeline/ c.html c.html /algorithm_0104B.htm#Line- Plane%20Intersection /algorithm_0104B.htm#Line- Plane%20Intersection or/Vplanelineint.html or/Vplanelineint.html

Intersecting a Plane A point on the Plane = p1 Plane Normal = n. Ray = p(t) = e + td P(t) = Point on Ray E = Origin D = Direction Vector t = [(P1 – e). n]/ d.n

World / Object Coordiantes We need to translate the Ray into Object Coordinates / Vice Versa to get this to work Ray = p(t) = e + td Ray = Inv (Object->World)e + t Inv (Object- >World)d

After Finding the Intersecting Plane You need a simple way to check for a hit or miss If your Object has a bounding box this can be achieved through a line check

Miss Conditions

Hit Conditions

For Other Shaped Flat Polygons An Even Number of Intersections with the Outside of the Polygon means a Miss An Odd Number of Intersections means a Hit

Task List for Ray Casting 1)Create a vector for each Pixel on the screen a)From the Origin of the Camera Matrix (0,0,0) b)That intersects with a Pixel in the screen 2)Use this Vector to create a trace through the World a)From the Zmin to the Zmax Clipping Volume b)UnProjected into World Coordinates 3)Intersect the trace with every object in the world

4)When the ray hits an Object we need to check how the pixel should be lit a)Check if the Ray has a direct view to each of the lights in the scene b)calculate the input from each light. c)Color the pixel based on the lighting and surface properties

One extra task for Ray Casting After Intersection Calculate the reflective Vector – Dot Product of Ray and Surface Normal Then cast a new Ray – This continues in a recursive fashion untill: A ray heads off into the universe A ray hits a light We reach our maximum recursion level

How we would like to be able to calculate light

Conservation of Energy A Physics-Based Approach to Lighting – Surfaces will absorb some light, and reflect some light – Any surfaces may also be light emitting – Creating a large simultaneous equation can solve the light distribution (I mean LARGE) – The light leaving a point is the sum of the light emitted + the sum of all reflected light

Don’t Scream (loudly)

The Rendering Equation Light Leaving Point X in direction  Light Emitted by Point X in direction  Integral over the Input Hemisphere Bidirectional reflective function (BDRF) in the direction  from direction  ’ Light toward Point X from direction  ’ Attenuation of inward light related to incidence angle

The Monte Carlo Method Repeated Random Sampling Deterministic Algorithms may be unfeasibly complex (light)

Metropolis Light Transport A directed approach to simplifying the BDRF Still considered a Monte Carlo Method It directs the randomness considering more samples from directions with a higher impact on the point being assessed

BDRF Tracing

Metropolis Light Transport

Radiosity Simplifying the Rendering Equation by making all surfaces perfectly diffuse reflectors This simplifies the BDRF function

Ray Tracing and the GPU

Adios Larrabee! l-abandons-discrete-graphics/ l-abandons-discrete-graphics/

DIY CUDA (An Introduction to it!) Stolen From NVIDIA_CUDA_Tutorial_No_NDA_Apr08.pdf

*GTX 260 : 192 CUDA Cores

Perhaps a better example This shows the scalability of CUDA arrays

CUDA References to get you going tutorial/ tutorial/ 8/ 8/

The main CUDA point: Compute Shaders follow the same logic You’ll need to be epic with compute shaders to be highly desirable in industry It’ll give you massive credibility in Cluster Software development – A lot of clusters are moving toward GPU horsepower High Performance Computing = – Technical Proficiency – Lots of cash – Games Related Knowledge gives you an extreme edge over other parallel programmers

DIY Farming by Bungie tions/presentations/Life_on_the_Bungie_Far m.pptx tions/presentations/Life_on_the_Bungie_Far m.pptx

References ting_Fog_Direct3D.html ting_Fog_Direct3D.html ning.htm ning.htm