computer graphics project on custom ray tracing engine interlight3d by mehshan mustafa (04-0029)...
TRANSCRIPT
COMPUTER GRAPHICS PROJECT ON CUSTOM RAY TRACING ENGINE
InterLight3D
byMehshan 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
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.
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.
BaryCentric Coordinate Calculation algorithm
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
The Phong Model
l = light source direction, v = view direction, n = normalIa = ambient , Id = diffuse, Is = specular, Ie = emissive,
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.
Phase 4: Global Illumination Model & App
Global Illumination Using recursive ray-tracing and light calculation Very primitive
Final Application (RUST)