|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | http://www.kevinbeason.com/smallpt/
Cute. Hard to read, but cute. :-)
-- 
Darren New, San Diego CA, USA (PST)
   Forget "focus follows mouse." When do
   I get "focus follows gaze"?
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | Darren New wrote:
> http://www.kevinbeason.com/smallpt/
> 
> Cute. Hard to read, but cute. :-)
yes.  I wonder how it'd look like in Haskell. ;)
It was also the basis for SmallptGPU:
http://davibu.interfree.it/opencl/smallptgpu/smallptGPU.html
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | nemesis wrote:
> It was also the basis for SmallptGPU:
Hey, I have an idea. Has anyone ever considered porting POV-Ray to the GPU? 
I bet it would be a lot faster.
-- 
Darren New, San Diego CA, USA (PST)
   Forget "focus follows mouse." When do
   I get "focus follows gaze"?
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  | 
| From: Stephen Subject: Re: 99 lines of C++ for an unbiased ray tracer
 Date: 14 Jan 2010 01:31:42
 Message: <4b4eba4e@news.povray.org>
 
 |  |  | 
|  |  | 
|  |  | 
|  |  | Darren New wrote:
> nemesis wrote:
>> It was also the basis for SmallptGPU:
> 
> Hey, I have an idea. Has anyone ever considered porting POV-Ray to the 
> GPU? I bet it would be a lot faster.
> 
Nice one! What a good idea. ;)
-- 
Best Regards,
	Stephen
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  | 
| From: Sabrina Kilian Subject: Re: 99 lines of C++ for an unbiased ray tracer
 Date: 14 Jan 2010 01:34:47
 Message: <4b4ebb07$1@news.povray.org>
 
 |  |  | 
|  |  | 
|  |  | 
|  |  | Stephen wrote:
> Darren New wrote:
>> nemesis wrote:
>>> It was also the basis for SmallptGPU:
>>
>> Hey, I have an idea. Has anyone ever considered porting POV-Ray to the
>> GPU? I bet it would be a lot faster.
>>
> 
> Nice one! What a good idea. ;)
> 
Hey, I bet it couldn't take more than a few minutes to move all the code
that direction. I mean, it can't be too much larger than 99 lines of code.
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | Sabrina Kilian wrote:
> Stephen wrote:
>> Darren New wrote:
>>> nemesis wrote:
>>>> It was also the basis for SmallptGPU:
>>> Hey, I have an idea. Has anyone ever considered porting POV-Ray to the
>>> GPU? I bet it would be a lot faster.
>>>
>> Nice one! What a good idea. ;)
>>
> 
> Hey, I bet it couldn't take more than a few minutes to move all the code
> that direction. I mean, it can't be too much larger than 99 lines of code.
Not being a coder myself I will have to take your word on that. I’m sure 
Chris could do it standing on his head or at least upside down ;)
-- 
Best Regards,
	Stephen
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | nemesis wrote:
> yes.  I wonder how it'd look like in Haskell. ;)
In any language, I suspect the answer will depend on:
- Which libraries are you allowed to use? [Get a ray tracing library and 
the program surely becomes trivial...]
- How fast does it have to be? [A highly-efficient program is likely to 
be a lot bigger than a program written specifically to demonstrate how 
terse you can be.]
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  | 
|  |  | 
|  |  | Darren New wrote:
> Cute. Hard to read, but cute. :-)
Wait... THE WALLS ARE GIANT SPHERES?! o_O
Well that's *one* way to cut down the code size... No ray/plane 
intersection test to code.
44:  double n=sizeof(spheres)/sizeof(Sphere);
Well... that's... one way to figure out how big an array is. :-.
Evidently my C++ is weak, but... how is
53:  Vec nl=n.dot(r.d)<0?n:n*-1;
different from "nl = -abs(n.dot(r.d))"?
Also, where THE HELL is "Xi" defined? I can see it *used* in several 
places, but I can't find a definitions.
Line 79 means each row of pixels is computed in parallel, right?
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  | 
| From: scott Subject: Re: 99 lines of C++ for an unbiased ray tracer
 Date: 14 Jan 2010 06:00:34
 Message: <4b4ef952@news.povray.org>
 
 |  |  | 
|  |  | 
|  |  | 
|  |  | > 53:  Vec nl=n.dot(r.d)<0?n:n*-1;
> 
> different from "nl = -abs(n.dot(r.d))"?
a?b:c evaluates to b if a is true, or c otherwise.
> Also, where THE HELL is "Xi" defined? I can see it *used* in several 
> places, but I can't find a definitions.
Line 82, after the x=0 definition.
> Line 79 means each row of pixels is computed in parallel, right?
I guess so.
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  | 
| From: Invisible Subject: Re: 99 lines of C++ for an unbiased ray tracer
 Date: 14 Jan 2010 06:07:30
 Message: <4b4efaf2@news.povray.org>
 
 |  |  | 
|  |  | 
|  |  | 
|  |  | >> 53:  Vec nl=n.dot(r.d)<0?n:n*-1;
>>
>> different from "nl = -abs(n.dot(r.d))"?
> 
> a?b:c evaluates to b if a is true, or c otherwise.
Ah, wait, I misread that as calculating something, assigning it to n, 
and then checking whether n is negative and if not negating it. On 
closer inspection, that's not what this does...
>> Also, where THE HELL is "Xi" defined? I can see it *used* in several 
>> places, but I can't find a definitions.
> 
> Line 82, after the x=0 definition.
Wait - you can define MORE THAN ONE variable in a loop initialisation??
 Post a reply to this message
 |  | 
|  |  | 
|  |  | 
|  |  |  |  | 
|  |  |