Skip to content

cryscham123/my_raytracing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo
MiniRT Project for 42 Seoul

This repository is for the 42 seoul project MiniRT.
The objective of this project is to render simple Computer-Generated-Images
and to implementing mathematical formulas.

image

image

image

Features

  • Support MacOS
  • 4 simple geometric objects: plane, sphere, cylinder, cone
  • Checkerboard color
  • Bump map / custom image textures.
  • Movement and change orientation
  • Optimization with Multi-Threading

Usage

  • You can execute file with one argument ConfigFile
./miniRT <your config file name>
  • Now you can see result with another window
  • You can move four direction with keyboard wasd
  • You can move updown with mouse wheel
  • If you click mouse wheel, you can change your orientation
  • <ESC> key for terminate program
  • Put your custom config file in folder test_file. config file's extension must be '.rt'
  • Put your texture image in folder texture

Config

  • You can set objects per one line
  • Each line should follow this specific order
see
  • Ambient lightning
    A 0.2 255,255,255

    identifier: A
    ambient lighting ratio in range [0.0,1.0]: 0.2
    R,G,B colors in range [0-255]: 255, 255, 255

  • Camera
    C -50.0,0,20 0,0,1 70

    identifier: C
    x,y,z coordinates of the view point: -50.0,0,20
    3d normalized orientation vector. In range [-1,1] for each x,y,z axis: 0.0,0.0,1.0
    FOV : Horizontal field of view in degrees in range [0,180]: 70

  • Lights
    L -40.0,50.0,0.0 0.6 10,0,255

    identifier: L
    x,y,z coordinates of the light point: -40.0,50.0,0.0
    R,G,B colors in range [0-255]: 10, 0, 255

  • sphere
    sp 0.0,0.0,20.6 12.6 10,0,255 [texture]

    identifier: sp
    x,y,z coordinates of the sphere center: 0.0,0.0,20.6
    the sphere diameter: 12.6
    R,G,B colors in range [0-255]: 10, 0, 255
    you can add '|' and another color behind R,G,B color setting to set checker board (optional)
    you can add texture file name (optional)

  • cylinder
    cy 50.0,0.0,20.6 0.0,0.0,1.0 14.2 21.42 10,0,255 [texture]

    identifier: cy
    x,y,z coordinates of the center of the cylinder: 50.0,0.0,20.6
    3d normalized vector of axis of cylinder. In range [-1,1] for each x,y,z axis: 0.0,0.0,1.0
    the cylinder diameter: 14.2
    the cylinder height: 21.42
    R,G,B colors in range [0,255]: 10, 0, 255
    you can add '|' and another color behind R,G,B color setting to set checker board (optional)
    you can add texture file name (optional)

  • plane
    pl 0.0,0.0,-10.0 0.0,1.0,0.0 0,0,225 [texture]

    identifier: pl
    x,y,z coordinates of a point in the plane: 0.0,0.0,-10.0
    3d normalized normal vector. In range [-1,1] for each x,y,z axis: 0.0,1.0,0.0
    R,G,B colors in range [0-255]: 0,0,225
    you can add '|' and another color behind R,G,B color setting to set checker board (optional)
    you can add texture file name (optional)

  • cone
    cn 0.0,0.0,-10.0 0.0,1.0,0.0 10 30 0,0,225 [texture]

    identifier: cn
    x,y,z coordinates of a point in the plane: 0.0,0.0,-10.0
    3d normalized normal vector. In range [-1,1] for each x,y,z axis: 0.0,1.0,0.0
    height:10
    radius:30
    R,G,B colors in range [0-255]: 0,0,225
    you can add '|' and another color behind R,G,B color setting to set checker board (optional)
    you can add texture file name (optional)

example file

A 1 200,200,200


L -5,20,20 0.7 50,120,150
L 5,20,20 0.7 50,120,150

C 0,2,20 0,0,-1 70




sp      0.0,1,-2 1.5 100,0,50

sp      0.2,1.3,-2 1.5 200,200,200
sp      -0.6,1.4,-1.4 0.1 0,0,0

sp      -0.2,1.3,-2 1.5 200,200,200
sp      0.6,1.4,-1.4 0.1 0,0,0

cy 0,1.3,-4 0,0,1 3 3 55,55,55
sp      0,2.3,-10 10 200,200,100 ./texture/earth_normal.xpm # Bumpmap texture

pl      0,-2,0 0,-1,0 0,140,0
pl      0,0,-20 0.8,0,0.6 200,50,200 ./texture/bricks_normal.xpm
pl      0,0,-20 -0.8,0,0.6 200,50,200 ./texture/bricks_normal.xpm



cn -7,0,-10 -0.6,-0.8,0 10 30 200,0,50
cn 7,0,-12 0.6,-0.8,0 10 30 200,0,50

cn -5,2,2 0,-0.6,0.8 2 4 200,200,50|80,80,80 # Two color of checker board
cy 5,2,2 0,-0.6,0.8 2 4 55,55,205|175,175,175

About

raytracing implement with c

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published