POV-Ray : Newsgroups : povray.off-topic : WebGL : Re: WebGL Server Time
27 Jul 2024 22:23:51 EDT (-0400)
  Re: WebGL  
From: Orchid Win7 v1
Date: 9 Jun 2016 13:53:43
Message: <5759ad27$1@news.povray.org>
On 09/06/2016 08:11 AM, scott wrote:
>> After about an hour of squinting at the sparse ShaderToy documentation
>> and making some educated guesses, I did eventually manage to build a
>> trivial ray-tracer that runs in real-time.
>
> Come on, make it public and post the link then for all to see :-)

I'm sure you've all seen a white sphere with some coloured lights. :-P

> I had a bit more of a think about how you might do a lens simulation.
> You start by firing the ray from a random point within the pixel on the
> sensor, and fire it at a random point on the surface of the first lens
> element. Then follow that ray through the lenses (assume no reflection
> for speed here), if it gets too far from the lens axis then return
> black, otherwise once it gets out of the end of the lenses and into the
> scene do the raytrace as normal.
>
> With the above you should be able to move about individual lens elements
> in almost real time (it might take a second or two to smooth out the
> noise).

That sounds quite complex. (In particular, it seems to require me to 
actually design a real lens assembly, and implement real refraction.)

I was thinking more along the lines of a camera entity that fires rays 
in a pattern that matches a theoretical ideal lens. But I need to figure 
out the equations for that first...

>> I have no idea how to do
>> random number generation yet, but we'll see...
>
> Yes that is tricky, but I'm sure you've already looked at other shaders
> there to see how they do it. Something involving the sine of the
> coordinates multiplied by some huge value IIRC.

Yeah, not just a random number per pixel, but *multiple* random numbers! 
Multiple, statistically-independent numbers... This is not trivial.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.