POV-Ray : Newsgroups : povray.beta-test : Radiosity Status: Giving Up... Server Time
28 Nov 2026 02:37:17 EST (-0500)
  Radiosity Status: Giving Up... (Message 1 to 50 of 194)  
Goto Latest 50 Messages Next 50 Messages >>>
From: clipka
Subject: Radiosity Status: Giving Up...
Date: 29 Dec 2008 01:10:00
Message: <web.495868e5d925d7e26d1632140@news.povray.org>
.... no, don't panic - I'll keep working on the radiosity as such.

But I definitely give up trying to get 3.7 radiosity exactly reproduce 3.6
functionality.

I have dug through the code multiple times, discovered several discrepancies
between 3.7.beta.29 and 3.6 causing differences in output, identified several
others that didn't seem to make a change, stumbled across some old flaws I
intend to fix, and for sentimentality's sake even re-introduced one flaw that
wasn't there in 3.7 due to slight differences in the software architecture
(don't worry, I'll take it back out again :)), all to try and re-create the
same output as 3.6.

I have come to the point now that plowing through the whole code over and over
again has ceased to surface any further discrepancies. And I definitely do
*not* intend to go through *all* the POV code and revert it back to exact 3.6
functionality (and after all, maybe some modifications may actually be in there
for good already :)).

So I conclude that any residual differences must be rooted in changes to some
other parts of POV-ray code: Media, photons, area lights, multi-layered
textures - whatever.

The remaining discrepancies with the scenes I used for testing are:

- minor difference in brightness on one of the cube's corners in "cornell.pov"

- differences in brightness on the object-mapped portion of the pill containers
in "object_pattern.pov"; tests strongly indicate that these are caused by the
object-mapped texture, not the radiosity per se

- differences in brightness of various shadowed parts in "balcony.pov"; tests
were not conclusive about the true origin of the differences.

- differences in a self-made scene designed to provoke black-splotch artifacts,
probably related to differences in trace-level counting (note that the
black-splotch artifacts will be eliminated anyway)

- differences in another self-made scene (the "Claustrophobia" shot), probably
related to black-splotch artifacts and therefore of similar origin

- totally different results with a self-made, very demanding radiosity scene
which hasn't actually worked as intended with any POV version at all - again,
possibly due to differences in trace-level counting.


From what I see, none of these differences do any general harm to the picture
(except for the pill-container issus); the pictures simply look different, and
I find it hard to judge which version is more realistic. I'd usually prefer the
new output.


Aside from visual differences, the most notable ones are differences in speed.
Compared with the MegaPOV 64-bit Linux binaries, some scenes take a bit longer
with the current code, some render a bit faster. It seems that overall,
radiosity-only scenes benefit, while non-radiosity scenes all render slightly
slower, and mixed scenes are somewhat indecisive. This is all pure CPU time
though, and real-time speed benefits a lot on multicore systems.


If it was my call, I'd say let's just fix the black-splotch thing, get a few
details more towards the original Ward paper, make a new beta of it, and see
what reports come in.


Main remaining issues:

- Loading/saving of radiosity samples simply doesn't work yet

- Radiosity shots are currently not 100% reproduci... duca... um... I mean, you
can't reproduce the 100% same result on every run.


Post a reply to this message

From: Thomas de Groot
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 02:58:56
Message: <49588340@news.povray.org>
Christoph, that sounds like a very excellent idea. Now that you have done a 
thorough analysis of the radiosity situation, some testing is in order. This 
community is reputed to be very good at testing and falsifying, so go ahead 
:-)

Thomas


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 03:45:00
Message: <web.49588d7ccd9d1e756f3e4e890@news.povray.org>
"Thomas de Groot" <tDOTdegroot@interDOTnlANOTHERDOTnet> wrote:
> Christoph, that sounds like a very excellent idea. Now that you have done a
> thorough analysis of the radiosity situation, some testing is in order. This
> community is reputed to be very good at testing and falsifying, so go ahead

I would right away - but I'm not allowed to:

----------------------
1. This source file may not be re-distributed without the written permission
   of Persistence of Vision Raytracer Pty. Ltd.

[...]

3. Binaries generated from this source file by individuals for their own
   personal use may not be re-distributed without the written permission
   of Persistence of Vision Raytracer Pty. Ltd. [...]
----------------------

So I'd need a written permission to re-distribute my current experimental
version - and I don't have one yet...


Post a reply to this message

From: Thomas de Groot
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 05:02:31
Message: <4958a037$1@news.povray.org>
"clipka" <nomail@nomail> schreef in bericht 
news:web.49588d7ccd9d1e756f3e4e890@news.povray.org...
>
> I would right away - but I'm not allowed to:
>
> ----------------------
> 1. This source file may not be re-distributed without the written 
> permission
>   of Persistence of Vision Raytracer Pty. Ltd.
>
> [...]
>
> 3. Binaries generated from this source file by individuals for their own
>   personal use may not be re-distributed without the written permission
>   of Persistence of Vision Raytracer Pty. Ltd. [...]
> ----------------------
>
> So I'd need a written permission to re-distribute my current experimental
> version - and I don't have one yet...
>
>

We sit down, and wait in confidence... :-)

In my understanding, this should not be a problem to obtain as it is part of 
the overall upgrading of povray.

Have I said this? I would like to extend my sincere appreciation for the 
effort you are clearly providing towards the next stage of our all-acclaimed 
rendered: POV-Ray. Hurray!

Thomas


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 05:17:37
Message: <4958a3c1$1@news.povray.org>
Thomas de Groot wrote:
> We sit down, and wait in confidence... :-)
> 
> In my understanding, this should not be a problem to obtain as it is part of 
> the overall upgrading of povray.
> 
> Have I said this? I would like to extend my sincere appreciation for the 
> effort you are clearly providing towards the next stage of our all-acclaimed 
> rendered: POV-Ray. Hurray!

The redistribution of the beta source code is prohibited. There won't be a 
permission for anyone to distribute the beta source code or binary in any 
other form. The purpose of making the beta source code available is to get 
submissions of bug fixes that will be added to the official beta source code 
and beta binaries - assuming they work, of course ;-)

	Thorsten


Post a reply to this message

From: Warp
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 05:44:04
Message: <4958a9f3@news.povray.org>
clipka <nomail@nomail> wrote:
> If it was my call, I'd say let's just fix the black-splotch thing, get a few
> details more towards the original Ward paper, make a new beta of it, and see
> what reports come in.

  Any chances of removing the upper limit of 1600 samples? While 1600 samples
is a lot, some people have encountered the limit and complained about it.

  Unless I'm mistaken, those samples are precalculated and hard-coded into
the source. Removing the limit would probably mean that you need to calculate
new samples (above those 1600) by using a random number generator. If you do
so, the absolutely *don't* use rand() from <cstdlib>, but instead use a
high-quality fast RNG designed for stochastic sampling.

  I have made a C++ version of Bob Jenkins' ISAAC random number generator,
if you are interested. It's fast (significantly faster than rand() or the
RNG used in POV-Ray), has a humongous period, and should be of very high
quality (way higher than rand() or the RNG used in POV-Ray).

-- 
                                                          - Warp


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 06:58:56
Message: <4958bb80$1@news.povray.org>
Warp wrote:
> clipka <nomail@nomail> wrote:
>> If it was my call, I'd say let's just fix the black-splotch thing, get a few
>> details more towards the original Ward paper, make a new beta of it, and see
>> what reports come in.
> 
>   Any chances of removing the upper limit of 1600 samples? While 1600 samples
> is a lot, some people have encountered the limit and complained about it.
> 
>   Unless I'm mistaken, those samples are precalculated and hard-coded into
> the source. Removing the limit would probably mean that you need to calculate
> new samples (above those 1600) by using a random number generator.

Boost / ISO C++ 2009 STL provide suitable random number generators that 
support distribution over a hemisphere as needed by radiosity code.

	Thorsten


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 07:20:01
Message: <web.4958bfb6cd9d1e756f3e4e890@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   Any chances of removing the upper limit of 1600 samples? While 1600 samples
> is a lot, some people have encountered the limit and complained about it.

Yes, definitely a chance to do that. However...

(1) I expect quality to improve even with less samples

(2) It's not so high on my agenda as, say, saving & reloading sample data

(3) It still takes some time to develop something good. i don't like the MegaPOV
approach of user-specified sampling sequences, and actually I don't like the
whole concept of a fixed sequence anyway. There must be a smart way to
implement some adaptive algorithm. I also think it would be a good idea to flag
objects as "radiosity targets", like it is done with photons, to inform the
sampling algorithm about small but bright objects so it can shoot a few more
rays in that direction.

>   Unless I'm mistaken, those samples are precalculated and hard-coded into
> the source. Removing the limit would probably mean that you need to calculate
> new samples (above those 1600) by using a random number generator. If you do
> so, the absolutely *don't* use rand() from <cstdlib>, but instead use a
> high-quality fast RNG designed for stochastic sampling.

Naah - speed is such an important issue with this that I'd rather precompute
directions like it is done now - although not at compile time, but at scene
startup instead.

If I'd need a RNG for that, I guess I'd use whatever is commonly used in POV
already. Speed is not really an issue for that job (nor is precision).

But I guess an even distribution is actually better than a random one for this
use.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 07:35:00
Message: <web.4958c3bbcd9d1e756f3e4e890@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> Boost / ISO C++ 2009 STL provide suitable random number generators that
> support distribution over a hemisphere as needed by radiosity code.

Distribution over a hemisphere is not enough for radiosity. There needs to be a
particular bias towards the "zenith".


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 07:52:41
Message: <4958c819$1@news.povray.org>
clipka wrote:
> Thorsten Froehlich <tho### [at] trfde> wrote:
>> Boost / ISO C++ 2009 STL provide suitable random number generators that
>> support distribution over a hemisphere as needed by radiosity code.
> 
> Distribution over a hemisphere is not enough for radiosity. There needs to be a
> particular bias towards the "zenith".

For small samples sizes, yes, but for large sample sizes assigning a weight 
to samples depending on their hemisphere location gives you the same effect.

	Thorsten


Post a reply to this message

From: andrel
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 08:12:20
Message: <4958CD13.8010800@hotmail.com>
On 29-Dec-08 11:18, Thorsten Froehlich wrote:
> Thomas de Groot wrote:
>> We sit down, and wait in confidence... :-)
>>
>> In my understanding, this should not be a problem to obtain as it is 
>> part of the overall upgrading of povray.
>>
>> Have I said this? I would like to extend my sincere appreciation for 
>> the effort you are clearly providing towards the next stage of our 
>> all-acclaimed rendered: POV-Ray. Hurray!
> 
> The redistribution of the beta source code is prohibited. There won't be 
> a permission for anyone to distribute the beta source code or binary in 
> any other form. The purpose of making the beta source code available is 
> to get submissions of bug fixes that will be added to the official beta 
> source code and beta binaries - assuming they work, of course ;-)
> 

I think a relevant question here is: what is a distribution of source. 
If clipka sends the source or a binary by regular mail to e.g. Thomas is 
that distribution? or must it be publicly available to be one. If it is 
the first then collaboration to implement and test improvements of beta 
source is effectively impossible. I can think of reasons to do it that 
way. One would be that source in this beta (double beta?) stage should 
be coordinated by a POV team member. But, which one should that be? In 
this specific case of radiosity: who is coordinating that and would that 
person in this case give permission to create a test version for a 
selected group to use?

Another one: if clipka had started from the 3.16 source would that have 
made a difference?


Post a reply to this message

From: andrel
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 08:18:44
Message: <4958CE93.7050808@hotmail.com>
On 29-Dec-08 13:34, clipka wrote:
> Thorsten Froehlich <tho### [at] trfde> wrote:
>> Boost / ISO C++ 2009 STL provide suitable random number generators that
>> support distribution over a hemisphere as needed by radiosity code.
> 
> Distribution over a hemisphere is not enough for radiosity. There needs to be a
> particular bias towards the "zenith".
> 
If you know the shape of the desired distribution that should in general 
be possible.
Just curious, why should it not be evenly distributed (or should I read 
that paper)?


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 08:25:00
Message: <web.4958ceadcd9d1e756f3e4e890@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> > Distribution over a hemisphere is not enough for radiosity. There needs to be a
> > particular bias towards the "zenith".
>
> For small samples sizes, yes, but for large sample sizes assigning a weight
> to samples depending on their hemisphere location gives you the same effect.
>
>  Thorsten

Having this weight "built into" the samples still has some benefits though. It
saves you some multiplications or - if you don't pre-compute the sequence -
even some trigonometrics; better yet: You also don't waste time shooting rays
that don't contribute much.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 08:30:00
Message: <web.4958cfe4cd9d1e756f3e4e890@news.povray.org>
andrel <a_l### [at] hotmailcom> wrote:
> I think a relevant question here is: what is a distribution of source.
> If clipka sends the source or a binary by regular mail to e.g. Thomas is
> that distribution?

I bet it is.

I could send diffs though, because those portions are all my own work...

> Another one: if clipka had started from the 3.16 source would that have
> made a difference?

If it was in the current state: No; there's too much functionality missing
(compared to 3.6) in the current stuff I have, and reduced-functionality
versions may not be distributed either.


Post a reply to this message

From: Warp
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 08:38:05
Message: <4958d2bd@news.povray.org>
andrel <a_l### [at] hotmailcom> wrote:
> Just curious, why should it not be evenly distributed

  Because the diffuse illumination of a surface depends on the angle from
which the light is coming: The more perpendicular the incoming light is to
the surface, the stronger its contribution. The strength of the contribution
decreases as a function of the cosine of the angle. If the incoming light
is parallel to the light, it has zero contribution.

  You could sample evenly along the hemisphere, but then you will be taking
tons of samples which contribute only little to the illumination. (In fact,
rather ironically, if you sample evenly, the majority of the samples will
be on the parts of the hemisphere which contribute the least to the
illumination.)

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 08:42:33
Message: <4958d3c9@news.povray.org>
clipka <nomail@nomail> wrote:
> If I'd need a RNG for that, I guess I'd use whatever is commonly used in POV
> already. Speed is not really an issue for that job (nor is precision).

  It's not only a quetion of speed, but a question of quality of the
randomness. A linear congruential generator, which is what std::rand()
usually is (and what the SDL "rand()" also is), is an extremely poor
random number generator, especially for things like stochastic sampling.

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 08:45:01
Message: <web.4958d347cd9d1e756f3e4e890@news.povray.org>
andrel <a_l### [at] hotmailcom> wrote:
> Just curious, why should it not be evenly distributed (or should I read
> that paper)?

The paper explains that there should be a bias and how it should be,
mathematically - but I guess it wouldn't get you much further about the "why".

The thing is simply that incident light coming in at a shallow angle illuminates
the surface less than light coming in steeper.

This could be modeled by multiplying each sampling ray with a correctional
weight term - but it is much more elegant to model it via a non-uniform
distribution of rays, because you can concentrate precious render time on rays
that really matter - and it may also save you some mathematical operations
during the sampling.

It would be some waste of time to run your random number generator output
through some trigonometric formulae first to get a uniform distribution, and
then run those co-ordinates again through more trigonometry to get your weight
- when maybe you can simply run your RNG output through some different trig
formulae to give you just the biased distribution you need to do without a
weight term and with a better overall "computing time per weight" ratio.


Post a reply to this message

From: Thorsten Froehlich
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 08:56:33
Message: <4958d711$1@news.povray.org>
Warp wrote:
> andrel <a_l### [at] hotmailcom> wrote:
>> Just curious, why should it not be evenly distributed
> 
>   Because the diffuse illumination of a surface depends on the angle from
> which the light is coming: The more perpendicular the incoming light is to
> the surface, the stronger its contribution. The strength of the contribution
> decreases as a function of the cosine of the angle. If the incoming light
> is parallel to the light, it has zero contribution.

In theory the contribution is zero, in reality it is not though, due to the 
lack of perfectly flat surfaces. Micro-facets and a high-intensity light 
source can have surprising effects...

>   You could sample evenly along the hemisphere, but then you will be taking
> tons of samples which contribute only little to the illumination. (In fact,
> rather ironically, if you sample evenly, the majority of the samples will
> be on the parts of the hemisphere which contribute the least to the
> illumination.)

Actually, that they contribute the least is not universally correct: It is 
only correct if all contributions of light are about the same intensity 
range. Now, if one light source is significantly brighter than all other 
contributing light sources, even a small angle contribution can be brighter 
than all other contributions. -- While this may sound like a rare case, it 
actually is not: Sunlight and a 100W light bulb would be an example. This 
case is relevant in architecture.

However, the probability that small area but high intensity contributions 
are missed increases with the unevenness of the distribution (because it is 
a function of the sample density). The computational complexity can be cut 
by exploiting ray coherence (presorting samples into coherent groups is 
easiest). Of course this would actually require POV-Ray to support coherent 
ray tracing, which it does not yet do (the bounding code and SIMD 
abstraction is in Perforce though).

	Thorsten


Post a reply to this message

From: andrel
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 09:09:05
Message: <4958DA60.7050707@hotmail.com>
On 29-Dec-08 14:40, clipka wrote:
> andrel <a_l### [at] hotmailcom> wrote:
>> Just curious, why should it not be evenly distributed (or should I read
>> that paper)?
> 
> The paper explains that there should be a bias and how it should be,
> mathematically - but I guess it wouldn't get you much further about the "why".

Ok, I'll try to read it. If only I could find the link.
Could you post that again, I clicked through most of your posts here and 
I cannot find it. :(

> The thing is simply that incident light coming in at a shallow angle illuminates
> the surface less than light coming in steeper.

Ok, that would be a fixed relation that does not depend on the material 
used. I should be able to derive that myself. If only my brain would be 
not so rusty.

> This could be modeled by multiplying each sampling ray with a correctional
> weight term - but it is much more elegant to model it via a non-uniform
> distribution of rays, because you can concentrate precious render time on rays
> that really matter - and it may also save you some mathematical operations
> during the sampling.
> 
> It would be some waste of time to run your random number generator output
> through some trigonometric formulae first to get a uniform distribution, and
> then run those co-ordinates again through more trigonometry to get your weight
> - when maybe you can simply run your RNG output through some different trig
> formulae to give you just the biased distribution you need to do without a
> weight term and with a better overall "computing time per weight" ratio.

I'd be surprised if there is not already an efficient random generator 
that does that all in one go, bypassing the need for trigonometry. Maybe 
we only need the help of a resident google expert.


Post a reply to this message

From: Warp
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 09:09:30
Message: <4958da19@news.povray.org>
Thorsten Froehlich <tho### [at] trfde> wrote:
> Warp wrote:
> > andrel <a_l### [at] hotmailcom> wrote:
> >> Just curious, why should it not be evenly distributed
> > 
> >   Because the diffuse illumination of a surface depends on the angle from
> > which the light is coming: The more perpendicular the incoming light is to
> > the surface, the stronger its contribution. The strength of the contribution
> > decreases as a function of the cosine of the angle. If the incoming light
> > is parallel to the light, it has zero contribution.

> In theory the contribution is zero, in reality it is not though, due to the 
> lack of perfectly flat surfaces. Micro-facets and a high-intensity light 
> source can have surprising effects...

  But we are talking about simple diffuse lighting here... :P

> However, the probability that small area but high intensity contributions 
> are missed increases with the unevenness of the distribution (because it is 
> a function of the sample density).

  I wonder if adaptive supersampling (similar to what is used in antialiasing
method 2 and adaptive area lights) could be used in the stochastic sampling:
If the brightness of two adjacent samples differ more than a given threshold,
take an additional sample between them.

-- 
                                                          - Warp


Post a reply to this message

From: Severi Salminen
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 09:36:44
Message: <4958e07c$1@news.povray.org>
clipka wrote:
> Distribution over a hemisphere is not enough for radiosity. There needs to be a
> particular bias towards the "zenith".

Do it like I do:

1. Choose a random point on a disc. (You can do this quickly by first
choosing a random point on square and then check if it is inside a circle).
2. Project it on a hemisphere.

Voila! There you have a cosine weighted random point on a hemishpere. No
need to do the cosine weighting anymore.

That is the method I use in ssRay. With 1600+ samples they are very well
distributed with a decent PRNG. If not you can try Halton sequence or
something similar to generate a more even distribution.


Post a reply to this message

From: nemesis
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 10:00:00
Message: <web.4958e59ecd9d1e75180057960@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Thorsten Froehlich <tho### [at] trfde> wrote:
> > In theory the contribution is zero, in reality it is not though, due to the
> > lack of perfectly flat surfaces. Micro-facets and a high-intensity light
> > source can have surprising effects...
>
>   But we are talking about simple diffuse lighting here... :P

It looks anything but simple. ;)


Post a reply to this message

From: Chambers
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 10:20:06
Message: <933469AE87B242FFAE88AF199FE01C42@HomePC>
> -----Original Message-----
> From: clipka [mailto:nomail@nomail]
> Warp <war### [at] tagpovrayorg> wrote:
> >   Any chances of removing the upper limit of 1600 samples? While
1600
> samples
> > is a lot, some people have encountered the limit and complained
about
> it.
> 
> Yes, definitely a chance to do that. However...
> 
> (1) I expect quality to improve even with less samples

Just a quick note: a few quick calculations will show that 1600 samples
is not enough for things like a lightbulb across the room, or the sun in
the sky, to be effectively used for radiosity.

> implement some adaptive algorithm. I also think it would be a good
idea
> to flag
> objects as "radiosity targets", like it is done with photons, to
inform
> the
> sampling algorithm about small but bright objects so it can shoot a
few
> more
> rays in that direction.

That would be a great way to deal with what would otherwise be extremely
large sample sets.

...Ben Chambers
www.pacificwebguy.com


Post a reply to this message

From: Warp
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 12:39:58
Message: <49590b6d@news.povray.org>
Chambers <ben### [at] pacificwebguycom> wrote:
> Just a quick note: a few quick calculations will show that 1600 samples
> is not enough for things like a lightbulb across the room, or the sun in
> the sky, to be effectively used for radiosity.

  OTOH, why not make the lightbulb or the sun a light source?

  I don't really understand people's obsession in making radiosity-only
scenes. Radiosity calculates diffuse lighting only. If you use only radiosity
to calculate the lighting of the scene, the entire scene will consist of
purely diffusely lighted surfaces. There will be no specular component.

  When a surface is purely diffuse, without any specular component to it,
it's like a 100% matte surface, with no reflective component. There will
be no highlights caused by light sources, which will make all surfaces
matte and dull.

  It's the specular component of lighting which makes surfaces look vivid,
lively and brilliant, which make them have that "sparky" look. Purely matte
surfaces are flat and dull.

-- 
                                                          - Warp


Post a reply to this message

From: nemesis
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 15:30:01
Message: <web.49593282cd9d1e75180057960@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Chambers <ben### [at] pacificwebguycom> wrote:
> > Just a quick note: a few quick calculations will show that 1600 samples
> > is not enough for things like a lightbulb across the room, or the sun in
> > the sky, to be effectively used for radiosity.
>
>   OTOH, why not make the lightbulb or the sun a light source?
>
>   I don't really understand people's obsession in making radiosity-only
> scenes. Radiosity calculates diffuse lighting only. If you use only radiosity
> to calculate the lighting of the scene, the entire scene will consist of
> purely diffusely lighted surfaces. There will be no specular component.
>
>   When a surface is purely diffuse, without any specular component to it,
> it's like a 100% matte surface, with no reflective component. There will
> be no highlights caused by light sources, which will make all surfaces
> matte and dull.
>
>   It's the specular component of lighting which makes surfaces look vivid,
> lively and brilliant, which make them have that "sparky" look. Purely matte
> surfaces are flat and dull.

Indeed.  But specular is itself a fake, a rough shortcut to the real deal:
specular is really diffuse reflection on very smooth surfaces.  Those
highlights also did not match the shape of the light sources -- at least until
you corrected that, for area lights at least -- and also why they look funky
from almost tangent angles...

I've seen people advocating the use of (glossy) reflection to more realistically
achieve that effect.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 17:05:00
Message: <web.4959496bcd9d1e75ab169ede0@news.povray.org>
andrel <a_l### [at] hotmailcom> wrote:
> Ok, I'll try to read it. If only I could find the link.
> Could you post that again, I clicked through most of your posts here and
> I cannot find it. :(

No surprise - I never posted a link to it ;)

I don't remember where I got my copy from. I just googled it up ("A Ray Tracing
Solution for Diffuse Interreflection" and "Gregory J. Ward" should do fine); I
found a few pages that looked like they would have charged for access to the
document, but there's also a PDF out there with the text (alas not the
diagrams), and a series of TIFFs from a scanned-in copy (including the
diagrams).

> I'd be surprised if there is not already an efficient random generator
> that does that all in one go, bypassing the need for trigonometry. Maybe
> we only need the help of a resident google expert.

I don't think so.

Generating good pseudo-random number sequences is an art by itself, even without
specific target distributions, so at the core will most always be an algorithm
generating uniformly distributed scalar (i.e. 1-D) numbers.

The desired distribution is usually achieved through some smart (non-linear)
transformation of the generated numbers (which in our case would involve
trigonometrics I guess, or at least squares and roots). See POV-ray's random
numbers include file (don't recall the exact name right now) for examples.

Alternatively, it can be done through Monte-Carlo integration, i.e. pulling some
random number from a uniform-distribution RNG, computing the desired probability
for that particular value, and according to this probability randomly discard
the pulled number (by comparing the probability against another
uniformly-distributed random number), doing the whole process over and over
again if necessary. However, you'll usually try to avoid this, as it may become
quite slow depending on your desired distribution, and you'll inevitably end up
with unpredictable execution times. (The POV random numbers include file
implements this for example to generate a random number inside an object.)

So even though there are RNG's out there that do produce particular
distributions, I reckon they'll typically be just wrappers around a
uniform-distribution RNG for your convenience, so that you don't have to come
up with all the math yourselves (which may be a hassle because it involves
integrals), so in the end your CPU will still need to do trigonometrics.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 17:10:00
Message: <web.49594a2bcd9d1e75ab169ede0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   I wonder if adaptive supersampling (similar to what is used in antialiasing
> method 2 and adaptive area lights) could be used in the stochastic sampling:
> If the brightness of two adjacent samples differ more than a given threshold,
> take an additional sample between them.

Shame on you! Still haven't read the paper yet, have you? :)

The original paper by Greg Ward et al. explicitly mentions the possibility of
using an adaptive approach. And I actually think about implementing it. Not
this year though, I guess :)


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 17:30:01
Message: <web.49594f41cd9d1e75ab169ede0@news.povray.org>
Severi Salminen <sev### [at] NOTTHISsaunalahtifiinvalid> wrote:
> 1. Choose a random point on a disc. (You can do this quickly by first
> choosing a random point on square and then check if it is inside a circle).
> 2. Project it on a hemisphere.
>
> Voila! There you have a cosine weighted random point on a hemishpere. No
> need to do the cosine weighting anymore.

.... aside from the fact that what you describe *is* cosine weighting (unless
your approach would be wrong, that is) :)

Thinking about it (didn't check the math behind it yet), it's not all that bad:

- take two random numbers [-1..1] (well, ]-1..1] should do as well)
- compare sum of squares against 1.0
- repeat if necessary

doesn't sound too bad (however, performance should be compared with taking two
random numbers and transforming them to circle distribution using trigonometry
instead of the monte-carlo approach).

Projecting onto a sphere (I guess you're talking about a parallel projection
along the surface normal) just needs to take the sum of squares we already
have, subtract it from 1, and take the square root as additional co-ordinate.

So yes, that should do: A loop typically taking less than two iterations (the
most expensive part probably being the RNG) and a square root. Quite
inexpensive after all.

So it's definitely less expensive than going via a uniform distribution on a
sphere in any case. Don't know whether that can be achieved without
trigonometry, and at least it will involve a root somewhere as well - plus the
math to get either a cosine weighting or a cosine weighted distribution.


Thanks, this helped me a lot - mostly because it also provides a good basis of
how to properly do adaptive supersampling in a cosine-weighted world.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 17:45:01
Message: <web.49595273cd9d1e75ab169ede0@news.povray.org>
"Chambers" <ben### [at] pacificwebguycom> wrote:
> Just a quick note: a few quick calculations will show that 1600 samples
> is not enough for things like a lightbulb across the room, or the sun in
> the sky, to be effectively used for radiosity.

I feared there would be some catch :}

> > implement some adaptive algorithm. I also think it would be a good
> idea
> > to flag
> > objects as "radiosity targets", like it is done with photons, to
> inform
> > the
> > sampling algorithm about small but bright objects so it can shoot a
> few
> > more
> > rays in that direction.
>
> That would be a great way to deal with what would otherwise be extremely
> large sample sets.

That's why I'm thinking about it :)

Another idea I had was to do such flagging automatically. Say we do the first
samples with a very high sample count. We use some techniques borrowed from
adaptive sampling (though we're not actually going adaptive yet), and if some
close sample rays detect a high gradient (either in color or distance) the area
is somehow marked as "hot".

An area getting less than a certain threshold of "hot" markers will get less
attention during subsequent passes, while areas getting particularly high
numbers of "hot" markers will get increased attention.

However, I'm not sure yet about how to store this type of information,
especially since the perception of what area is "hot" will gradually change
from point to point. Maybe some information attached to each sample, and any
new sample will first check whether there are any samples nearby that know
something about hotspots already.

Just a bunch of wild ideas at the moment.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 17:50:01
Message: <web.4959538bcd9d1e75ab169ede0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   I don't really understand people's obsession in making radiosity-only
> scenes. Radiosity calculates diffuse lighting only. If you use only radiosity
> to calculate the lighting of the scene, the entire scene will consist of
> purely diffusely lighted surfaces. There will be no specular component.

That's where the HDRI and reflections with micronormals come into play :)

Honestly, this combination really rocks. Your classic specular highlights are
nothing compared to what you can get out of this combo.

Takes some rendering time though.


Post a reply to this message

From: Severi Salminen
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 17:53:55
Message: <49595503$1@news.povray.org>
> .... aside from the fact that what you describe *is* cosine weighting (unless
> your approach would be wrong, that is) :)

Yea, I just meant that now we don't have to take the cosine factor into
account anymore when figuring radiance (or whatever) contribution as the
ray distribution handles it by itself. Both give the exact same result.

> doesn't sound too bad (however, performance should be compared with taking two
> random numbers and transforming them to circle distribution using trigonometry
> instead of the monte-carlo approach).

In my Monte-Carlo path tracing renderer the above method was faster than
those using polar coordinates (random phi and theta describing the
angles). It was very clearly faster. I have Core2Duo so things might be
different on other platforms / with other compilers. I use GCC.

Severi


Post a reply to this message

From: Warp
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 17:58:24
Message: <49595610@news.povray.org>
clipka <nomail@nomail> wrote:
> So yes, that should do: A loop typically taking less than two iterations (the
> most expensive part probably being the RNG) and a square root. Quite
> inexpensive after all.

  When you project the point to the hemisphere, you'll probably need three
multiplications and a square root. That's going to be much more expensive
than the RNG. (High-quality RNGs are very fast. They are faster than a LCG,
which consists of one integer multiplication and addition.)

> So it's definitely less expensive than going via a uniform distribution on a
> sphere in any case. Don't know whether that can be achieved without
> trigonometry, and at least it will involve a root somewhere as well - plus the
> math to get either a cosine weighting or a cosine weighted distribution.

  The whole idea of the given algorithm (ie. get a random point evenly
distributed on a disc and then parallel-project it to a hemisphere
correspondent to that disc) is that you don't need any trigonometry
anymore, and the points will be automatically distributed on the
hemisphere according to the cosine function. (Square root of multiplications
is equivalent to sin/cos.)

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:00:00
Message: <web.495955e2cd9d1e75ab169ede0@news.povray.org>
"nemesis" <nam### [at] gmailcom> wrote:
> Indeed.  But specular is itself a fake, a rough shortcut to the real deal:
> specular is really diffuse reflection on very smooth surfaces.

If I may correct you: They are in fact *specular* reflections on a comparatively
*rough* surface...

> I've seen people advocating the use of (glossy) reflection to more realistically
> achieve that effect.

.... which is why that advocated approach works to very good effect.

The idea is simple: Make all light sources actually visible. Make all your
surfaces somewhat reflective, and rough them up using a "bump" normal, scaled
to dimensions much smaller than two adjacent pixels on screen. Render the
thing, making sure Antialiasing or focal blur take many samples per pixel.
Voila: Blurred highlights done just the same way as mother nature does.

Works great with HDR light probes for sky or backdrop.

Takes a lot of samples though to get flat and comparatively rough surfaces to
look good, so be prepared for overnight renders.


Post a reply to this message

From: Severi Salminen
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:19:29
Message: <49595b01$1@news.povray.org>
And this is the code I use:


    double x,y,z;

    do{
        x = 2.0 * rNG.randomNumberClosed() - 1.0;
        z = 2.0 * rNG.randomNumberClosed() - 1.0;
    }
    while(x*x + z*z > 1.0);

    y = sqrt(1.0 - (x*x + z*z));


There you have it: a random vector inside a hemishere.


Post a reply to this message

From: Severi Salminen
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:19:53
Message: <49595b19$1@news.povray.org>
Severi Salminen wrote:

> There you have it: a random vector inside a hemishere.

With cosine weighting...


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:20:00
Message: <web.495959f6cd9d1e75ab169ede0@news.povray.org>
Severi Salminen <sev### [at] NOTTHISsaunalahtifiinvalid> wrote:
> In my Monte-Carlo path tracing renderer the above method was faster than
> those using polar coordinates (random phi and theta describing the
> angles).

How did you pick phi and theta? Did you pick uniform random numbers and map them
using straightforward functions (needs trigonometry I guess), or did you
monte-carlo them as well?

> It was very clearly faster.

I'd actually expect so, but you never know until you test it :)

> I have Core2Duo so things might be
> different on other platforms / with other compilers. I use GCC.

Don't think so. Not significantly at least.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:25:00
Message: <web.49595b64cd9d1e75ab169ede0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>
>   The whole idea of the given algorithm (ie. get a random point evenly
> distributed on a disc and then parallel-project it to a hemisphere
> correspondent to that disc) is that you don't need any trigonometry
> anymore, and the points will be automatically distributed on the
> hemisphere according to the cosine function. (Square root of multiplications
> is equivalent to sin/cos.)

Yeah, I know that. That's all the point I'm trying to make. Well, except that I
wasn't aware that it even gets you rid of any trigonometrics at all.


Post a reply to this message

From: Warp
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:25:49
Message: <49595c7d@news.povray.org>
Severi Salminen <sev### [at] notthissaunalahtifiinvalid> wrote:
> And this is the code I use:


>     double x,y,z;

>     do{
>         x = 2.0 * rNG.randomNumberClosed() - 1.0;
>         z = 2.0 * rNG.randomNumberClosed() - 1.0;
>     }
>     while(x*x + z*z > 1.0);

>     y = sqrt(1.0 - (x*x + z*z));


> There you have it: a random vector inside a hemishere.

  You still have to rotate it so that the hemisphere is tangential to
the surface. Probably requires multiplication with a matrix.

-- 
                                                          - Warp


Post a reply to this message

From: Warp
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:27:41
Message: <49595ced@news.povray.org>
clipka <nomail@nomail> wrote:
> The idea is simple: Make all light sources actually visible. Make all your
> surfaces somewhat reflective, and rough them up using a "bump" normal, scaled
> to dimensions much smaller than two adjacent pixels on screen. Render the
> thing, making sure Antialiasing or focal blur take many samples per pixel.
> Voila: Blurred highlights done just the same way as mother nature does.

> Works great with HDR light probes for sky or backdrop.

> Takes a lot of samples though to get flat and comparatively rough surfaces to
> look good, so be prepared for overnight renders.

  Not very feasible with very complex scenes which may have other
slow-to-render elements, unless you have a couple of years to wait for
the render to finish.

-- 
                                                          - Warp


Post a reply to this message

From: Severi Salminen
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:28:12
Message: <49595d0c$1@news.povray.org>
>   You still have to rotate it so that the hemisphere is tangential to
> the surface. Probably requires multiplication with a matrix.
> 

Yes, it has to be transformed properly. Transformation matrix is a
common way to do it.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:45:00
Message: <web.49595ff0cd9d1e75ab169ede0@news.povray.org>
Severi Salminen <sev### [at] NOTTHISsaunalahtifiinvalid> wrote:
>
>     double x,y,z;
>
>     do{
>         x = 2.0 * rNG.randomNumberClosed() - 1.0;
>         z = 2.0 * rNG.randomNumberClosed() - 1.0;
>     }
>     while(x*x + z*z > 1.0);
>
>     y = sqrt(1.0 - (x*x + z*z));

This can be optimized to:

    double x,y,z,rSquare;

    do{
        x = 2.0 * rNG.randomNumberClosed() - 1.0;
        z = 2.0 * rNG.randomNumberClosed() - 1.0;
        rSquare = x*x + z*z;
    }
    while(rSquare > 1.0);

    y = sqrt(1.0 - rSquare);

Or maybe this is even a bit faster (and actually a tiny bit more defensively
coded):

    double x,y,z,ySquare;

    do{
        x = 2.0 * rNG.randomNumberClosed() - 1.0;
        z = 2.0 * rNG.randomNumberClosed() - 1.0;
        ySquare = 1.0 - (x*x + z*z);
    }
    while(ySquare < 0.0);

    y = sqrt(ySquare);

(I guess comparing two floats is roughly as expensive as computing their
difference; at least this is the case for integers; and comparing a float with
zero is a piece of cake.)

I also fancy that it would be favorable from a performance point of view to pull
*signed* floats in the range of [-1..1] directly out of the random stream,
because it would just be a matter of filling in one more random bit (namely the
sign bit). It would double the chance of getting a zero, but we can probably
invest some of the time saved by the elimination of a multiplication and
subtraction to filter out negative-zero values (which would occur once in 2^24
rolls for single-precision floats).

But that's probably a RNG design thing.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:45:01
Message: <web.4959607dcd9d1e75ab169ede0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>   You still have to rotate it so that the hemisphere is tangential to
> the surface. Probably requires multiplication with a matrix.

POV uses two cross-product operations for that.


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 18:50:00
Message: <web.495961b4cd9d1e75ab169ede0@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> > Takes a lot of samples though to get flat and comparatively rough surfaces to
> > look good, so be prepared for overnight renders.
>
>   Not very feasible with very complex scenes which may have other
> slow-to-render elements, unless you have a couple of years to wait for
> the render to finish.

It gets less dramatic if your other slow-to-render elements can be boiled down
to jitter as well; e.g. for media effects, you can crank down the quality and
rely on a lot of jitter, too.

You'll admittedly run into problems when your slow-to-render elements are
geometric shapes, like isosurfaces for instance.


Post a reply to this message

From: Alain
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 21:11:29
Message: <49598351$1@news.povray.org>
clipka nous illumina en ce 2008-12-29 01:06 -->
> .... no, don't panic - I'll keep working on the radiosity as such.
> 
> But I definitely give up trying to get 3.7 radiosity exactly reproduce 3.6
> functionality.
> 
> I have dug through the code multiple times, discovered several discrepancies
> between 3.7.beta.29 and 3.6 causing differences in output, identified several
> others that didn't seem to make a change, stumbled across some old flaws I
> intend to fix, and for sentimentality's sake even re-introduced one flaw that
> wasn't there in 3.7 due to slight differences in the software architecture
> (don't worry, I'll take it back out again :)), all to try and re-create the
> same output as 3.6.
> 
> I have come to the point now that plowing through the whole code over and over
> again has ceased to surface any further discrepancies. And I definitely do
> *not* intend to go through *all* the POV code and revert it back to exact 3.6
> functionality (and after all, maybe some modifications may actually be in there
> for good already :)).
> 
> So I conclude that any residual differences must be rooted in changes to some
> other parts of POV-ray code: Media, photons, area lights, multi-layered
> textures - whatever.
> 
> The remaining discrepancies with the scenes I used for testing are:
> 
> - minor difference in brightness on one of the cube's corners in "cornell.pov"
> 
> - differences in brightness on the object-mapped portion of the pill containers
> in "object_pattern.pov"; tests strongly indicate that these are caused by the
> object-mapped texture, not the radiosity per se
> 
> - differences in brightness of various shadowed parts in "balcony.pov"; tests
> were not conclusive about the true origin of the differences.
> 
> - differences in a self-made scene designed to provoke black-splotch artifacts,
> probably related to differences in trace-level counting (note that the
> black-splotch artifacts will be eliminated anyway)
> 
> - differences in another self-made scene (the "Claustrophobia" shot), probably
> related to black-splotch artifacts and therefore of similar origin
> 
> - totally different results with a self-made, very demanding radiosity scene
> which hasn't actually worked as intended with any POV version at all - again,
> possibly due to differences in trace-level counting.
> 
> 
> From what I see, none of these differences do any general harm to the picture
> (except for the pill-container issus); the pictures simply look different, and
> I find it hard to judge which version is more realistic. I'd usually prefer the
> new output.
> 
> 
> Aside from visual differences, the most notable ones are differences in speed.
> Compared with the MegaPOV 64-bit Linux binaries, some scenes take a bit longer
> with the current code, some render a bit faster. It seems that overall,
> radiosity-only scenes benefit, while non-radiosity scenes all render slightly
> slower, and mixed scenes are somewhat indecisive. This is all pure CPU time
> though, and real-time speed benefits a lot on multicore systems.
> 
> 
> If it was my call, I'd say let's just fix the black-splotch thing, get a few
> details more towards the original Ward paper, make a new beta of it, and see
> what reports come in.
> 
> 
> Main remaining issues:
> 
> - Loading/saving of radiosity samples simply doesn't work yet
> 
> - Radiosity shots are currently not 100% reproduci... duca... um... I mean, you
> can't reproduce the 100% same result on every run.
> 
> 
> 
 From version 3.6 for any radiosity scene: (also for photons)
"Cleanup Parse Warning: This rendering uses the following experimental 
feature(s): radiosity. The desing and implementation of these features is likely 
to change in future version of POV-Ray. Full backward compatibility with the 
current implementation is NOT guarenteed."

This tells me that, in future versions, the way to handle radiosity may change.

This also tels me that the result may change from version to version, even if 
the parameters do stay the same.

So, after seeing that warning, if any scene using radiosity, or photons, don't 
give the same final image between 3.6 end 3.7, i'd say that it's NORMAL and 
EXPECTED.

-- 
Alain
-------------------------------------------------
You know you've been raytracing too long when you have ever said "I don't need 
no steenking modellers!!!"
Stephan Ahonen


Post a reply to this message

From: clipka
Subject: Re: Radiosity Status: Giving Up...
Date: 29 Dec 2008 23:25:00
Message: <web.4959a241cd9d1e75ab169ede0@news.povray.org>
Alain <ele### [at] netscapenet> wrote:
>  From version 3.6 for any radiosity scene: (also for photons)
> "Cleanup Parse Warning: This rendering uses the following experimental
> feature(s): radiosity. The desing and implementation of these features is likely
> to change in future version of POV-Ray. Full backward compatibility with the
> current implementation is NOT guarenteed."
>
> This tells me that, in future versions, the way to handle radiosity may change.
>
> This also tels me that the result may change from version to version, even if
> the parameters do stay the same.
>
> So, after seeing that warning, if any scene using radiosity, or photons, don't
> give the same final image between 3.6 end 3.7, i'd say that it's NORMAL and
> EXPECTED.

Basically yes - that's why I give up on trying to get 3.7 exactly the same.

However, differences may also be an indicator that something is broken, so
getting 3.7 to behave almost exactly like 3.6 would have given confidence that
the code is "not more broken than 3.6" - meaning that anything damaged in the
transition from C to C++ would have been repaired.


Post a reply to this message

From: SharkD
Subject: Re: Radiosity Status: Giving Up...
Date: 30 Dec 2008 00:19:04
Message: <4959af48@news.povray.org>
clipka wrote:
> andrel <a_l### [at] hotmailcom> wrote:
>> I think a relevant question here is: what is a distribution of source.
>> If clipka sends the source or a binary by regular mail to e.g. Thomas is
>> that distribution?
> 
> I bet it is.
> 
> I could send diffs though, because those portions are all my own work...
> 
>> Another one: if clipka had started from the 3.16 source would that have
>> made a difference?
> 
> If it was in the current state: No; there's too much functionality missing
> (compared to 3.6) in the current stuff I have, and reduced-functionality
> versions may not be distributed either.
> 
> 
> 

Except that diffs contain itty-bitty bits of the source files in them.

:)

-Mike


Post a reply to this message

From: Thomas de Groot
Subject: Re: Radiosity Status: Giving Up...
Date: 30 Dec 2008 03:00:06
Message: <4959d506$1@news.povray.org>
"andrel" <a_l### [at] hotmailcom> schreef in bericht 
news:495### [at] hotmailcom...
>>
>> The redistribution of the beta source code is prohibited. There won't be 
>> a permission for anyone to distribute the beta source code or binary in 
>> any other form. The purpose of making the beta source code available is 
>> to get submissions of bug fixes that will be added to the official beta 
>> source code and beta binaries - assuming they work, of course ;-)
>>
>
> I think a relevant question here is: what is a distribution of source. If 
> clipka sends the source or a binary by regular mail to e.g. Thomas is that 
> distribution? or must it be publicly available to be one. If it is the 
> first then collaboration to implement and test improvements of beta source 
> is effectively impossible. I can think of reasons to do it that way. One 
> would be that source in this beta (double beta?) stage should be 
> coordinated by a POV team member. But, which one should that be? In this 
> specific case of radiosity: who is coordinating that and would that person 
> in this case give permission to create a test version for a selected group 
> to use?
>
> Another one: if clipka had started from the 3.16 source would that have 
> made a difference?


Right. The Real World is tougher than I imagined (and rightly so, I suppose) 
:-)

We need a creative solution to solve this conundrum, because it would be too 
absurde if, for legal reasons, improvement testing of beta elements could 
not procede one way or another. I suppose that the best way to go would be 
to implement Clipka's work in some beta, have it tested and reported back by 
the community. Following which, decisions can be made about further 
implementation or trashing.

My world view is simple, I know, but we have to start somewhere.

Thomas


Post a reply to this message

From: andrel
Subject: Re: Radiosity Status: Giving Up...
Date: 30 Dec 2008 05:36:17
Message: <4959FA01.8010405@hotmail.com>
On 29-Dec-08 23:58, Warp wrote:
> clipka <nomail@nomail> wrote:
>> So yes, that should do: A loop typically taking less than two iterations (the
>> most expensive part probably being the RNG) and a square root. Quite
>> inexpensive after all.
> 
>   When you project the point to the hemisphere, you'll probably need three
> multiplications and a square root. That's going to be much more expensive
> than the RNG. (High-quality RNGs are very fast. They are faster than a LCG,
> which consists of one integer multiplication and addition.)

but sin and cos are (much?) more costly than sqrt and multiplication is 
comparatively negligible.


Post a reply to this message

From: Warp
Subject: Re: Radiosity Status: Giving Up...
Date: 30 Dec 2008 07:00:35
Message: <495a0d63@news.povray.org>
andrel <a_l### [at] hotmailcom> wrote:
> On 29-Dec-08 23:58, Warp wrote:
> > clipka <nomail@nomail> wrote:
> >> So yes, that should do: A loop typically taking less than two iterations (the
> >> most expensive part probably being the RNG) and a square root. Quite
> >> inexpensive after all.
> > 
> >   When you project the point to the hemisphere, you'll probably need three
> > multiplications and a square root. That's going to be much more expensive
> > than the RNG. (High-quality RNGs are very fast. They are faster than a LCG,
> > which consists of one integer multiplication and addition.)

> but sin and cos are (much?) more costly than sqrt and multiplication is 
> comparatively negligible.

  I was commenting to his estimation that the RNG would be the most
expensive part of the calculation. Certainly not true. I would estimate
that one single sqrt() call will be several times slower than pulling a
value from a high-quality RNG.

-- 
                                                          - Warp


Post a reply to this message

From: Daniel Nilsson
Subject: Re: Radiosity Status: Giving Up...
Date: 30 Dec 2008 10:44:52
Message: <495a41f4$1@news.povray.org>
clipka wrote:
> Severi Salminen <sev### [at] NOTTHISsaunalahtifiinvalid> wrote:
>>     double x,y,z;
>>
>>     do{
>>         x = 2.0 * rNG.randomNumberClosed() - 1.0;
>>         z = 2.0 * rNG.randomNumberClosed() - 1.0;
>>     }
>>     while(x*x + z*z > 1.0);
>>
>>     y = sqrt(1.0 - (x*x + z*z));
> 
> This can be optimized to:
> 
>     double x,y,z,rSquare;
> 
>     do{
>         x = 2.0 * rNG.randomNumberClosed() - 1.0;
>         z = 2.0 * rNG.randomNumberClosed() - 1.0;
>         rSquare = x*x + z*z;
>     }
>     while(rSquare > 1.0);
> 
>     y = sqrt(1.0 - rSquare);
> 
> Or maybe this is even a bit faster (and actually a tiny bit more defensively
> coded):
> 
>     double x,y,z,ySquare;
> 
>     do{
>         x = 2.0 * rNG.randomNumberClosed() - 1.0;
>         z = 2.0 * rNG.randomNumberClosed() - 1.0;
>         ySquare = 1.0 - (x*x + z*z);
>     }
>     while(ySquare < 0.0);
> 
>     y = sqrt(ySquare);
> 

No need to optimize the code, that's the job of the compiler. Any modern 
compiler will notice the common subexpressions and optimize them. I just 
did a small test with all three versions above compiled with "gcc -S 
-O2" (gcc 4.1.2 on x86_64 linux). The produced assembly is virtually 
identical for all three cases, the last one actually has the most 
instructions generated (extra moves mostly).
The thing to learn from this, and it's my experience from work too, is 
that you should write code that is easy to read and maintain rather than 
try to be clever with optimizations.

When I'm on the subject of optimization I like to mention that profile 
based optimizations can boost the performance of povray quite a bit. 
Look at the -fprofile-generate and -fprofile-use options to gcc.

Sorry for going a bit off-topic. I'll go back to lurking now. I'm 
following the development of the radiosity code with excitement. Keep up 
the good work.

Oh, and happy new year!

-- 
Daniel Nilsson


Post a reply to this message

Goto Latest 50 Messages Next 50 Messages >>>

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