辅导案例-D18

  • May 15, 2020

0F. Estrada, Aug. 2019Assignment due date: Sep. 27th 12:00 (NOON)Hand-in to be submitted at the D18 drop-box (4th floor IC),code to be submitted on the mathlab server by the above due dateThis assignment can be completed individually, or by a team of 2 studentsStudent Names (Last, First)Student #1:Student #2:Student numbersStudent #1:Student #2:Student UtorIDsStudent #1:Student #2:We hereby affirm that all the solutions we provide, both in writing and in code, for this assignment are our own. We have properly cited and noted any reference material we used to arrive at this solution, and have not shared our work with anyone else._______________________________ _____________________________ Student 1 signature Student 2 signature(note: 3 marks penalty if any of the above information is missing)CSC D18 – Fall 2019Assignment 1 – Basic Geometry and 2D Light Transport1This assignment is intended to help you master the basic geometric principles we will use forthe rest of the term to build our advanced rendering engine. To that end, you will practice2D geometry, develop an intuition of how 2D parametric lines can be used to represent lightrays, understand how we can represent simple objects and how these interact with our light rays, and use simple transformations to build a simple, but accurate renderer for lighttransport in 2D. After completing this assigment, you will have gained the ability to simulate and visualize light and its interactions with scene components!Learning Objectives – after completing this assignment you should be able to:Manage points and vectors using simple operations such as additions, dot, and cross products.Represent light rays using 2D parametric equations. Represent objects using 2D implicit andparametric forms. Apply affine transformations to points and vectors, and use them to simulate the propagationof light through a simple scene.Determine points of intersection between light rays and simple scene objects (this is the basisof ray tracing, which we will be fully developing soon).Simulate the basic behaviour of light as it interacts with object surfaces: Reflection, scattering,and refraction.Explain how simple light sources behave, and the difference between primary and secondaryillumination.Skills Developed:Thinking in terms of geometry and vectors. Manipulating simple geometric entities algebraically: rays, circles, boxes.Using 2D transformations to implement code that bounces, reflects, and refracts light raysaccording to fundamental principles of optics. Understanding and extending code that deals with images, light rays, and objects.Reference material:The Lecture notes up to this point, found on the course website.This handout (be sure to read everything carefully).The comments in the starter code. CSC D18 – Fall 2019Assignment 1 – Basic Geometry and 2D Light TransportF. Estrada, Aug. 20192Part 1 – Written work. Be sure to provide clean, legible derivations and do not omit any steps your TA may need to understand your work. Use diagrams wherever appropriate.A) 2D – Parametric forms and the geometry of light transport1) A light ray hits an object at a point with surface normal a) [3 marks] – If the object is a 2D ellipse, (centered at [cx, cy]) Develop an equation in terms of that yields the value of at the intersection point between the ray and the ellipse. You should arrange things so your solution is in the form of a 2nd degree equation, make sure to show what the value of a b, and c are. Test your derivation by finding the intersection between the ellipseand the ray given by b) [3 marks] – Provide the expressions that yield the components of the normal vector at the intersection. Test your derivation by computing the normalfor the ellipse and ray in a), and draw a graph with the ellipse, ray,Intersection, and normal vector. If the graph looks wrong, checkyour work. c) [3 marks] – A circle is a special case of an ellipse. Show what the equations in a) and b) reduce to if the ellipse is such that a = b, cx=0, cy=0. Be sure to explicitly represent the radius of the circle! d) The diagram below shows the geometry of refraction. A ray arriving at a surface, is bent from direction With the angles between the incident and refracted rays being given by Snell’s law: [2 marks] Show how to determine and the angle of refraction given , (are the indexes of refraction) [2 marks] Show and explain with a diagram how to obtain vector using and simple 2D rotations. Test your procedure by computing the refraction direction given( Attach any work for this part immediately after this page)CSC D18 – Fall 2019Assignment 1 – Basic Geometry and 2D Light TransportF. Estrada, Aug. 20193B) Parametric surfaces, surface geometry, and transformsHere, you will analyze the surface shape of a parametric 3D surface you mayhave heard of before: The Mobius strip. The goal is to identify tangent planes andnormal directions at arbitrary points on the surface – this would be required to renderthe strip in any 3D software.The surface of a Mobius strip with width w is given by:(http://mathworld.wolfram.com/MoebiusStrip.html)Where R is a constant, and represents the distance from the origin to the center-line of the Mobius strip, s is a parameter in [-w, w], and t is a parameter in [0, 2*Pi]. Plotting points for a range of values of s and t yields the familiar shape of the Mobiusstrip: a) [2 marks] Derive the equations for the tangent plane at any point (s,t) on the surface. This is a parametric surface so we expect the tangent plane as a parametric plane defined by two vectors spanning the plane. b) [2 marks] Determine the implicit equation for the tangent plane. This will requite you to figure out the normal to the plane. c) [3 marks] The Mobius strip above is centered at the origin, and its axis is the z axis (shown as a red line above, the strip wraps around it). Suppose we need to render a Mobius strip whose centerpoint is at and whose axis is aligned with . Determine the sequence of transformations that takes points on the Mobius strip above and produces the desired transfomed strip. For rotations, show the rotation matrix and show how the angle of rotation is computed. The transform sequence must be shown in the correct order. CSC D18 – Fall 2019Assignment 1 – Basic Geometry and 2D Light TransportF. Estrada, Aug. 20194Part 2 – Understanding how light works, 2D light transport Your task for this assignment is to implement the core components of a light-propagationAlgorithm. The task of the algorithm is fairly simple:Given a scene consisting ofa) 1 light source (which has a known position, colour, and type)b) A set of objects (which in this case are circles, with known position and material type)The program will:1) Emit a light ray from the light source2) Propagate the ray through the scene until it hits an object (or one of the 4 walls that make up the image boundary)3) It then will bounce the ray in a physically consistent way, depending on the material the object the ray hit is made ofThe starter code provides most of the nuts and bolts you need to implement the interestingbits, so you will focus on the geometric issues involved with the steps described above, and writea little (but not a lot!) of code. Then you can sit back and watch your program trace light arounda scene you created!Pattern of light resulting from a point light source(at the center of the image) and a set of refractingspheresCSC D18 – Fall 2019Assignment 1 – Basic Geometry and 2D Light TransportF. Estrada, Aug. 20195Part 2 – Understanding how light works, 2D light transport (cont.)Step 1) Download and uncompress the starter code into a suitable directory. Take time now to compile and run it – learn what the command line arguments do, and how to use the program. Of course, at this point it won’t be able to trace light, but it will show you a box of the size you specified, and the outlines of the objects defined for the scene.Step 2) Read all the header files included with the starter code – I am providing you with a lot of functionality, so you should know what is already there for you to use, and not waste time implementing functions I’m providing. You will also get a picture of how the code is structured, and what parts you need to implement.Step 3) Read CAREFULLY the comments in rays2D.c – this is the file you will be working on, and it has a couple of functions you must implement. The code has comments that will help you understand what you need to do. Once you’re done reading these comments, take a short break, then come back and read them again to make sure you didn’t miss anything.Step 4) Implement your solution. There are of course many ways to go about doing this, but I would suggest starting with casting rays from simple ‘laser’ light sources, and intersections between rays and walls. That gives you a basic framework on which to build the rest. The starter code will tell you what needs to be implemented. Test everything thoroughly, and for more than one case – your code will be auto-tested, so make sure it does the right thing on different scenes. For testing:- 1 or 2 samples, and recursion depth of 1 or 2 so you can check the basic geometry is correct.- Once you have the fundamental components working, increase sampling and recursion depth to check the process works to check the scene is rendered as expected.Of course, you should have a good idea what the sceneShould look like given the light sourceAnd the objects in itCSC D18 – Fall 2019Assignment 1 – Basic Geometry and 2D Light TransportF. Estrada, Aug. 20196Part 2 – Understanding how light works, 2D light transport (cont.)Notes: You are expected to use 2D rotations to generate the vector directions you need. This means your code needs to compute the relevant angles, determine suitable centers of rotation (and points to rotate), and then do the rotation to obtain whatever vector directions you need. Remember:Step 5) Pack your code for submission: – Complete ‘autotester_id.txt’ so the auto-tester knows who you are.Compress your code into a single compressed .tgz file namedlight2D_studentNo1_studentNo2.tgz (e.g. light2D_11223344_55667788.tgz)The tar command syntax is:>tar -cvzf name_of_your_compressed_tar_file.tgz *.c *.h autotester_id.txtThen submit the compressed file>submit -c cscd18f19 -a A1 -f name_of_your_compressed_tar_file.tgzDouble check that your compressed file uncompresses properly, and that it containsall the code as well as the ‘autotester_id.txt’ file. For reflection, the sign of the angle dependson whether the normal is to the left or tothe right of the incoming rayFor refraction, be careful to account for thedirections of the different vectors which dependon whether the ray is arriving at, or leavingan objectMarking SchemeWritten problems 20 marksWorking code 30 marks (auto-tested)Crunchy bonus Up to you!CSC D18 – Fall 2019Assignment 1 – Basic Geometry and 2D Light TransportF. Estrada, Aug. 20197Part 2 – Understanding how light works, 2D light transport (cont.) Get Crunchy! Of course, once you have a working 2D light transport engine, you want to use it to rendervery cool images. For bonus marks, you can extend your renderer to:[up to 10 marks] – Render a very cool scene (it should not be a clone of the one in this handout) Spend some time placing objects with suitable materials around, and render the scene at a reasonably good resolution, for lots of samples.[10 marks] – Implement dispersion. White light is a mixture of light across all visible wavelengths. Refracting objects bend light by different amounts depending on the wavelength, and we expect them to spread out the different colour components in white light (creating rainbows). Modify your code to handle this by cleverly using sampling, and by manipulating the index of refraction of the material depending on light wavelength. Dispersion of light by refracting materials [5 marks] – Implement spectral power distributions for lightsources. Implement proper light sources whose colour comes from a specific mixture of wavelengths at different amounts, and have your light source emit rays that follow this specific mixture’s distribution.[5 marks] – Implement coloured objects. Until now, all objects are ‘white’ in that they do not in any way change the colour of the light bounced by, or transmitted through them. modify your code so that it accounts for coloured objects. Scene rendered with a white lightsource and colour Refracting spheres. Drop by and talk with me if you want to work On any of these features but need a hint or two, or if you have other crunchy ideas to Try.Have Fun! Submitting crunchy stuff: Include a rendered scene with your compressed submitted file, as well as a ‘crunchy.txt’ describing what you did!CSC D18 – Fall 2019Assignment 1 – Basic Geometry and 2D Light TransportF. Estrada, Aug. 2019

LATEST POSTS
MOST POPULAR

ezAce多年来为广大留学生提供定制写作、留学文书定制、语法润色以及网课代修等服务,超过200位指导老师为您提供24小时不间断地服务。