Simple RayTracer with miniLibX
(rt_file/test_obj/multi_009.rt)
git clone https://github.com/42minirt/miniRT.git
cd miniRT
make
Some sample setting files in rt_file/
./miniRT <scene_setting_file.rt>
- The drawing scene is described in a scene setting file; rt file
- Load rt file as a program argument
- filename : rt file
- extension :
.rt
- format
-
id
andparameters
on as single line. -
general
< id > < paramters > A: Ambient lightning_ratio[0,1] RGB[0,255] C: Camera viewpoint(xyz) orientation_vec(xyz)[-1,1] FOV[0,180] L: Light point(xyz) light_brightness_ratio[0,1] RGB[0,255] SL: Spotlight Light_point(xyz) orientation_vec(xyz)[-1,1] light_brightness_ratio[0,1] angle[0-90] RGB[0,255] sp: Sphere center_point(xyz) diameter RGB[0,255] <options> pl: Plane point(xyz) orientation_vec(xyz)[-1,1] RGB[0,255] <options> cy: Cylinder bottom_center(xyz) orientation_vec(xyz)[-1,1] diameter height RGB[0,255] <options> co: Corn bottom_center(xyz) orientation_vec(xyz)[-1,1] diameter height RGB[0,255] <options>
-
option
< option id > < parameters > perfect_ref checker RGB image "image_texture_path" "bumpmap_path"
-
example
A 0.2 255, 255, 255 C -50, 0, 20 0, 0, 1 70 L -40,50,00 0.6 10, 0, 255 SL -40,50,00 0, 0, 1 0.6 60.0 10, 0, 255 sp 0,0,20 12.6 10, 0, 255 pl 0, 0, -10 0, 1, 0 0, 0, 225 cy 50, 0, 20 0, 0, 1 14.2 21.42 10, 0, 255 perfect_ref co 0, 0, 0 0, 0, 1 14.2 21.42 10, 0, 255 checker 0, 0, 0
-
This program uses a Left-hand coordinate system
+y
| +z
| /
|/_____ +x
O
- Each parameter of an id must be written in the order that complies with the format
- Lines starting with
#
are considered comment lines - If a rt file with an invalid format is loaded, the program will terminate
- id (
A
,C
,L
,SL
,sp
,pl
,cy
), option specifier (perfect_ref
,checker
,image
) are determined by an exact match - The number of
A
,C
must each be 1
- normalized_vec allows
xyz[-1,1]
, but make sure norm(xyz) >= 1 - If each number is out of range, the program will terminate
- Any number of spaces, horizontal tabs can be used between parameters
- If , is not used as an appropriate delimiter, the program will terminate
- ex)
R,G,B,
,R,,G,B,
etc...
- ex)
- If an invalid number such as
++1
,0..001
is written, the program will terminate
- Image files should be in
P3 PPM
format - If
image_path
is""
, it is determined that no image is used- For example,
image "texture_path" ""
when only texture_path is loaded, or not loading bumpmap - Specify a valid path for either texture or bumpmap
- For example,
- If the specified
path
is not a valid ppm file, the program will terminate
-
checkered corn, sphere and plane (rt_file/test_obj/multi_003.rt)
-
image texture and bump mapped sphere (rt_file/simple_test/bump_1.rt)
- Ubuntu 22.04.2 LTS (ARM64)
- MacOS OS Ventura 13.0 (ARM64)
- 2023/Jun/18th
- The Textbook of RayTracing @TDU
- C言語でレイトレーシングプログラムを作った
- 床井研究室 バンプマッピング
- Unity Documentation 法線マップ
- Ray Tracing in One Weekend
- Jamis Buck, The Ray Tracer Challenge, Pragmatic Bookshelf
- Fletcher Dunn, Ian Parberry, 実例で学ぶゲーム3D数学(松田 晃一, 訳), オライリージャパン
- Eric Lengyel, ゲームプログラミングのための3Dグラフィックス数学(狩野 智英, 訳), ボーンデジタル
- 村岡一信/千葉則茂, CによるCGレイトレーシング, サイエンス社