Write a ray tracing renderer. 

Objective
This is a difficult assignment.  You should start on this project far before of the due date, to give yourself time to write and debug your code.
The goal of this project is to write a ray tracing renderer.  You will write a collection of Javascript functions that, when called, will create a 3D scene and produce 2D images of the scene.  One of the functions will initialize the scene, others will create objects, lights and a virtual camera, and one additional function will cause the scene to be rendered into a 2D image.  You will be provided with various scenes that will call your functions to test your ray tracing code.
This is the first half of a two-part project. For this first part you will cast eye rays into the scene for each pixel, test these rays for intersection with cylinder objects, and then use the diffuse shading equation to find the color for each pixel.  In the second half of the project you will expand your Ray Tracer to include new functionality.
Project Description
You have four primary goals for the first part of this project:
Initialize the scene
Cast eye rays for each pixel
Implement detection of ray intersection with cylinders
Implement the diffuse shading equation
You can accomplish these goals however you see fit. A good approach would be to use object oriented programming practices and create objects for each of the major scene components (light, ray, cylinder). Global lists of scene objects can be stored to allow for easy access. You can then create a Ray object for each pixel and write a method which will take a Ray as input and test it against the scene objects for intersections, returning the closest hit. This Hit object, containing all necessary information, can then be passed to a shading function which would implement the shading equation (for multiple light sources) and return the pixel color. Such an approach would be easy to test and to extend in the next stage of the project.
However you implement the ray tracer, your results should appear exactly like the examples shown below in Results.
Provided Code
The PROVIDED SOURCE CODE  Download PROVIDED SOURCE CODE contains functions that describe various scenes with cylinders. Each number key 1-4 is assigned to a single scene function and pressing that key should reset the scene and create an image of the new one.
You should modify the source code in any way you see fit, and comment your code (include placing your name in the header). The source code is written in Processing/Javascript. Visit “p5js.org/reference/” for more information on built in functions. You are NOT allowed to use most of the built in processing/openGL functions in this project such as for drawing spheres. We are not using rasterization for this project!  You are, however, encouraged to use the p5.Vector data type and the standard math functions.  When in doubt about what library functions are okay to use, please ask the instructor or a TA.
You must set the color of each pixel manually. The easiest way to set a pixel’s color is to create a one-by-one pixel rectangle using the rect() function, as is shown in the provided code.
Scene Description Language
Each scene is described by calling several functions that set up and render the scene.  In addition to the test scenes, we have also provided empty functions for you to write in order to create your ray tracer.  Feel free to define any classes, objects, data structures, and global variables that you want to accomplish this project.
Below are the functions that you will need to implement for this assignment:
reset_scene()
Initialize all the data structures and variables so you can start with an empty scene.
set_background (r, g, b)
Sets the background color. If a ray misses all the objects in the scene, the pixel should be given this color.
set_fov (angle)
Specifies the field of view (in degrees) for perspective projection.  You will assume that the eye is at the origin, and that it is looking down the -z axis.
new_light (r, g, b, x, y, z)
Create a point light source at position (x,y,z) and its color (r, g, b). Your code should allow any number of light sources. For the second part of this assignment, you will cause these lights to cast shadows.
new_material  (dr, dg, db, ar, ag, ab, sr, sg, sb, spec_power, k_refl)
Specifies a new surface material with diffuse color (dr, dg, db).  Ignore the other terms for now, since we will not use them until the second part of this assignment.
new_cylinder  (x, y, z, radius, height)
Specifies the creation of a vertical cylinder with its base at (x, y, z) and with a given radius and height.  The material properties of the surface are given by the last new_material() command that was executed prior to this command.
draw_scene()
Ray-traces the scene and displays the image in the canvas region in your browser.
Note on color specification: Each of the red, green, and blue components for the above commands are floating point values in the range of 0.0 to 1.0.
Results
Below are the images that your program should generate for a given scene, when you press the keys 1-4.  There will be additional scene descriptions provided for Part B of this project.
My advice: use this github repo for a very similar project to reference functions and essentially copy but for cylinders instead of spheres
https://github.com/nathandaven/jsRayTracer

DeliveredIn24
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.