This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IMPORTANT: increase the code execution time limit up to 20000 milliseconds. This may take some time to render. | |
function raytracer() { | |
// Resolution | |
const res = parse_int(prompt("Choose resolution (recommended: 200)"), 10); | |
const sample = parse_int(prompt("Anti-aliasing (MSAA) number of samples (1 - 8)"), 10); | |
const roughness = parse_int(prompt("Surface roughness (0 - 100)"), 10) / 100; | |
const col = [0.5, 0.5, 0.6]; // r, g, b | |
const skycol = [0.5, 0.7, 1.0]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated | |
documentation files (the "Software"), to deal in the Software without restriction, including without limitation | |
the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, | |
and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | |
The above copyright notice and this permission notice shall be included in all copies or substantial portions | |
of the Software. | |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED | |
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Minified, token reduced: | |
function procedural_heart() | |
{ | |
function f(u,v){const r=0.15/(math_pow(0.5-u,2)+math_pow(0.75-(v+math_sqrt(math_abs(u-0.5)+0.1)*0.5),2)+0.01);return color(square,r,r-v*r,u*r);} | |
function i(x,y,acc){return x>=150?acc:i(x+1,y,beside_frac(x/(x+1),acc,f(x/150,y/150)));} | |
function j(y,acc){return y>=150?acc:j(y+1,stack_frac(y/(y+1),acc,i(0,y,blank)));} | |
return j(0,blank); | |
} | |
// Full source code that actually have a chance of making sense |