Home
|
Tracer js
Welcome to Tracer js
Select scene below...
default
scene
scene.colors
scene.surfgen
scene.surfgen.plus
scene.darkness
assignment 1 scene 1
assignment 1 scene 2
basic ray tracer scene (www.scratchapixel.com)
tiny raytracer scene (http://www.gabrielgambetta.com/tiny_raytracer.html)
Trace
lighting
Reflections
Refraction
UHF
Parallax
render
stop
render at size:
s
m
l
xl
xxl
hd
4k
8k
workers:
0
1
2
4
8
transfer buffer
sample HD (1920x1080) and 4K (4096x2160) images rendered by this page:
/* * Programming assignment 1, Graphics 2004/2005 * example scene 2: spheres and planes * */ // some settings width 100 height 100 maxReflectionDepth 4 //maxReflectionDepth 1 gamma 1.0 // ground plane plane { normal < 0, 1, 0 > offset 20 material { // texture "./textures/texture.jpg" color < 0.4, 0.4, 0.5 > reflectance 0.1 } } // left wall plane { normal < 1, 0, 0 > offset 25 material { color < 0.2, 0.8, 0.2 > diffuse 0.5 } } // back wall plane { normal < 0, 0, 1 > offset 120 material { COLOR < 0, 0, 0 > reflectance 1 specular 1 } } // rode bal, half in de linker muur sphere { origin < -20, -5, -60 > radius 19 material { // perlin < 0.5, 0.5, 0.3 > < 0.6, 0.6, 0.4 > color < 1, 0, 0 > reflectance 0.5 } } // witte bol in het midden sphere { origin < 25, -5, -60 > radius 19 material { color < 1, 1, 1 > ambient 0 diffuse 0.4 specular 1 reflectance 0.8 } } // lamp vooraan light { location < 40, 40, 0 > color < 1, 1, 1 > intensity 1 } // lamp achteraan /* light { location < 50, 50, -80 > color < 1, 0, 0 > intensity 0.5 } light { location < 80, 50, -80 > color < 1, 1, 0 > intensity 0.5 } light { location < 110, 50, -80 > color < 0, 1, 0 > intensity 0.5 } light { location < 140, 50, -80 > color < 0, 0, 1 > intensity 0.5 } */
/* * Programming assignment 1, Graphics 2004/2005 * example scene 1 * */ // some settings width 400 height 400 gamma 1 // red sphere, centered sphere { origin < 0, 0, -60 > radius 20 material { color < 1, 0, 0 > ambient 1 } } // green sphere, more to the right and up, and partially behind the red sphere sphere { origin < 20, 20, -70 > radius 20 material { color < 0.5, 1, 0.5 > ambient 1 } } camera { origin < 0, 0, 0 > window < -1, -1, 1, 1 > near -1 } // light in front light { location < 40, 40, 0 > color < 1, 1, 1 > intensity 1 } // light in the back light { location < -10, 40, -80 > color < .8, 0.2, 0.2 > intensity 0.5 }
/* * Programming assignment 1, Graphics 2004/2005 * example scene 2: spheres and planes * */ // some settings width 600 height 600 maxReflectionDepth 4 //maxReflectionDepth 1 gamma 1.0 // ground plane plane { normal < 0, 1, 0 > offset 20 material { color < 0.4, 0.4, 0.5 > reflectance 0.1 } } // left wall plane { normal < 1, 0, 0 > offset 25 material { color < 0.2, 0.8, 0.2 > diffuse 0.5 } } // back wall plane { normal < 0, 0, 1 > offset 120 material { COLOR < 0, 0, 0 > reflectance 1 specular 1 } } // rode bal, half in de linker muur sphere { origin < -20, -5, -60 > radius 19 material { color < 1, 0, 0 > reflectance 0.5 } } // witte bol in het midden sphere { origin < 25, -5, -60 > radius 19 material { color < 1, 1, 1 > ambient 0 diffuse 0.4 specular 1 reflectance 0.8 } } // lamp vooraan light { location <40, 40, 0> color <1,1,1> intensity 1 } // lamp achteraan light { location <50, 50, -80> color <1, 0, 0> intensity 0.5 } light { location <80, 50, -80> color <1, 1, 0> intensity 0.5 } light { location <110, 50, -80> color <0, 1, 0> intensity 0.5 } light { location <140, 50, -80> color <0, 0, 1> intensity 0.5 }
/* * scene.surfgen.txt */ // some settings width 400 height 400 maxReflectionDepth 0 //maxReflectionDepth 8 gamma 1 // SurfGen surface surface { origin < 0, 0, -20 > rotation < 315, 0, 22.5 > //function "9-((7-sqrt(x^2+y^2))*(7-sqrt(x^2+y^2))+z^2)" //function "9-((7-sqrt(x^2+y^2))^2+z^2)" //function "-((x^2+y^2+z^2+2*y-1)*((x^2+y^2+z^2-2*y-1)*(x^2+y^2+z^2-2*y-1)-128*z^2)+256*x*z*(x^2+y^2+z^2-2*y-1))" //function "-((x^2+y^2+z^2+2*y-1)*((x^2+y^2+z^2-2*y-1)^2-128*z^2)+256*x*z*(x^2+y^2+z^2-2*y-1))" //function "100-x^2-y^2-z^2" //function "1/-((x^2+y^2)/100)-z" //function "(sin(sqrt(x^2+y^2))+(x^2-y^2)/10-(x*y)/10)-z" function "cos(sqrt((x^2)+(y^2)))-z" //function "(cos((sqrt((x)^2+(y)^2))^1))^1-z" region{ domain_x < -10, 10 > domain_y < -10, 10 > domain_z < -1.1, 1.1 > } // Tuned for 400x400 image // at current orientation raydepth 0.5 filterdepth 32 inverseepsilon 64 material { texture "./textures/checkers.png" color < 1, 1, 1 > ambient 0 specular 1 specularpower 32 reflectance 0.1 //diffuse 0.1 //transparency 0.9 //refractionIndex 1 //noShadow } } // lamp vooraan light { location <0, 0, 0> color <0,1,0> intensity 0.7 } light { location <-20, -5, -11> color <1,0,0> intensity 0.5 } light { location <10, 10, -50> color <0,0,1> intensity 0.25 }
/* * scene.surfgen.txt */ // some settings width 400 height 400 maxReflectionDepth 2 gamma 1 /* // HD (1920x1080) camera { window < -1.0, -0.5625 , 1.0 , 0.5625 > // left,bottom,right,top } */ /* // HD (1920x1080) camera { window < -1.7778, -1.0 , 1.7778 , 1.0 > // left,bottom,right,top } */ /* // 4K (4096x2160) camera { window < -1.0, -0.5273 , 1.0 , 0.5273 > // left,bottom,right,top } */ /* // 4K (4096x2160) camera { window < -1.8963, -1.0 , 1.8963 , 1.0 > // left,bottom,right,top } */ // SurfGen surface surface { origin < 0, 0, -20 > rotation < 300, 0, 22.5 > //function "9-((7-sqrt(x^2+y^2))*(7-sqrt(x^2+y^2))+z^2)" //function "9-((7-sqrt(x^2+y^2))^2+z^2)" //function "-((x^2+y^2+z^2+2*y-1)*((x^2+y^2+z^2-2*y-1)*(x^2+y^2+z^2-2*y-1)-128*z^2)+256*x*z*(x^2+y^2+z^2-2*y-1))" //function "-((x^2+y^2+z^2+2*y-1)*((x^2+y^2+z^2-2*y-1)^2-128*z^2)+256*x*z*(x^2+y^2+z^2-2*y-1))" //function "100-x^2-y^2-z^2" //function "1/-((x^2+y^2)/100)-z" //function "(sin(sqrt(x^2+y^2))+(x^2-y^2)/10-(x*y)/10)-z" function "cos(sqrt((x^2)+(y^2)))-z" //function "(cos((sqrt((x)^2+(y)^2))^1))^1-z" region{ domain_x < -10, 10 > domain_y < -10, 10 > domain_z < -1.1, 1.1 > } // Tuned for 400x400 image // at current orientation raydepth 0.5 filterdepth 32 inverseepsilon 64 material { texture "./textures/checkers.png" color < 1, 1, 1 > ambient 0 specular 1 specularpower 32 reflectance 0.1 } } // ground plane plane { normal < 0, 1, 0 > offset 8 material { perlin < 0.5, 0.5, 0.3 > < 0.6, 0.6, 0.4 > reflectance 0.5 ambient 0.3 } } // left wall plane { normal < 1, 0, 0 > offset 51 material { color < 0.6, 0.6, 0.6 > diffuse 1 ambient 0.5 } } // back wall plane { normal < 0, 0, 1 > offset 150 material { color< 0.5, 0.5, 0.3 > } } // red/yellow mottled sphere sphere { origin < -26, 20, -85 > radius 25 material { perlin < 0.5, 0, 0 > < 1.6, 1.6, 0 > ambient 0.5 diffuse 1 } } // metal sphere sphere { origin < 26, 25, -25 > radius 25 material { ambient 0 diffuse 0 specular 1 reflectance 0.9 } } // glass sphere sphere { origin < 1, 1, -5 > radius 1 material { color < 1, 0, 0 > ambient 0 diffuse 0 transparency 0.95 refractionIndex 1.52 // crown glass reflectance 0.25 specular 0.5 noShadow } } // lamp vooraan light { location <0, 0, 0> color <0,1,0> intensity 0.7 } light { location <-20, -5, -11> color <1,0,0> intensity 0.5 } light { location <10, 10, -50> color <0,0,1> intensity 0.25 }
/* * scene.darkness.txt */ // some settings width 400 height 400 //maxReflectionDepth 4 maxReflectionDepth 1 gamma 1 surface { origin < 0, 0, -85 > function "cos(sqrt(((x*x)+(y*y))/2))-z" filterdepth 512 raydepth 0.25 // inverseepsilon 0.5 // region{ // domain_z < -1, 1 > // } material { color < 0, 0, 0 > specular 1 reflectance 1 } } plane { normal <0,1,0> offset 20 material { color < 0, 0, 0 > specular 1 reflectance 1 } } sphere { origin < 15, 0, -40 > radius 10 material { color < 1, 0, 0 > ambient 0 diffuse 0.4 specular 1 reflectance 0.8 } } light { location <-60, 0, -40> color <1,1,1> intensity 1 }
/* * Programming assignment 1, Graphics 2004/2005 * example scene 1 * */ // some settings width 400 height 400 gamma 0.1 // red sphere, centered sphere { origin < 0, 0, -60 > radius 20 material { color < 1, 0, 0 > ambient 0.3 } } // green sphere, more to the right and up, and partially behind the red sphere sphere { origin < 20, 20, -70 > radius 20 material { color < 0.5, 1, 0.5 > ambient 0.3 } } camera { origin < 0, 0, 0 > window < -1.0, -1.0, 1.0, 1.0 > near -1.0 } // light in front light { location < 40, 40, 0 > color < 1, 1, 1 > intensity 1 } // light in the back light { location < -10, 40, -80 > color < .8, 0.2, 0.2 > intensity 0.5 }
/* * Programming assignment 1, Graphics 2004/2005 * example scene 2: spheres and planes * */ // some settings width 400 height 400 maxReflectionDepth 4 gamma 1.0 // ground plane plane { normal < 0, 1, 0 > offset 20 material { color < 0.4, 0.4, 0.5 > reflectance 0.1 } } // left wall plane { normal < 1, 0, 0 > offset 25 material { color < 0.2, 0.8, 0.2 > diffuse 0.5 } } // back wall plane { normal < 0, 0, 1 > offset 120 material { COLOR < 0.2, 0.2, 0.8 > } } // rode bal, half in de linker muur sphere { origin < -20, -5, -60 > radius 19 material { color < 1, 0, 0 > reflectance 0.5 } } // witte bol in het midden sphere { origin < 25, -5, -60 > radius 19 material { color < 1, 1, 1 > ambient 0 diffuse 0.4 specular 1 reflectance 0.8 } } // lamp vooraan light { location <40, 40, 0> color <1,1,1> intensity 1 } // lamp achteraan light { location <-10, 40, -80> color <0.8, 0.2, 0.2> intensity 0.5 }
/* * */ // some settings width 100 height 100 maxReflectionDepth 5 gamma 1.0 // back wall plane { normal < 0, 0, 1 > offset 1000 material { COLOR < 1, 1, 1 > } } sphere { origin < 0, -10004, -20 > radius 10000 material { color < 0.2, 0.2, 0.2 > ambient 0.5 reflectance 0.0625 } } sphere { origin < 0, 0, -20 > radius 4 material { color < 1, 0.32, 0.36 > reflectance 0.1 opacity 0.8 refractionIndex 1.01 specular 0.5 } } sphere { origin < 5, -1, -15 > radius 2 material { color < 0.90, 0.76, 0.46 > reflectance 0.5 specular 0.25 } } sphere { origin < 5, 0, -25 > radius 3 material { color < 0.65, 0.77, 0.97 > reflectance 0.5 specular 0.25 } } sphere { origin < -5.5, 0, -15 > radius 3 material { color < 0.9, 0.9, 0.9 > reflectance 0.5 specular 0.25 } } light { location < 0, 20, -30 > color < 1, 1, 1 > intensity 1 }
/* * */ // some settings width 100 height 100 maxReflectionDepth 5 gamma 1.0 // back wall plane { normal < 0, 0, 1 > offset 1000 material { COLOR < 0, 0, 0 > } } sphere { origin < 0, -10004, 0 > radius 10000 material { color < 0.9, 0.9, 0.0 > ambient 0.5 reflectance 0.2 } } sphere { origin < 0, -4, -30 > radius 10 material { color < 0.9, 0.0, 0.0 > reflectance 0.3 specular 1 specularPower 1000 } } sphere { origin < -20, 6, -40 > radius 10 material { color < 0.0, 0.9, 0.0 > reflectance 0.4 specular 0.4 } } sphere { origin < 20, 6, -40 > radius 10 material { color < 0.0, 0.0, 0.9 > reflectance 0.5 specular 1 specularPower 1000 } } light { location < 10, 10, -20 > color < 1, 1, 1 > intensity 0.8 }
W3C Validate HTML
W3C Validate CSS
lint Validate Javascript
Home
|
Tracer js
Modified 2005-10-10
Copyright © 2000-2015 Edward Evers