CSE 287 Project One Spring 2017.docCSE287- Page 1 of 7Project OneDescription: Your ray tracing work will conclude with this project. The project will requireyou to implement shadow feelers to create shadows, trace reflection vectors to createmirror-like inter-object reflections, and add additional types of shapes to a scene. Yourstarting point for this lab is your completed lab four.Your grade on this project will depend not only on successful implementation ofadditional aspects of ray tracing, but also on quality of the scene that is rendered byyour project.Simple Polygon SurfacesSimple polygons are described by three or more vertices in same plane, are convex,and have no sides which cross one another. The front face of the polygon is normallydefined as the face on which the vertices appear in counter clockwise order. Thesurface normal for the polygon should point out of the front face.Implement a sub-class of the Plane class that represents a simple polygon. Theconstructor among other things should have an input parameter that is a vector ofvec3 objects which specify the vertex locations for the polygon in counter-clockwiseorder.The sub-class should use the findClosestIntersetion method of Plane class todetermine if the plane in which the polygon lies is intersected. It can then use themethod described in the notes to determine if the intersection is inside the polygonCSE 287 Project One Spring 2017.docCSE287- Page 2 of 7described by the vertices passed to the constructor. You should be able to account forintersections with both the front and back side of the polygon. Both sides of the polygonshould be rendered with correct lighting.Quadric SurfacesImplement at least one specialized sub-class of the QuadricSurface class. Yourspecialization should enable the rendering of a quadric surface such as a cylinder,cone, ellipsoid, paraboloid, hyperbolic paraboloid, etc. Shapes such as the cone orcylinder should not be infinite. It should be possible to render them in any position withinthe scene. In your sub-class, use the findClosestIntersetion of theQuadricSurface class to do the heavy lifting of intersection testing. In the sub-classfindClosestIntersetion method, you can then check the point of intersection to seeif it is in the more limited shape you are creating. Both sides of the surface should berendered with correct lighting.Function to Look for Ray IntersectionsRay tracing is all about finding intersections between rays and surfaces in a scene. Youhave already written code that carries out this task. You will need the functionality thatcarries out this task to create shadows and reflections.You will find the declaration of a function (not a method) called findIntersection. inLights.h (I left in in the lab code by mistake). It is defined it in Lights.cpp#include Lights.hHitRecord findIntersection( const glm::vec3 &e, const glm::vec3 &d, std::vector> & surfaces){ …}The code in the function is similar to what you previously included in the RayTracerclass to fill in the body of this function. Modify your RayTracer class so that it calls thisfunction when individual rays are traced. Make sure everything still works.CSE 287 Project One Spring 2017.docCSE287- Page 3 of 7ShadowsImplement shadows by checking shadow feelers for intersections with the surfaces inthe scene. Cast a shadow feeler whenever a traced ray intersects an object. Fordirectional light sources, an intersection with a surface anywhere along a shadow feelerthat points in the direction of the light vector for the source should result in there beingno contribution from that light source. For positional light sources, an intersection with asurface in between the origin of the shadow feeler and the position of the light sourceshould result in there being no contribution from that light source.With the ray tracing infrastructure we have been developing in the labs, one way toaccomplish this would be to have the illuminate methods of the LightSource structand sub-structs to accept a third parameter containing all the surfaces in the scene.Then the shadow feelers can be appropriately generated and tested for intersectionswithin the illuminate method by calling the findIntersection function.virtual color illuminate( const vec3 & eyeVector,HitRecord & closestHit,vector surfaces) {…Inter-Object ReflectionsAdd mirror-like inter object reflections by tracing a reflection ray to the closest surfaceintersection for each view ray. Once generated, the reflection ray can be traced inexactly the same way as the viewing rays. The best way to accomplish this is by callingthe traceIndividualRay method recursively and adding w代做CSE 287、代写C++设计、c/c++程序语言调试、hat it returns to the totalcolor for the pixel. To do this, it is necessary to keep the recursion from being infinite.This can be accomplished by adding an additional parameter to thetraceIndividualRay method. This parameter can be decremented prior to eachrecursive call. The recursion would stop when the value is less than or equal to zero.color RayTracer::traceIndividualRay( const vec3 &e,const vec3 &d, int recursionLevel)Taking it FurtherImplement at least three of the following extensions for your ray tracing program. Youare of course encouraged to implement more if you like.CSE 287 Project One Spring 2017.docCSE287- Page 4 of 7Varying the Recursion LevelAdd the ability to have the scene rendered with different levels of recursion forreflection rays by pressing the number keys. You can do this by adding additionalcases to the switch statement in the KeyboardCB function in the Lab.cpp file. Ineach case change the maximum recursion depth by modifying a data member inthe RayTracer class. The call to glutPostRedisplay at the bottom of theKeyboardCB function will cause the scene to be rerendered when you press akey.static void KeyboardCB(unsigned char key, int x, int y){switch(key) {case(f): case(F) : // f key to toggle full screenglutFullScreenToggle();break;case(27): // Escape keyglutLeaveMainLoop();break;case(0) :rayTrace.recursionDepth = 0;break;case(1) :rayTrace.recursionDepth = 1;break;case(2) :...Reflect the “Sky”Reflection rays often do not intersect any surfaces in the scene. The illuminationfor these non-intersecting rays can simply be “no color” or if can be a scaleddown default color. The later will cause shiny objects to appear to reflect thedefault color as though it is the sky. Modify your program to create this effect.AttenuationUse constant, linear, and quadratic attenuation constants to attenuate thecontributions of positional light sources based on their distance from the point ofintersection.Use attenuation to reduce the contribution of reflection vectors based on thedistance to the intersection between the reflection ray and the object it hits. CSE 287 Project One Spring 2017.docCSE287- Page 5 of 7Day and NightModify the program so that pressing the ‘d’ and ‘n’ causes the scene to berendered in day and night modes. You can simply “dim” the lights or change thelighting entirely to create the two different effects.Front and BackModify the program so that pressing the ‘a’ and ‘b’ keys causes the scene to berendered from two different opposite viewpoints.Perspective Versus Orthographic ProjectionModify the program so that pressing the ‘p’ key causes the scene to be toggledback and forth between perspective and orthographic renderings of the scene.AntialiasingModify the program so that pressing the ‘l’ key toggles on and off antialiasing.Because of the discrete nature of raster image representation, rendered imageswill include aliasing artifacts. These artifacts create a jagged or stair stepped inobjects that should appear smooth. In ray tracing applications, anti-aliasing canbe performed by tracing multiple rays per pixel. The simplest approach it tosubdivide each pixel into the grid, cast one rays per grid square, and then set therendered pixel intensity to the average of color associated with the rays.CSE 287 Project One Spring 2017.docCSE287- Page 6 of 7Texture MappingBasic texture mapping uses a function to determine the diffuse color at the pointof intersection with a surface. I will provide a lab on texture mapping that will beused in future sections of this course. If you are interested in adding texturemapping to your project, use the lab as a guide. Incorporating texture mappingwould count as two extensions.Turn it inSubmission instructions for this project are similar to the lab instructions with theexception that you should also submit a screen capture of the best result you achievewhen rendering your scene.1. When submitting your project include a screen capture of the scene that is created CSE 287 Project One Spring 2017.docCSE287- Page 7 of 7by your project.2. Copy the folder containing your solution to the desktop.3. Change the name of the folder to CSE287ProjectOne followed by your uniqueidentifier. For instance “CSE287ProjectOneBachmaer.”4. Open the solution. Make sure it still runs.5. Clean the solution by selecting Build->Clean Solution.6. Zip up the solution folder using the standard windows compression tool. (No 7zips,rars, etc.)7. Submit your zip archive of the solution through canvas.8. Upload a screen capture of the best result you achieve when rendering your scene.转自:http://www.3daixie.com/contents/11/3444.html
讲解:CSE 287、C++、c/c++、shadow feelersPython|Haskell
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...