## Made a single hit cook torrence raytracer

A picture is worth a thousand words.
rouncer
Posts: 18
Joined: Wed Jun 19, 2013 11:04 am

### Made a single hit cook torrence raytracer

Getting organic surfaces with a cook torrence bounce... its on the books to add multibounce by recursing the procedure, but itll be alot slower.
Interesting things that make my framework different->

a) I render to a binary dithering map, and then i reduce it to the screens resolution.
b) I only use a low colour and a high colour, then the midrange develops as the dots join.
c) i then use add and multiply and clamp, segregated channels, to get my finished 'illumination'

my ior is 1.3 the consistency of cotton wool.

this lecture spills the beans on how to get these 'charactered' surfaces.

note i dont understand the lecture that well, i just plug and played the code, its only 5 lines long blew my mind.

and the demo->

my current weapon is a gtx980. 64x32 stream processors.

rouncer
Posts: 18
Joined: Wed Jun 19, 2013 11:04 am

### Re: Made a single hit cook torrence raytracer

Ill give myself a deadline for a miniature finished product on thursday, 11th feb, and ill give an executable, and the source for people to play with,
its very small, its one file only 711 lines so far, including all the comments and spaces and my newbie indents.

it has a fixed function material section that fits on the screen, its very simple.

The environment making process, is meshless volumetric functions, of course, i use a binary honing technique plus a feedback system to keep the occlusions when it finds them.
But it needs alot of improvement if i want to see volume functions in general. (which mathematicians would love. especially when they are all furry lookin hehe)

The scripter system will use fxc.exe as a commandline system call. from the program, which it communicates to, to update the scene. which actually has to recompile the entire
kernel to fit the new level in, because its a function call from the binary honing kernel, and it does take about 5 seconds to compile on my computer, because direct compute is a slow girly compiler, but its suited me, I cant be bothered learning cuda optimizations, im not so lowlevel with conventional hardware. (but i have crazy hardware ideas of my own regularly as well.)

The crazy stuff you see in the demo, are all little stretch variations of a common theme, some glitched bilinear filtering (which must be coded in yourself! or you can just borrow mine.)
and waves of harmonics on top of this.

//geometry function->

Code: Select all



//this has the bilinear filter in it.
int compute_altitude( int walkpos_x, int walkpos_z, int rpy)
{
int alt=-rpy-22100;
int k;
int idx,idy;
int w0,w1;

int h=96;

for(k=0;k<h;k+=16)
{

int nhh[4];
int nhv[4];

int k2=k;
if(k2>3) k2=0;

#define HG >>8)*(k+1))
#define NM  3

{
{
nhh[2]=abs(((Bufferui4[(0)+((0)<<NM)].amp)HG;
nhh[3]=abs(((Bufferui4[(0)+((0)<<NM)].amp)HG;
nhv[3]=abs(((Bufferui4[(0)+((0)<<NM)].amp)HG;
}
else
{
}
}
else
{
{
}
else
{
}
}

w0=idx;
w1=idy;

if(w0>1<<8 || w0<0
|| w1>1<<8 || w1<0)
{
int bp=1;
}

//bilinear average->
+((((nhh[2]*(255-w0))+(nhh[3]*(w0)))/255*(w1))))/255;
+((((nhv[2]*(255-w0))+(nhv[3]*(w0)))/255*(w0))))/255;

}

return alt;
}



material bar done. i just have a few things to fix then the demo will go here.
I worked out how to get the powderyish surface, and its roughness as close as possible to 0, and gauss as high as you can get it, and you get the fat material.

heres a little microworld thing i did with it, with silver snail trails ->