Simple Ray Tracing Framework Interactive Preview Ray Trace

  • Slides: 17
Download presentation
Simple Ray Tracing Framework Interactive Preview Ray Trace Image Interactive Control Depth or Mask

Simple Ray Tracing Framework Interactive Preview Ray Trace Image Interactive Control Depth or Mask Image

Technologies • C# – Just another programming language • Win. Form: – GUI Application

Technologies • C# – Just another programming language • Win. Form: – GUI Application Development – not covered in this class • Interactive Viewing: – XNA (can be OGL or D 3 D) – To be covered in second half

The Scene • Describe by XML (text) file! • Four major components – Image

The Scene • Describe by XML (text) file! • Four major components – Image Spec (Film in a camera) – The Camera – Environment (Lighting condition) – The Objects • Geometry: spheres and polygons • Material properties

XML Scene Description • Similar to Maya’s. ma file – Extremely simpler version!! •

XML Scene Description • Similar to Maya’s. ma file – Extremely simpler version!! • Example Command File Camera: eye Camera: lookat

Source Code Structure • Two Projects: – 3 DPreviewer: Shell container – Ray. Tracer:

Source Code Structure • Two Projects: – 3 DPreviewer: Shell container – Ray. Tracer: Our source code • Parser (translate XML into data structure) • RTCore: Shading, Image representation: – Do. Not. Change: RT thrade support (later) – Need. To. Use: Shading, Utilities • RTSupport – Geometry – Ray. Support: » Ray and Intersection. Record – Scene. Resource. Support » Texture, Light, Materials – 2 libraries: • GUI, Graphics, 2 MVC Support

Representation Scene. Database Image. Spec Geometry RTCamera Intersection. Record Ray

Representation Scene. Database Image. Spec Geometry RTCamera Intersection. Record Ray

RTWindow. cs: App Container • App Window Shell • In Windows. Form

RTWindow. cs: App Container • App Window Shell • In Windows. Form

Parser. cs: XML Parser • Translates Command File into data structures • In Ray.

Parser. cs: XML Parser • Translates Command File into data structures • In Ray. Tracer: Parser/Command. File. Parser. cs

RTCore: Folder • Do. Not. Change Folder: – No need to even examine the

RTCore: Folder • Do. Not. Change Folder: – No need to even examine the source – Thread support (to cover later in the quarter) • Need. To. Use Folder – Need to understand the code – No need to change • Three files: Compute, Image. Frame. Support, and Init – Essential to understand – Necessary for 3 D Viewing and Camera implementation

Geometry and Ray. Support • Geometry – geometries in the scene – For now

Geometry and Ray. Support • Geometry – geometries in the scene – For now only: Rectangles and Spheres – No need to worry until much later • Ray – Ray: Origin + Direction • Ray constructor: TAKES 2 positions!! – Intersection. Record

Transformation • The <xform> tag • The implementaiton in – RTGeometry_Parse. XForm. cs –

Transformation • The <xform> tag • The implementaiton in – RTGeometry_Parse. XForm. cs – Rectangle: : Parsing at the end:

Geometry and Ray. Support Ray Sphere WATCH OUT!! Ray direction is assumed to be

Geometry and Ray. Support Ray Sphere WATCH OUT!! Ray direction is assumed to be normalized!! Rectangle Intersection. Record

RTCamera: m. Eye m. At

RTCamera: m. Eye m. At

Image. Spec: Resolution Must Compute Each Pixel Location!!

Image. Spec: Resolution Must Compute Each Pixel Location!!

Scene. Data. Base • Contains all the scene resources – Geometries, Textures, Materials, Lights

Scene. Data. Base • Contains all the scene resources – Geometries, Textures, Materials, Lights • Simple index tables for each resource

Calling Sequence • Parsing: – When done creates RTCore(): RTCore. cs [constructor] – Calls

Calling Sequence • Parsing: – When done creates RTCore(): RTCore. cs [constructor] – Calls RTCore. First. Time. Init() [RTCore_Init. cs] • You don’t care: – RTWindow: : Begin. RT() /* from Begin. RT Button • Create and Init: image, mask, depth buffers – RTCore: : Begin. RTThread • In RTCore/Do. Not. Change/RTCore_Thread. cs • one/more separate thread(s) call to • You care again: – RTCore: : Compute. Image • In RTCore/RTCore_Compute. cs • Loop through all pixels, for each pixel • Compute visibility, coverage, depth

Important Functions • RTCore: : Compute. Visibility() – In RTCore/RTCore_Visibility. cs – Use -1

Important Functions • RTCore: : Compute. Visibility() – In RTCore/RTCore_Visibility. cs – Use -1 for except. Geom. Index for now • RTCore: : Compute. Shading() – In RTCore/RTCore_Shade. cs – Use 0 for generation for now