Code Monkey home page Code Monkey logo

unity-raytracer's Introduction

Unity Raytracer

Description

This project is used to demonstrate additional components of raytracing within Unity for our graphics course (CS 4731).

Features

  • The mirrored surface on the sphere was done using the ray tracer implementation and recursively calculation the colors bouncing off other objects. From the first ray collision, the reflection was calculated and the ray tracing was run again from the new reflection ray.
  • The texture mapping on the cube was done using bilinear pixel interpolation. For every texture coordinate that was hit by a ray, the coordinates were interpolated across the texture map. The coordinates were scaled and averaged between pixel coordinates on the texture.
  • The light attenutation in the entire scene was done using the quadratic term in the attenuation function. The function was based on the distance from the light to the hit point in question during the calculation.

Notes

  • This project demonstrates ray tracing in Unity, which is a real time rendering engine. The project is setup such that the image is rendered from left to right, top to bottom.
  • Each pixel on the image plane is given the appropriate color after light, reflection and texture calculation.

Resources

Building

This project can be built within Unity.

Usage

Open this project in Unity and run in order to allow the ray tracing render the scene.

Source Files

  • RenderLoop.cs
    • This is where the raytracing functions are implemented.
  • RaytracedCamera.cs

Screenshots

  • mirror
    • This is a screenshot of just the mirror effect on the sphere.
  • attenuation
    • This is a screenshot of the mirror effect and light attenuation on the entire scene.
  • texture
    • This is a screenshot of the mirror effect, light attenuation and the texture mapping on the cube.
  • final-scene
    • This is a final screenshot of all the effects listed above in one scene.
    • This is where the camera and rendering plane are setup for this project.

unity-raytracer's People

Contributors

sizmw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.