POV-Ray : Newsgroups : povray.off-topic : The Raysnail - WIP, a probability based raytracer with (limited) support for PovRay SDL files Server Time
23 Nov 2024 11:19:59 EST (-0500)
  The Raysnail - WIP, a probability based raytracer with (limited) support for PovRay SDL files (Message 1 to 10 of 15)  
Goto Latest 10 Messages Next 5 Messages >>>
From: Hj  Malthaner
Subject: The Raysnail - WIP, a probability based raytracer with (limited) support for PovRay SDL files
Date: 17 Jul 2024 12:07:12
Message: <6697ec30$1@news.povray.org>
I've been using PovRay for many years, and I want to say I'm very happy 
about the 3.8 release. Thanks a lot for that!

Something though that I had been missing in PovRay is what is known as 
global illumination or path based lighting. Radiosity, supported by 
PovRay, is very similar, but not quite the same.

First I've been looking into PovRay's sources to see if I can add such a 
feature. But at the time I knew too little about both, PovRay coding and 
the math behind path based lighting. So I put that idea to rest.

Recently I found a series of lectures, starting with "Raytracing in one 
Weekend". It came with example code simple enough for me to understand. 
But the real stunning point was, the third series of lectures was just 
about what I had been looking for -  Monte Carlo integration of incoming 
light and path based lighting (unidirectional). Aptly named "The rest of 
your life."

Since some months I'm trying to learn Rust, and found that someone had 
translated the example code (C++) from the first two lecture seasons to 
Rust. So I tried to get my brain working once more and implement the 
features of the third lecture season by myself. Much headache, I'm bad 
at this sort of math, but it works now. Some examples are here:

https://github.com/Varkalandar/raysnail/wiki/Raysnail-Render-Examples

Now I had an Raytracer with the desired feature, admittedly a very 
simple one. But I also had a lot of PovRay scene files which I had 
written over more than a decade. I wanted to continue using these, or at 
least continue in a similar manner.

And that's why I am posting here, it could be of interest for you. I've 
started to implement a parser for PovRay scene files. It can't parse 
much yet, but there are no technical limits on that level, it just takes 
time to expand the parser. PovRay SDL is huge.

Here is an example file that the parser can read right now:
https://github.com/Varkalandar/raysnail/blob/e248884b4eb38f1d0f0dab8bca592c05516a5dde/sdl/example.sdl

The Raysnail will render this result from it:
https://private-user-images.githubusercontent.com/62077919/349234580-362117c3-13d9-44ce-a770-0a04d76021f3.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjEyMzE0NzQsIm5iZiI6MTcyMTIzMTE3NCwicGF0aCI6Ii82MjA3NzkxOS8zNDkyMzQ1ODAtMzYyMTE3YzMtMTNkOS00NGNlLWE3NzAtMGEwNGQ3NjAyMWYzLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MTclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzE3VDE1NDYxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTIwMmZlY2VmNTc5NzA3NTExMDQ4NWRiZDM4OWUzY2E5NWQ5YmMzOTlmZjk5NmVjZGU2ZjNhNDZiMGEzYzJmNzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.M5Dyb6tp2I3chY8uO2nfikF-8xV2n4akmlvWGeV0dmQ

If the link doesn't work, please go here and scroll to the bottom of the 
page, the image is included in the examples:
https://github.com/Varkalandar/raysnail/wiki/Raysnail-Render-Examples

So far so good ... but there are also many issues. One is, that I don't 
think I can emulate PovRay materials one to one. I can emulate a lot, 
but there will be differences, based in the different approaches that 
PovRay and the Raysnail implement to handle materials.

Other problems are that typical lights in PovRay are point lights, 
infinitely small and invisible. The Raysnail needs lights with a certain 
size to work. I likely can emulate PovRay lights by having really tiny 
lights in the Raysnail, but they will still be visible as bright dots.

Long message. In short, I have a raytracer in the works. I am trying to 
support PovRay scene files as good as I can. If you are interested in 
this project, or have any sort of feedback, please let me know.

The code is here, not really cleaned up, but well, it's what I have:
https://github.com/Varkalandar/raysnail

Thank you for reading.


Post a reply to this message

From: jr
Subject: Re: The Raysnail - WIP, a probability based raytracer with (limited) suppor=
Date: 17 Jul 2024 12:30:00
Message: <web.6697f09911aab5a3c7a7971d6cde94f1@news.povray.org>
hi,

"Hj. Malthaner" <me@home> wrote:
> I've been using PovRay for many years, and I want to say I'm very happy
> about the 3.8 release. Thanks a lot for that!
>
> Something though that I had been missing in PovRay is what is known as
> global illumination or path based lighting. Radiosity, supported by
> PovRay, is very similar, but not quite the same.
> ...
> Long message. In short, I have a raytracer in the works. I am trying to
> support PovRay scene files as good as I can. If you are interested in
> this project, or have any sort of feedback, please let me know.

without having looked at code etc (I haven't the maths, anyway), a new feature
to complement the existing radiosity stuff sounds v cool.  and, as there are
(rumoured) developments beyond v3.8, your idea/code may well find its way into
the "next generation" POV-Ray.  _thank_you_.


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: The Raysnail - WIP, a probability based raytracer with (limited) suppor=
Date: 17 Jul 2024 13:20:00
Message: <web.6697fc4611aab5a3327467e125979125@news.povray.org>
You, Sir, are a legend.
And what timing!

jr, put this man "on the list"!

HJ, please take a look at these and see if they help any:

https://news.povray.org/povray.advanced-users/thread/%3Cweb.6369a6d45447eee1f9dae3025979125%40news.povray.org%3E/

https://news.povray.org/povray.advanced-users/thread/%3Cweb.636eec0e210cb4a81f9dae3025979125%40news.povray.org%3E/

I hope you'll have some time to document your discoveries about coding your
raytracer and BRDF model(s), but especially the parser part.  There are several
of us here that are intensely interested in all of that.


(Also, this seems an opportune time to recall a scene that several of us
remember, but none of us can find again:  someone wrote an SDL file to render a
keyword-colored SDL file (text {} objects), and sort of had to write their own
parser in the process.  I hope someday that someone will be able to find that
again.)

- BW


Post a reply to this message

From: Bald Eagle
Subject: Re: The Raysnail - WIP, a probability based raytracer with (limited) suppor=
Date: 17 Jul 2024 14:25:00
Message: <web.66980c5d11aab5a3327467e125979125@news.povray.org>
"Hj. Malthaner" <me@home> wrote:
> I've
> started to implement a parser for PovRay scene files. It can't parse
> much yet, but there are no technical limits on that level, it just takes
> time to expand the parser. PovRay SDL is huge.

I found this while on break:

http://disq.us/url?url=http%3A%2F%2Fkeepcalmandlearnrust.com%2F2016%2F08%2Fpratt-parser-in-rust%2F%3AVTzJuXKy2d8-o-HOB-
QkF3yoZ-s&cuid=968811


Post a reply to this message

From: Hj  Malthaner
Subject: Re: The Raysnail - WIP, a probability based raytracer with (limited) suppor=
Date: 17 Jul 2024 14:38:48
Message: <66980fb8@news.povray.org>
On 7/17/24 19:15, Bald Eagle wrote:

 > I hope you'll have some time to document your discoveries about 
coding > your
 > raytracer and BRDF model(s), but especially the parser part.

The BRDFs are still making my head spin. I understand the concept, but 
struggle with the actual math to come up with proper BRDFs for new 
materials of my own. So, let me point you to the source instead, the 
lectures that I had been using myself:

https://raytracing.github.io/

The third book is about importance sampling and Monte Carlo integration. 
It has probability density functions and also scattering functions for 
the most important materials, like a diffuse reflecting material, a 
specular reflecting material (metal/mirror) and a material which both 
reflects and refracts (glass/transparent material).

If you want to look at some code, this developer also has made a 
raytracer based on above mentioned lectures and added additional materials,

https://github.com/miguelggcc/QBVH-Rust-Ray-Tracer

Of particular interest will be the Blinn-Phong material and the 
Ashikhmin-Shirley material:

https://github.com/miguelggcc/QBVH-Rust-Ray-Tracer/blob/master/src/material.rs

In regard to the parser, I want to say thanks to the people who wrote 
the PovRay documentation. Each SDL element is documented with a snippet 
of a grammar, which can be converted almost one to one into a recursive 
descend parser. So the documentation is already there. I'll try to keep 
the identifiers used in the parser code close to the ones used the 
documented grammar, so the code will look familiar to those who looked 
at the grammar from the documentation before.

I think the real need for documentation will come once I try to support 
macros and similar advanced SDL features.

To be fair though, my code needs more comments in general.

Luckily github supports having a Wiki for a project, so there is a place 
to write down discoveries, pitfalls to avoid and interesting solutions.

 > There are several
 > of us here that are intensely interested in all of that.

I was under the impression it could be of interest :)

PovRay has a great legacy, and one of the features that really set it 
apart for me was the SDL. This, together with all the mathematically 
exact objects, as opposed to approximation by polygon meshes as most 
other raytracers do.


Post a reply to this message

From: Bald Eagle
Subject: Re: The Raysnail - WIP, a probability based raytracer with (limited) suppor=
Date: 17 Jul 2024 15:10:00
Message: <web.6698169e1c222f09327467e125979125@news.povray.org>
"Hj. Malthaner" <me@home> wrote:

> The BRDFs are still making my head spin. I understand the concept, but
> struggle with the actual math to come up with proper BRDFs for new
> materials of my own.

Diagrams are definitely your friend.
Drawing the diagram with POV-Ray using the math that you're trying to work out
is also an excellent exercise.

I also found this video extremely useful

https://www.youtube.com/watch?v=gsZiJeaMO48

> In regard to the parser, I want to say thanks to the people who wrote
> the PovRay documentation. Each SDL element is documented with a snippet
> of a grammar, which can be converted almost one to one into a recursive
> descend parser. So the documentation is already there. I'll try to keep
> the identifiers used in the parser code close to the ones used the
> documented grammar, so the code will look familiar to those who looked
> at the grammar from the documentation before.

Maybe before you get too far into that, take a look at:
https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/


Post a reply to this message

From: Bill Pragnell
Subject: Re: The Raysnail - WIP, a probability based raytracer with (limited) suppor=
Date: 18 Jul 2024 09:40:00
Message: <web.66991ad111aab5a3f642b0d6f35e431@news.povray.org>
"Hj. Malthaner" <me@home> wrote:
> Something though that I had been missing in PovRay is what is known as
> global illumination or path based lighting. Radiosity, supported by
> PovRay, is very similar, but not quite the same.

Are you aware of the UberPOV fork?

https://github.com/UberPOV/UberPOV

It's based on POV-Ray 3.7 and hasn't really seen any development for some time,
but one of its notable features is stochastic global illumination as an
extension to radiosity. I still use it quite often because I think it produces
much better results than the standard radiosity with almost no tweaking
required.

Maybe there's something there of interest relevant to your project!

Bill


Post a reply to this message

From: Hj  Malthaner
Subject: Re: The Raysnail - WIP, a probability based raytracer with (limited) suppor=
Date: 18 Jul 2024 10:32:53
Message: <66992795$1@news.povray.org>
On 7/18/24 15:38, Bill Pragnell wrote:

> Are you aware of the UberPOV fork?
> 
> https://github.com/UberPOV/UberPOV

Now I am. Well, I had heard of UberPOV before but never really looked 
into it ...

> It's based on POV-Ray 3.7 and hasn't really seen any development for some time,
> but one of its notable features is stochastic global illumination as an
> extension to radiosity. I still use it quite often because I think it produces
> much better results than the standard radiosity with almost no tweaking
> required.

That matches my own impression and why I wanted something with global 
illumination while still supporting PovRay SDL. This is quite 
interesting, thank you for the link!


Post a reply to this message

From: Hj  Malthaner
Subject: Re: The Raysnail - WIP, a probability based raytracer with (limited) suppor=
Date: 18 Jul 2024 10:38:47
Message: <669928f7$1@news.povray.org>
On 7/17/24 21:08, Bald Eagle wrote:
> "Hj. Malthaner" <me@home> wrote:
> 
>> In regard to the parser,
> 
> Maybe before you get too far into that, take a look at:
>
https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/

Interesting, I had not heard of PRATT parsers before.

I think I'll stick with a recursive descent parser though, because it's 
a more widely known approach, even if the code is less compact.

The structure of a recursive descent parser resembles the grammar quite 
closely which a benefit too, I think, with the grammar being of the docs 
already.


Post a reply to this message

From: Hj  Malthaner
Subject: Re: The Raysnail - WIP, a probability based raytracer with (limited) suppor=
Date: 18 Jul 2024 10:39:45
Message: <66992931$1@news.povray.org>
On 7/17/24 21:08, Bald Eagle wrote:

> I also found this video extremely useful
> 
> https://www.youtube.com/watch?v=gsZiJeaMO48

I haven't watched it all yet, but it indeed seems interesting. Thank you 
for sharing the link!


Post a reply to this message

Goto Latest 10 Messages Next 5 Messages >>>

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