|
![](/i/fill.gif) |
> 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 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).
> 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.
Post a reply to this message
|
![](/i/fill.gif) |