computer graphics project on custom ray tracing engine interlight3d by mehshan mustafa (04-0029)...

9
COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

Upload: eustacia-garrison

Post on 05-Jan-2016

212 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE

InterLight3D

byMehshan Mustafa (04-0029)

Muhammad Zaki Shaheen (04-0122)

Page 2: COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

The breakdown

Motivation Custom rendering/ray tracing pipeline implementation

and researching techniques used in ray-tracing.

Breakdown Phase 0: Proposal, Initial Setup, Pipeline Design &

Utilities Phase 1: Basic Ray Tracing Setup Phase 2: Local Illumination Model Phase 3: Shadows Phase 4: Global Illumination Model and RUST

Page 3: COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

Phase 0:Initial Setup and Utilities programming

Development environment C++/Win32/MFC/STL/OpenGL using Visual Studio .NET

2k5/2k3Utility Classes

Vector3D, Point3D, Color4, Face3D, Object3D, Mesh Material (diffuse, emissive, reflective, specular, specular

index) Camera (Targeted, Free, Dolly, Translate.. Etc) Matrix (Transpose, Inverse, Determinant, I, *,/,+,-) PixelBuffer, Viewport More classes and functions were added as needed. .mod File format. A Custom toned down version of .3ds

format. Utilities for format conversion. .mod includes vertex, normal and material data.

Basic Win32 Program Setup for initial testing of the interlight3d library.

Page 4: COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

Phase 1: Basic Ray Tracing Setup and Camera

Rays casted from eye-position through each pixel of the viewport. Ray {Point3D start; Vector 3D direction;} HitResult{&object, &face, hitPoint, hitDistance, hitNormal, hitMaterial} RayTracer::BuildInitialRay(row, col, &ray) RayTracer::RayTrace(rayHitCount, &ray, &color)

Ray intersection using Barycentric Coordinates with each object and accumulating HitResultList (std::list<HitResult>). 3D Computer Graphics : A mathematical introduction with openGL by

Samuel R. Buss Computer Graphics using OpenGL: F. S. Hill, Jr.

Later on added recursive reflective ray-tracing RayTracer::BuildReflectedRay(&reflectedRay,&incidentRay,&hitresult)

After each ray tracing, pick up the nearest object to the eye position and recursive ray tracing for a set level of depth. Depth decrements on each hit. Color the pixel according to the light calculation at the specific hit point. If ray doesn’t hit anything, pixel color = background color. Our model does not support transparent objects.

Page 5: COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

BaryCentric Coordinate Calculation algorithm

Page 6: COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

Phase 2: Local Illumination Model (Phong)

Light {position, ambient, diffuse, specular}RayContext {material&, ray&, hitNormal,

hitPoint, lights, xforms}LightingModel

ComputeAmbient(LightList& lights): cumulative ambience of all the lights involved

CalculateLight(RayContext& context): Phong calculations overridden in PhongLightingModel

BasicLightingModel : LightingModelPhongLightingModel: LightingModel

Page 7: COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

The Phong Model

l = light source direction, v = view direction, n = normalIa = ambient , Id = diffuse, Is = specular, Ie = emissive,

Page 8: COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

Phase 3: Shadows

RayTracer::Shade(ray&, hitresult&)Shadow Feelers

Stategy: At each ray-object intersection point, cast a ray to each light. If the light is reachable by this ray, calculate lighting on the particular RayContext instance otherwise exclude the light from the RayContext instance.

Page 9: COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE InterLight3D by Mehshan Mustafa (04-0029) Muhammad Zaki Shaheen (04-0122)

Phase 4: Global Illumination Model & App

Global Illumination Using recursive ray-tracing and light calculation Very primitive

Final Application (RUST)