Giter Club home page Giter Club logo

raytracer's Introduction

Raytracer

ℹ️ About

The Raytracer project undertaken in the Second year at {Epitech} is designed to allow students to put into practice fundamental programming concepts of oriented object with C++. It's also a good introduction to Raytracing system.

📑 Project Info

📃 Description

Raytracer is a raytracing system simulator: A programm simulate the rendering of an image with light, shadow effects, reflexion system and many other effects and graphics systems.

⚙️ Technology Notes

The game was developed using C++.

🙍‍♂️ Contributors:

👨‍💻 Developer:

How to use:

Refer to the documentation.

raytracer's People

Contributors

mathieurobert1 avatar njord201 avatar axelf44 avatar theophile-jr avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Forkers

axelf44

raytracer's Issues

Refactor directional light

The actual light position is set in the infinite but now we want the light to be place at a given position.

Refactor hitPoint

The hitPoint function, return a Math::Point3D type, create a color class and change the type of return hitPoint, so rename the hitPoint to getColorOfPoint

FIX: Plane hitPoint function

The plane don't work, please check the function hitPoint, the function return a position if the ray never touch the plane.

The actual result:
image

The configuration file:
image

The expected result:
image

Implemente the last design pattern

We already implement the design pattern named "Factory" but in this project we must have 2 design pattern so I've to choice between all these design pattern:

• Builder
• Composite
• Decorator
• Observer
• State
• Mediator

Now I think I'm going to implement the builder pattern !

Add a GUI

Create a GUI, this GUI should be display the result in a window.

Use SDL2 for this task.

Add example scene

Adding the example file given in the subject in the scenes/ folder

Initialize the repository

Create the following needs:

  • Makefile root; Makefile for each plugins, Makefile for the executable
  • plugins folder
  • src folder with : plugins/, raytracer/
  • include folder
  • tests folder
  • scenes folder
  • screenshots folder

Create the Renderer class

I will create the renderer class which will make the render of the raytracer.

The Renderer class will have the following variables:

  • camera
  • Lights
  • Primitives

At the end the renderer will have product the .ppm image.

Fix Sphere hit computation

The compute of the hitpoint Sphere is not correctly implemented.

This issues is made to ensure the good working of the sphere hit method.

Create the Sphere plugin

Create the Sphere primitive into a plugin.

The plugin need a getInstance to get the class Sphere for the .so.

A class Sphere, wich contain:

  • a constructor()
  • a hit function which return the double where the sphere was hit by a ray

Create Cylinder Primitive

Create the Cyliender primitive into a plugin.

The plugin need a getInstance to get the class Cylinder for the .so.

A class Sphere, wich contain:

  • a constructor()
  • a hit function which return the double where the sphere was hit by a ray

Handle colored lights

Handle the colored lights.

On a white surface, a red light should render a red surface.
On a blue surface, a yellow light should render a green surface.

Etc...

To add a color to a light :
image

Parse the plane primitive

I've to check inside the settings file and use the libconfig library to parse the different plane primitives !

Compute hit color

The goal of this branch is to compute the exact color of a hit point.

For that, all primitives have to get a computeColor method which take the hitpoint and lightContainer and compute the hitcolor pixel in relation to the primitive material.

Fix display of back camera primitive

The current problem is that a primitive behind the camera is displayed instead of of being invisible.

The goal is to not display the element behind the camera.

Create PrimitivesContainer class

Create the PirmitivesContainer class to contains the Primitives.
The class must have the following methods:

  • add (add a new primitive to the container)
  • hit (compute all the hit points by a ray and return it)
  • clear (clear the Primitives list)

Create the Ray class

Create the ray class with the following variables :

  • Vector3D _direction
  • Point3D _origin

And the following methods:

  • origin
  • direction
  • at

Handle translation

Handle the translation for primitives/camera/lights

image

The translation must be done in the parser or in the getOrigin of the objects.

Set up the Camera

I've to use the Scena class who have the data of Camera and I've to set up the camera !

Parse the configuration file !

I've to implement the parsing system of the external file !

To do it i'm going to use the libconfig++ library!

Here is an example of a scene file using libconfig++ file format:

Configuration of the camera

camera :
{
resolution = { width = 1920; height = 1080; };
position = { x = 0; y = -100; z = 20; };
rotation = { x = 0; y = 0; z = 0; };
fieldOfView = 72.0; # In degree
};

Primitives in the scene

primitives :
{
// List of spheres
spheres = (
{ x = 60; y = 5; z = 40; r = 25; color = { r = 255; g = 64; b = 64; }; } ,
{ x = -40; y = 20; z = -10; r = 35; color = { r = 64; g = 255; b = 64; }; }
) ;

    // List of planes
    planes = (
            { axis = " Z " ; position = -20; color = { r = 64; g = 64; b = 255; }; }
    ) ;

};

Light configuration

lights :
{
ambient = 0.4; # Multiplier of ambient light
diffuse = 0.6; # Multiplier of diffuse light

    # List of point lights
    point = (
         { x = 400; y = 100; z = 500;};
    ) ;

    # List of directional lights
    directional = () ;

};

Compute hit color plane

Compute the hit color of the plane.

By default the color is dark, but the goal of this issue is to return a color based on the normal of the plane, his material and the different lights.

Handle OBJ files

Handle the OBJ files.
Creates a parser OBJ that create many triangle for the Mesh.
image

Fix getNormal cylinder methods

Fix the getNormal computation in Cylinder.

The normal should be the orthogonal vector of the cylinder axis, but currently, the normal is the same as the cylinder which is not the same

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.