[Radiance-general] Re: rtrace: -ospec options

Marcin Gawroński marcin.gawronski at poczta.fm
Thu Apr 24 04:24:11 PDT 2008


Hi Greg!

Thanks for leads. I tried the settings you suggested but problem still 
occured. I continued my search and I found out what was wrong: the -I 
parameter! I used -i and I get as earlier table of zeros plus one 
correct value (8829, this same value I get when I use only -ov). The 
problem is still with distance. For this zero values sometimes distance 
l equals 0 (most of rays) and sometimes it's normal value (from more or 
less 1.0005 to  1.5955). For non-zero value (8829) distance l=0.01).

I also noticed, that when I use -me parameter (the value of -me 0.2 0.2 
0.2 is not so large, I mean for test calculations, not for real media) 
Radiance counts the L(s) value using l=1.156, this is exactly average of 
  distances l for this zero values! This is quite strange to me...

Anyway, this case is solved.

Further contemplations of problem:

I started this discussion, because I want to calculate some formula. 
First I thought, that it will be possible to compute it using results 
get from rtrace (value and distance for single ray) but now I know it's 
much more complicated. In the file with results there are a lot of data 
that are finally casted away (aren't they?), so I think that operations 
on this data is not a good idea.

My new concept is to write(change?) a few additional lines to code of 
"rayparticipate" function. However I don't really understand this code... :(
I can't find where is hide this formula
L(s)=L(0)*exp(-ext*s)    (assume albedo=0)
I would like to add to formula above some value according to expression
L1(s)=L(s)+[L(0)-L(s)]*[1-exp(-ext*s)]
I want "rayparticipate" function to return me this L1(s) value instead 
of L(s). Is this possible? Could you tell me where and what I have to 
add/change in code of this function? (I attach the code below)
I also thought about write new function similar to "rayparticipate" but 
it possibly required more changes (not in raytrace.c but also in a few 
another files).

I will be very thankful for help.
Regards, Marcin


extern void
rayparticipate(            /* compute ray medium participation */
     register RAY  *r
)
{
     COLOR    ce, ca;
     double    re, ge, be;

     if (intens(r->cext) <= 1./FHUGE)
         return;                /* no medium */
     re = r->rot*colval(r->cext,RED);
     ge = r->rot*colval(r->cext,GRN);
     be = r->rot*colval(r->cext,BLU);
     if (r->crtype & SHADOW) {        /* no scattering for sources */
         re *= 1. - colval(r->albedo,RED);
         ge *= 1. - colval(r->albedo,GRN);
         be *= 1. - colval(r->albedo,BLU);
     }
     setcolor(ce,    re<=FTINY ? 1. : re>92. ? 0. : exp(-re),
             ge<=FTINY ? 1. : ge>92. ? 0. : exp(-ge),
             be<=FTINY ? 1. : be>92. ? 0. : exp(-be));
     multcolor(r->rcol, ce);            /* path extinction */
     if (r->crtype & SHADOW || intens(r->albedo) <= FTINY)
         return;                /* no scattering */
     setcolor(ca,
    	colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)),
     	colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)),
     	colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU)));
     addcolor(r->rcol, ca);            /* ambient in scattering */
     srcscatter(r);                /* source in scattering */
}


Greg Ward pisze:
> Hi Marcin,
> 
> I will try to answer your questions inline, below...
> 
>> From: Marcin Gawroński <marcin.gawronski at poczta.fm>
>> Date: March 31, 2008 3:51:46 AM PDT
>>
>> Dear Group
>>
>> I use Radiance for a few years, and I handled with different problems 
>> so far. Now I have to complicated problem and I need some help. I 
>> engage in energy transport in participating media (rtrace with 
>> parameter –me).
>>
>> As I read in ‘Rendering with Radiance’ value of expression
>> L(s) = L(0)*ext-(kappa*s)    (assume albedo omega=0)        (1)
>> is computed ‘after all the ray-surface interactions’ (page 591-592)
>>
>> Is this formula computed for each ray, and then values connected with 
>> all rays are added? (it seems to me it is) Or maybe first values for 
>> all rays are added and after expression (1) is computed?
> 
> This formula is applied for each ray.  You can read the code in 
> src/rt/raytrace.c if that helps.  Look at the "rayparticipate" function, 
> which is called from "raytrace".
> 
>> I need for my algorithm data connected with single ray: the value L(0) 
>> and distance s.
> 
> Can't you use -otvL with -me 0 0 0 in rtrace?  This will report the ray 
> length and value for the entire ray tree.
> 
>> I tried to use rtrace with some options (all parameters are presented 
>> below – file: render_h.opt):
>> - ‘-otl’ – to get the distance from origin to object (s), but I’m not 
>> sure if s = l (l – effective length of ray)
>> - ‘-otv’ – to get value of each ray traced, but I get a table of zero 
>> values (something is wrong, I don’t know what)
> 
> Only rays that are linked to tree branches that end in glow surfaces or 
> light sources will have non-zero values if -av 0 0 0 (the default) is 
> specified.  I suspect the problem in your case is that -me 0.2 0.2 0.2 
> is so large that ray paths are never short enough to yield a non-zero 
> result.
> 
>> Is this possible to compute L(0) and s (for each ray traced) using 
>> rtrace with some options at all? (I tried to analyze source codes of 
>> Radiance programs to find out it, but I’m not a programmer and it’s to 
>> complicated to me to understand it)
> 
> Try the settings above and see what happens.
> 
>> Best regards
>> Marcin Gawronski
> 
> Best,
> -Greg
> _______________________________________________
> Radiance-general mailing list
> Radiance-general at radiance-online.org
> http://www.radiance-online.org/mailman/listinfo/radiance-general
> 
> 

----------------------------------------------------------------------
Poprowadz swoj klub do zwyciestwa!
Sprawdz >>> http://link.interia.pl/f1d76




More information about the Radiance-general mailing list