SlideShare a Scribd company logo
1 of 6
Download to read offline
3/4/2019
1
SBE 306B: Computer Systems III
Computer Graphics
Ray Casting
Dr. Ayman Eldeib
Systems & Biomedical
Engineering Department
Spring 2019
Computer Graphics Ray Casting
Traditional Pinhole Camera
 The most common model is pinhole camera
The film sits behind the pinhole of the camera.
 Rays come in from the outside, pass through the pinhole, and hit the film
plane.
PinholeFilm Plane
Photograph
is upside
down
3/4/2019
2
Computer Graphics Ray Casting
Virtual Camera
 The film sits in front of the pinhole of the camera.
 Rays come in from the outside, pass through the film plane, and hit the
pinhole.
Pinhole Film Plane
Photograph
is right side
up
Computer Graphics Ray Casting
Virtual Camera
Pinhole Film Plane
Photograph
is right side
up
Camera Parameters
 Orientation
(View and Up Direction)
 Eye position
 Film Plane
(“Look at” point & View plane normal)
 Aperture
(Field of view)
3/4/2019
3
Computer Graphics Ray Casting
Ray Casting
Rays
through
view plane
View plane
Eye position
 We invert the process of image generation by sending rays out from
the pinhole, and then we find the first intersection of the ray with the
scene
 The color of each pixel on the view plane depends on the radiance
emanating from visible surfaces
 For each sample
 Construct ray from eye
position through view plane
 Find first surface intersected
by ray through pixel
 Compute color sample based
on surface radiance
Computer Graphics Ray Casting
It traces rays of light from the eye (or camera) back through the image plane
(each pixel) into the scene. Then the rays are tested against all objects in the
scene to determine if they intersect any objects. If the ray misses all objects, then
that pixel is shaded the background color. Ray tracing handles shadows, multiple
reflections, and texture mapping in a very easy straight-forward manner.
 For every pixel
 Construct ray from eye position
through view plane
 For every object in the scene
o Find intersection with the
ray
o Keep if closest
o Shade/reflection/refraction
depending on light (L) and
normal vector (N)
N
L
Cont.
Ray Casting
3/4/2019
4
Computer Graphics Ray Casting
 Ray Tracing is so time-consuming because of the intersection
calculations.
 Since each ray must be checked against all objects, for a
naive ray tracer (with no speedup techniques) the time is
proportional to the number of rays X the number of objects in
the scene.
 Each intersection requires from a few (5-7) to many (15-20)
floating point (fp) operations.
 Thus for a scene with 100 objects and computed with a
spatial resolution of 512 x 512, assuming 10 fp operations
per object test there are about 250,000 X 100 X10 =
250,000,000 fps.
 This is just for the primary rays (from the eye through the
image plane) with no anti-aliasing. Clearly there are
computational problems with this
Cont.
Ray Casting
Computer Graphics Ray Casting
 There are several approaches to speeding up computations:
 Use faster machines
 Use specialized hardware, especially parallel processors
 Speed up computations by using more efficient algorithms
 Reduce the number of ray - object computations
Cont.
Ray Casting
3/4/2019
5
Computer Graphics Ray Casting
OpenGL Double Buffering
 Double buffer is a technique for tricking the
eye into seeing smooth animation of
rendered scenes.
 The color buffer is usually divided into two
equal halves, called the front buffer and the
back buffer.
 The front buffer is displayed while the
application renders into the back buffer.
 When the application completes rendering
to the back buffer, it requests the graphics
display hardware to swap the roles of the
buffers, causing the back buffer to now be
displayed, and the previous front buffer to
become the new back buffer.
Computer Graphics Ray Casting
 Request a double buffered color buffer
 glutInitDisplayMode( GLUT_RGB |
GLUT_DOUBLE );
 Clear color buffer
 glClear( GL_COLOR_BUFFER_BIT );
 Render scene
 Request swap of front and back buffers
 glutSwapBuffers();
 Repeat steps 2 - 4 for animation: add in a
timed delay to make our rendering consistent.
 glutTimerFunc(30, Timer, 0);
Animation Using Double Buffering
Cont.
OpenGL Double Buffering
3/4/2019
6
Computer Graphics Ray Casting
OpenGL Depth Buffering
 Depth buffering is a technique to
determine which primitives in
your scene are occluded by
other primitives.
 As each pixel in a primitive is
rasterized, its distance from the
eye point (depth value), is
compared with the values stored
in the depth buffer.
 If the pixel’s depth value is less
than the stored value, the pixel’s
depth value is written to the
depth buffer, and its color is
written to the color buffer
Computer Graphics Ray Casting
 Request a depth buffer
 glutInitDisplayMode(
GLUT_RGB | GLUT_DOUBLE
| GLUT_DEPTH );
 Enable depth buffering
 glEnable( GL_DEPTH_TEST );
 Clear color and depth buffers
 glClear(
GL_COLOR_BUFFER_BIT |
GL_DEPTH_BUFFER_BIT );
 Render scene
 Swap color buffers
Cont.
OpenGL Depth Buffering

More Related Content

What's hot

Advanced Image Processing: Project 1
Advanced Image Processing: Project 1Advanced Image Processing: Project 1
Advanced Image Processing: Project 1JosephChang
 
Visible Surface Detection
Visible Surface DetectionVisible Surface Detection
Visible Surface DetectionAmitBiswas99
 
Scanline rendering
Scanline renderingScanline rendering
Scanline renderingVisCircle
 
Visible surface detection methods
Visible surface detection methodsVisible surface detection methods
Visible surface detection methodsKABILESH RAMAR
 
Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizationspjcozzi
 
Semantic Mapping of Road Scenes
Semantic Mapping of Road ScenesSemantic Mapping of Road Scenes
Semantic Mapping of Road ScenesSunando Sengupta
 
Automatic Dense Semantic Mapping From Visual Street-level Imagery
Automatic Dense Semantic Mapping From Visual Street-level ImageryAutomatic Dense Semantic Mapping From Visual Street-level Imagery
Automatic Dense Semantic Mapping From Visual Street-level ImagerySunando Sengupta
 
rural marketing ppt
rural marketing pptrural marketing ppt
rural marketing pptelaya1984
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphicanku2266
 
CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9fungfung Chen
 
Stereoscopy for Non-Planar Projections (TRUE 3D 2009)
Stereoscopy for Non-Planar Projections (TRUE 3D 2009)Stereoscopy for Non-Planar Projections (TRUE 3D 2009)
Stereoscopy for Non-Planar Projections (TRUE 3D 2009)Matthias Trapp
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithmKKARUNKARTHIK
 
Computer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methodsComputer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methodsJoseph Charles
 
190410 sc fegan-face_editing_generative_adversarial_network_with_users_sketch...
190410 sc fegan-face_editing_generative_adversarial_network_with_users_sketch...190410 sc fegan-face_editing_generative_adversarial_network_with_users_sketch...
190410 sc fegan-face_editing_generative_adversarial_network_with_users_sketch...亮宏 藤井
 
Raster scan displays ppt
Raster scan displays pptRaster scan displays ppt
Raster scan displays pptABHISHEK KUMAR
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determinationPatel Punit
 

What's hot (20)

Advanced Image Processing: Project 1
Advanced Image Processing: Project 1Advanced Image Processing: Project 1
Advanced Image Processing: Project 1
 
Graphics a buffer
Graphics a bufferGraphics a buffer
Graphics a buffer
 
Visible Surface Detection
Visible Surface DetectionVisible Surface Detection
Visible Surface Detection
 
Scanline rendering
Scanline renderingScanline rendering
Scanline rendering
 
Visible surface detection methods
Visible surface detection methodsVisible surface detection methods
Visible surface detection methods
 
Z Buffer Optimizations
Z Buffer OptimizationsZ Buffer Optimizations
Z Buffer Optimizations
 
Semantic Mapping of Road Scenes
Semantic Mapping of Road ScenesSemantic Mapping of Road Scenes
Semantic Mapping of Road Scenes
 
Automatic Dense Semantic Mapping From Visual Street-level Imagery
Automatic Dense Semantic Mapping From Visual Street-level ImageryAutomatic Dense Semantic Mapping From Visual Street-level Imagery
Automatic Dense Semantic Mapping From Visual Street-level Imagery
 
rural marketing ppt
rural marketing pptrural marketing ppt
rural marketing ppt
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
 
VA3DR Poster
VA3DR PosterVA3DR Poster
VA3DR Poster
 
VA3DR Poster
VA3DR PosterVA3DR Poster
VA3DR Poster
 
CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9
 
visible surface detection
visible surface detectionvisible surface detection
visible surface detection
 
Stereoscopy for Non-Planar Projections (TRUE 3D 2009)
Stereoscopy for Non-Planar Projections (TRUE 3D 2009)Stereoscopy for Non-Planar Projections (TRUE 3D 2009)
Stereoscopy for Non-Planar Projections (TRUE 3D 2009)
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithm
 
Computer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methodsComputer Graphics: Visible surface detection methods
Computer Graphics: Visible surface detection methods
 
190410 sc fegan-face_editing_generative_adversarial_network_with_users_sketch...
190410 sc fegan-face_editing_generative_adversarial_network_with_users_sketch...190410 sc fegan-face_editing_generative_adversarial_network_with_users_sketch...
190410 sc fegan-face_editing_generative_adversarial_network_with_users_sketch...
 
Raster scan displays ppt
Raster scan displays pptRaster scan displays ppt
Raster scan displays ppt
 
Visible surface determination
Visible  surface determinationVisible  surface determination
Visible surface determination
 

Similar to 5 ray casting computer graphics

Class[4][19th jun] [three js-camera&light]
Class[4][19th jun] [three js-camera&light]Class[4][19th jun] [three js-camera&light]
Class[4][19th jun] [three js-camera&light]Saajid Akram
 
Deferred Pixel Shading on the PLAYSTATION®3
Deferred Pixel Shading on the PLAYSTATION®3Deferred Pixel Shading on the PLAYSTATION®3
Deferred Pixel Shading on the PLAYSTATION®3Slide_N
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics NotesGurpreet singh
 
FGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie TycoonFGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie Tycoonmochimedia
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine OverviewSharad Mitra
 
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdfPapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdfAdam Hill
 
Computer Graphics Part1
Computer Graphics Part1Computer Graphics Part1
Computer Graphics Part1qpqpqp
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesDouglas Lanman
 
A Novel Background Subtraction Algorithm for Dynamic Texture Scenes
A Novel Background Subtraction Algorithm for Dynamic Texture ScenesA Novel Background Subtraction Algorithm for Dynamic Texture Scenes
A Novel Background Subtraction Algorithm for Dynamic Texture ScenesIJMER
 
Design and implementation of video tracking system based on camera field of view
Design and implementation of video tracking system based on camera field of viewDesign and implementation of video tracking system based on camera field of view
Design and implementation of video tracking system based on camera field of viewsipij
 
Photometric calibration
Photometric calibrationPhotometric calibration
Photometric calibrationAli A Jalil
 
更適應性的AOI-深度強化學習之應用
更適應性的AOI-深度強化學習之應用更適應性的AOI-深度強化學習之應用
更適應性的AOI-深度強化學習之應用CHENHuiMei
 
Rendering Algorithms.pptx
Rendering Algorithms.pptxRendering Algorithms.pptx
Rendering Algorithms.pptxSherinRappai
 
Stereo Correspondence Algorithms for Robotic Applications Under Ideal And Non...
Stereo Correspondence Algorithms for Robotic Applications Under Ideal And Non...Stereo Correspondence Algorithms for Robotic Applications Under Ideal And Non...
Stereo Correspondence Algorithms for Robotic Applications Under Ideal And Non...CSCJournals
 

Similar to 5 ray casting computer graphics (20)

Class[4][19th jun] [three js-camera&light]
Class[4][19th jun] [three js-camera&light]Class[4][19th jun] [three js-camera&light]
Class[4][19th jun] [three js-camera&light]
 
Deferred Pixel Shading on the PLAYSTATION®3
Deferred Pixel Shading on the PLAYSTATION®3Deferred Pixel Shading on the PLAYSTATION®3
Deferred Pixel Shading on the PLAYSTATION®3
 
Computer Graphics Notes
Computer Graphics NotesComputer Graphics Notes
Computer Graphics Notes
 
FGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie TycoonFGS 2011: Making A Game With Molehill: Zombie Tycoon
FGS 2011: Making A Game With Molehill: Zombie Tycoon
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine Overview
 
Lecture1
Lecture1Lecture1
Lecture1
 
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdfPapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
PapersWeLove - Rendering Synthetic Objects Into Real Scenes - Paul Debevec.pdf
 
Computer Graphics Part1
Computer Graphics Part1Computer Graphics Part1
Computer Graphics Part1
 
ei2106-submit-opt-415
ei2106-submit-opt-415ei2106-submit-opt-415
ei2106-submit-opt-415
 
CG.pptx
CG.pptxCG.pptx
CG.pptx
 
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-PlanesBuild Your Own 3D Scanner: 3D Scanning with Swept-Planes
Build Your Own 3D Scanner: 3D Scanning with Swept-Planes
 
A Novel Background Subtraction Algorithm for Dynamic Texture Scenes
A Novel Background Subtraction Algorithm for Dynamic Texture ScenesA Novel Background Subtraction Algorithm for Dynamic Texture Scenes
A Novel Background Subtraction Algorithm for Dynamic Texture Scenes
 
N046047780
N046047780N046047780
N046047780
 
Design and implementation of video tracking system based on camera field of view
Design and implementation of video tracking system based on camera field of viewDesign and implementation of video tracking system based on camera field of view
Design and implementation of video tracking system based on camera field of view
 
Photometric calibration
Photometric calibrationPhotometric calibration
Photometric calibration
 
3D Workshop
3D Workshop3D Workshop
3D Workshop
 
更適應性的AOI-深度強化學習之應用
更適應性的AOI-深度強化學習之應用更適應性的AOI-深度強化學習之應用
更適應性的AOI-深度強化學習之應用
 
Broadcaster Notes
Broadcaster NotesBroadcaster Notes
Broadcaster Notes
 
Rendering Algorithms.pptx
Rendering Algorithms.pptxRendering Algorithms.pptx
Rendering Algorithms.pptx
 
Stereo Correspondence Algorithms for Robotic Applications Under Ideal And Non...
Stereo Correspondence Algorithms for Robotic Applications Under Ideal And Non...Stereo Correspondence Algorithms for Robotic Applications Under Ideal And Non...
Stereo Correspondence Algorithms for Robotic Applications Under Ideal And Non...
 

More from cairo university

Tocci chapter 13 applications of programmable logic devices extended
Tocci chapter 13 applications of programmable logic devices extendedTocci chapter 13 applications of programmable logic devices extended
Tocci chapter 13 applications of programmable logic devices extendedcairo university
 
Tocci chapter 12 memory devices
Tocci chapter 12 memory devicesTocci chapter 12 memory devices
Tocci chapter 12 memory devicescairo university
 
Tocci ch 9 msi logic circuits
Tocci ch 9 msi logic circuitsTocci ch 9 msi logic circuits
Tocci ch 9 msi logic circuitscairo university
 
Tocci ch 7 counters and registers modified x
Tocci ch 7 counters and registers modified xTocci ch 7 counters and registers modified x
Tocci ch 7 counters and registers modified xcairo university
 
Tocci ch 6 digital arithmetic operations and circuits
Tocci ch 6 digital arithmetic operations and circuitsTocci ch 6 digital arithmetic operations and circuits
Tocci ch 6 digital arithmetic operations and circuitscairo university
 
Tocci ch 3 5 boolean algebra, logic gates, combinational circuits, f fs, - re...
Tocci ch 3 5 boolean algebra, logic gates, combinational circuits, f fs, - re...Tocci ch 3 5 boolean algebra, logic gates, combinational circuits, f fs, - re...
Tocci ch 3 5 boolean algebra, logic gates, combinational circuits, f fs, - re...cairo university
 
A15 sedra ch 15 memory circuits
A15  sedra ch 15 memory circuitsA15  sedra ch 15 memory circuits
A15 sedra ch 15 memory circuitscairo university
 
A14 sedra ch 14 advanced mos and bipolar logic circuits
A14  sedra ch 14 advanced mos and bipolar logic circuitsA14  sedra ch 14 advanced mos and bipolar logic circuits
A14 sedra ch 14 advanced mos and bipolar logic circuitscairo university
 
A13 sedra ch 13 cmos digital logic circuits
A13  sedra ch 13 cmos digital logic circuitsA13  sedra ch 13 cmos digital logic circuits
A13 sedra ch 13 cmos digital logic circuitscairo university
 
A09 sedra ch 9 frequency response
A09  sedra ch 9 frequency responseA09  sedra ch 9 frequency response
A09 sedra ch 9 frequency responsecairo university
 
5 sedra ch 05 mosfet revision
5  sedra ch 05  mosfet revision5  sedra ch 05  mosfet revision
5 sedra ch 05 mosfet revisioncairo university
 
Lecture 2 (system overview of c8051 f020) rv01
Lecture 2 (system overview of c8051 f020) rv01Lecture 2 (system overview of c8051 f020) rv01
Lecture 2 (system overview of c8051 f020) rv01cairo university
 
Lecture 1 (course overview and 8051 architecture) rv01
Lecture 1 (course overview and 8051 architecture) rv01Lecture 1 (course overview and 8051 architecture) rv01
Lecture 1 (course overview and 8051 architecture) rv01cairo university
 

More from cairo university (20)

Tocci chapter 13 applications of programmable logic devices extended
Tocci chapter 13 applications of programmable logic devices extendedTocci chapter 13 applications of programmable logic devices extended
Tocci chapter 13 applications of programmable logic devices extended
 
Tocci chapter 12 memory devices
Tocci chapter 12 memory devicesTocci chapter 12 memory devices
Tocci chapter 12 memory devices
 
Tocci ch 9 msi logic circuits
Tocci ch 9 msi logic circuitsTocci ch 9 msi logic circuits
Tocci ch 9 msi logic circuits
 
Tocci ch 7 counters and registers modified x
Tocci ch 7 counters and registers modified xTocci ch 7 counters and registers modified x
Tocci ch 7 counters and registers modified x
 
Tocci ch 6 digital arithmetic operations and circuits
Tocci ch 6 digital arithmetic operations and circuitsTocci ch 6 digital arithmetic operations and circuits
Tocci ch 6 digital arithmetic operations and circuits
 
Tocci ch 3 5 boolean algebra, logic gates, combinational circuits, f fs, - re...
Tocci ch 3 5 boolean algebra, logic gates, combinational circuits, f fs, - re...Tocci ch 3 5 boolean algebra, logic gates, combinational circuits, f fs, - re...
Tocci ch 3 5 boolean algebra, logic gates, combinational circuits, f fs, - re...
 
A15 sedra ch 15 memory circuits
A15  sedra ch 15 memory circuitsA15  sedra ch 15 memory circuits
A15 sedra ch 15 memory circuits
 
A14 sedra ch 14 advanced mos and bipolar logic circuits
A14  sedra ch 14 advanced mos and bipolar logic circuitsA14  sedra ch 14 advanced mos and bipolar logic circuits
A14 sedra ch 14 advanced mos and bipolar logic circuits
 
A13 sedra ch 13 cmos digital logic circuits
A13  sedra ch 13 cmos digital logic circuitsA13  sedra ch 13 cmos digital logic circuits
A13 sedra ch 13 cmos digital logic circuits
 
A09 sedra ch 9 frequency response
A09  sedra ch 9 frequency responseA09  sedra ch 9 frequency response
A09 sedra ch 9 frequency response
 
5 sedra ch 05 mosfet.ppsx
5  sedra ch 05  mosfet.ppsx5  sedra ch 05  mosfet.ppsx
5 sedra ch 05 mosfet.ppsx
 
5 sedra ch 05 mosfet
5  sedra ch 05  mosfet5  sedra ch 05  mosfet
5 sedra ch 05 mosfet
 
5 sedra ch 05 mosfet revision
5  sedra ch 05  mosfet revision5  sedra ch 05  mosfet revision
5 sedra ch 05 mosfet revision
 
Fields Lec 2
Fields Lec 2Fields Lec 2
Fields Lec 2
 
Fields Lec 1
Fields Lec 1Fields Lec 1
Fields Lec 1
 
Fields Lec 5&6
Fields Lec 5&6Fields Lec 5&6
Fields Lec 5&6
 
Fields Lec 4
Fields Lec 4Fields Lec 4
Fields Lec 4
 
Fields Lec 3
Fields Lec 3Fields Lec 3
Fields Lec 3
 
Lecture 2 (system overview of c8051 f020) rv01
Lecture 2 (system overview of c8051 f020) rv01Lecture 2 (system overview of c8051 f020) rv01
Lecture 2 (system overview of c8051 f020) rv01
 
Lecture 1 (course overview and 8051 architecture) rv01
Lecture 1 (course overview and 8051 architecture) rv01Lecture 1 (course overview and 8051 architecture) rv01
Lecture 1 (course overview and 8051 architecture) rv01
 

Recently uploaded

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2RajaP95
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacingjaychoudhary37
 

Recently uploaded (20)

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2HARMONY IN THE HUMAN BEING - Unit-II UHV-2
HARMONY IN THE HUMAN BEING - Unit-II UHV-2
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
microprocessor 8085 and its interfacing
microprocessor 8085  and its interfacingmicroprocessor 8085  and its interfacing
microprocessor 8085 and its interfacing
 

5 ray casting computer graphics

  • 1. 3/4/2019 1 SBE 306B: Computer Systems III Computer Graphics Ray Casting Dr. Ayman Eldeib Systems & Biomedical Engineering Department Spring 2019 Computer Graphics Ray Casting Traditional Pinhole Camera  The most common model is pinhole camera The film sits behind the pinhole of the camera.  Rays come in from the outside, pass through the pinhole, and hit the film plane. PinholeFilm Plane Photograph is upside down
  • 2. 3/4/2019 2 Computer Graphics Ray Casting Virtual Camera  The film sits in front of the pinhole of the camera.  Rays come in from the outside, pass through the film plane, and hit the pinhole. Pinhole Film Plane Photograph is right side up Computer Graphics Ray Casting Virtual Camera Pinhole Film Plane Photograph is right side up Camera Parameters  Orientation (View and Up Direction)  Eye position  Film Plane (“Look at” point & View plane normal)  Aperture (Field of view)
  • 3. 3/4/2019 3 Computer Graphics Ray Casting Ray Casting Rays through view plane View plane Eye position  We invert the process of image generation by sending rays out from the pinhole, and then we find the first intersection of the ray with the scene  The color of each pixel on the view plane depends on the radiance emanating from visible surfaces  For each sample  Construct ray from eye position through view plane  Find first surface intersected by ray through pixel  Compute color sample based on surface radiance Computer Graphics Ray Casting It traces rays of light from the eye (or camera) back through the image plane (each pixel) into the scene. Then the rays are tested against all objects in the scene to determine if they intersect any objects. If the ray misses all objects, then that pixel is shaded the background color. Ray tracing handles shadows, multiple reflections, and texture mapping in a very easy straight-forward manner.  For every pixel  Construct ray from eye position through view plane  For every object in the scene o Find intersection with the ray o Keep if closest o Shade/reflection/refraction depending on light (L) and normal vector (N) N L Cont. Ray Casting
  • 4. 3/4/2019 4 Computer Graphics Ray Casting  Ray Tracing is so time-consuming because of the intersection calculations.  Since each ray must be checked against all objects, for a naive ray tracer (with no speedup techniques) the time is proportional to the number of rays X the number of objects in the scene.  Each intersection requires from a few (5-7) to many (15-20) floating point (fp) operations.  Thus for a scene with 100 objects and computed with a spatial resolution of 512 x 512, assuming 10 fp operations per object test there are about 250,000 X 100 X10 = 250,000,000 fps.  This is just for the primary rays (from the eye through the image plane) with no anti-aliasing. Clearly there are computational problems with this Cont. Ray Casting Computer Graphics Ray Casting  There are several approaches to speeding up computations:  Use faster machines  Use specialized hardware, especially parallel processors  Speed up computations by using more efficient algorithms  Reduce the number of ray - object computations Cont. Ray Casting
  • 5. 3/4/2019 5 Computer Graphics Ray Casting OpenGL Double Buffering  Double buffer is a technique for tricking the eye into seeing smooth animation of rendered scenes.  The color buffer is usually divided into two equal halves, called the front buffer and the back buffer.  The front buffer is displayed while the application renders into the back buffer.  When the application completes rendering to the back buffer, it requests the graphics display hardware to swap the roles of the buffers, causing the back buffer to now be displayed, and the previous front buffer to become the new back buffer. Computer Graphics Ray Casting  Request a double buffered color buffer  glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE );  Clear color buffer  glClear( GL_COLOR_BUFFER_BIT );  Render scene  Request swap of front and back buffers  glutSwapBuffers();  Repeat steps 2 - 4 for animation: add in a timed delay to make our rendering consistent.  glutTimerFunc(30, Timer, 0); Animation Using Double Buffering Cont. OpenGL Double Buffering
  • 6. 3/4/2019 6 Computer Graphics Ray Casting OpenGL Depth Buffering  Depth buffering is a technique to determine which primitives in your scene are occluded by other primitives.  As each pixel in a primitive is rasterized, its distance from the eye point (depth value), is compared with the values stored in the depth buffer.  If the pixel’s depth value is less than the stored value, the pixel’s depth value is written to the depth buffer, and its color is written to the color buffer Computer Graphics Ray Casting  Request a depth buffer  glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH );  Enable depth buffering  glEnable( GL_DEPTH_TEST );  Clear color and depth buffers  glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );  Render scene  Swap color buffers Cont. OpenGL Depth Buffering