[Radiance-general] diffuse transmission of BRTDfunc

Greg Ward gregoryjward at gmail.com
Thu Aug 6 09:09:35 PDT 2015


Hi Jan,

I'm glad this resolved most of your issues. 

Regarding arguments past A10, these variables were provided as a convenience in rayinit.cal as shorthand for arg(N), so to get "A11" just use arg(11), instead.

Cheers,
-Greg

> From: Jan Wienold <jan.wienold at epfl.ch>
> Subject: Re: [Radiance-general] diffuse transmission of BRTDfunc
> Date: August 6, 2015 5:14:11 AM PDT
> 
> Hi Greg,
> 
> many, many thanks!! that helped a lot and solved mostly my problem! My material is now behaving more or less how I want it to :-) .
> 
> In fact the main problem was, that the function for the direct-diffuse must be a vector function, which I didn't realize before :-[ .
> After some tests I realized as well, that this function doesn't distinguish between transmission and reflection per se, but with some simple dot-products in the cal-file between the rays and the surface normal I can distinguish this as well.
> 
> A small remaining question is how to specify additional parameters to be "transferred" to the function in the cal file. If I specify the A10 (within the description of BRTFfunc) , I can access A10 from the cal file as well. In case I specify a "A11" or "A12" or more, I can't access them (error message "rtrace: A11`testfunc: undefined variable"), although I specified them in the BRTDfunc description. Of course I can hard-code these properties in the cal file, but it would be nicer if I can specify it in the material descriptions.
> And: A10 is not used per se by BRTDfunc, or? So at least I can use this one. But I would have 3 other parameters to be submitted to the functions.
> 
> thank you so much!
> 
> Jan
> 
> 
> Am 8/6/15 um 12:51 AM schrieb Greg Ward:
>> Hi Jan,
>> 
>> Are you thinking that the "directional diffuse" component as described in the reference manual refers to light that transfers from direct sources to the diffuse hemisphere?  I suppose this is confusing terminology, and it is something adopted from the computer graphics community rather than the lighting simulation community, but "directional diffuse" refers to reflections and transmission that is neither specular nor Lambertian, but somewhere in between.  As such, it does not refer to how the light arrived at the surface, only what happens to it afterwards.
>> 
>> If you want to treat the Lambertian and specular portions differently, use the separate functions provided in the BRTDfunc type.  The first three variables specify the amount of light reflected in the mirror direction, and the next three specify the amount of light transmitted in the "through" direction.  These are ordinary variables, and may be defined as such in your .cal file, e.g.:
>> 
>> { Mirror reflection color as a function of ray parameters }
>> refl_red = 0.25*RdotP;
>> refl_grn = 0.3*RdotP;
>> refl_blu = 0.31*RdotP;
>> { Direct transmission color as a function of ray parameters -- I am just making these up as examples }
>> trans_red = 0.1/(1+RdotP);
>> trans_grn = 0.2/(1+RdotP);
>> trans_blu = 0.15/(1+RdotP);
>> 
>> Note that we have no information about the incoming light direction for the specular values.  The assumption is that light behaves the same whether it comes from a source or from somewhere else.
>> 
>> For the directional diffuse, we do provide the incident direction, which would be the light source by virtue of how this primitive is evaluated.  This is only provided so you can create a full BSDF function if you like, which needs incident & scattered vectors.  You can name these functions as you like, but they should take at least 3 arguments:
>> 
>> { Example directional-diffuse component, again just making this up }
>> soft_red(ix,iy,iz) = 0.2/PI*abs(ix*Dx+iy*Dy+iz*Dz);
>> soft_grn(ix,iy,iz) = 0.1/PI*abs(ix*Dx+iy*Dy+iz*Dz);
>> soft_blu(ix,iy,iz) = 0.5/PI*abs(ix*Dx+iy*Dy+iz*Dz);
>> 
>> For these functions, the incident source direction is given as the 3 parameters, which are normalized and directed away from the surface.  The standard variables (Dx,Dy,Dz) tell you the normalized direction vector pointed towards the surface.  You would put the above definitions into a file "testingBRTDf.cal" and specify:
>> 
>> void BRTDfunc testing
>> 10
>> 	refl_red refl_grn refl_blu
>> 	trans_red trans_grn trans_blu
>> 	soft_red soft_grn soft_blu
>> 	testingBRTDf.cal
>> 0
>> 9
>> 	0	0	0
>> 	0	0	0
>> 	0	0	0
>> 
>> -----
>> I have chosen to have zero diffuse components added, to give you full control over the diffuse portion in your .cal file.
>> 
>> I hope this helps!
>> -Greg
>> 
>>> From: Jan Wienold <jan.wienold at epfl.ch>
>>> Subject: Re: [Radiance-general] diffuse transmission of BRTDfunc
>>> Date: August 5, 2015 10:41:42 AM PDT
>>> 
>>> Hi Greg,
>>> 
>>> hmm, I have to admit I'm still not clear...
>>> 
>>> In general I think a pattern does not work in my case, since I want to apply a different behavior of the direct-direct and the direct-diffuse transmission, both depending on the angle of incidence of the incoming ray(from the light source). E.g. I want to decrease the direct-direct transmission for a more flat angle of incidence whereas I want to increase at the same time the direct-diffuse transmission. In other words: I want to  control the direct and the diffuse transmission separately  via a function file depended of the light incidence (if possible).
>>> I thought to control the direct-diffuse transmission is possible by using functions for "rbrtd gbrtd bbrtd" and/or "rtdif gtdif btdif " . 
>>> 
>>> Also, honestly, the difference between those two parameters are not completely clear to me:
>>> "The functions rbrtd, gbrtd and bbrtd take the direction to the incident light (and its solid angle) and compute the color coefficients for the directional diffuse part of reflection and transmission." 
>>> and " The diffuse transmittance (must be the same for both sides by physical law) is given by rtdif, gtdif and btdif. "
>>> 
>>> Which one of them I have to use if I wanna change the diffuse behavior? And how? Any function name I used to replace rtdif or rbrtd seem to be impossible, regardless if this function is in the cal-file or even a standard function or name. 
>>> 
>>> So to reduce it to two simple questions:
>>> -In case I have defined a function for the direct-diffuse transmission in a functionfile, how can I apply it in BRTDfunc?
>>> -How can I access in that function file (called by BRTDfunc) to the direction to the incident light? According to rayinit.cal, Dx,Dy,Dz is only available for the prism materials, or? 
>>> 
>>> Thank you very  much!
>>> 
>>> best,
>>> 
>>> Jan
>>> 
>>> 
>>> Am 8/5/15 um 6:47 PM schrieb Greg Ward:
>>>> Hello Jan,
>>>> 
>>>> I suppose this behavior is rather confusing.  Firstly, the reason that "0.1" does not complain whereas ".1" does is because the program stops looking past "0", which it assumes means exactly zero.  This is a special case for specifying that you have no directional diffuse component, since these string arguments are usually used to give the name of a function of three or four parameters.
>>>> 
>>>> In any case, there is no need to specify constant values for the directional diffuse component (other than zero) because that would turn them into a diffuse component, which is already provided in the first six real arguments for this type.  These things are explained as best I can in the materials section of the Radiance reference manual, which I assume you are using:
>>>> 
>>>> 	http://radsite.lbl.gov/radiance/refer/ray.html
>>>> 
>>>> To get a pattern to modify your BRTDfunc, why not use the standard mechanism in Radiance and give it a pattern modifier?  This will modify the diffuse transmission value as well, but perhaps that's OK in your situation.  If not, then you can define a directional diffuse component that ignores the given scattered direction and uses instead the surface position (or whatever) to modify its value in the function file.
>>>> 
>>>> I'm not sure I've explained this well, so please follow up with any questions you have.
>>>> 
>>>> Best,
>>>> -Greg
>>>> 
>>>>> From: Jan Wienold <jan.wienold at epfl.ch>
>>>>> Subject: [Radiance-general] diffuse transmission of BRTDfunc
>>>>> Date: August 5, 2015 2:11:39 AM PDT
>>>>> 
>>>>> Hi all,
>>>>> 
>>>>> I'm a bit stuck by the use of the "old-fashioned" BRTDfunc. Maybe it is a silly question, but I couldn't find anything about this in the discussions so far.
>>>>> 
>>>>> What I want to do is to modify the diffuse transmitted light by a function and using the material BRTDfunc. For the specular transmission and reflection this works pretty well, a function can be defined in a user specified function in a cal file.
>>>>> But if I try to do this for the diffuse component, it immediately fails. In addition (or maybe the same issue) the is a problem in parsing. If I specify for "rbrtd gbrtd bbrtd" and "rtdif gtdif btdif " 0.1 0.1 0.1, the function works properly. But using .1 instead 0.1 it fails as well.
>>>>> It always says "undefined function" in both cases.
>>>>> Any idea?
>>>>> if it is possible to change the diffuse behavior, how would it be possible? And how can I access the angle to the light source? Rdot is giving me only the angle of incidence from the incoming ray to the surface normal, but not between light source and surface normal.
>>>>> below a simple example.
>>>>> thanks a lot
>>>>> 
>>>>> Jan
>>>>> 
>>>>> example of BRTDfunc working properly:
>>>>> 
>>>>> void BRTDfunc testmat
>>>>> 10 0 0 0
>>>>> dirtrans dirtrans dirtrans
>>>>> 0.1 0.1 0.1
>>>>> testfunc.cal
>>>>> 0
>>>>> 9 0.2 0.2 0.2
>>>>> 0.2 0.2 0.2
>>>>> 0.1 0.1 0.1
>>>>> 
>>>>> and testfunc.cal is (for all cases)
>>>>> 
>>>>> {test functionfile}
>>>>> dirtrans=0.25*Rdot*Rdot;
>>>>> diftrans=0.3*sqrt(Rdot*Rdot);
>>>>> 
>>>>> example of BRTDfunc NOT working:
>>>>> 
>>>>> void BRTDfunc testmat
>>>>> 10 0 0 0
>>>>> dirtrans dirtrans dirtrans
>>>>> .1 .1 .1
>>>>> testfunc.cal
>>>>> 0
>>>>> 9 0.2 0.2 0.2
>>>>> 0.2 0.2 0.2
>>>>> .1 .1 .1
>>>>> 
>>>>> or also not working:
>>>>> 
>>>>> void BRTDfunc testmat
>>>>> 10 0 0 0
>>>>> dirtrans dirtrans dirtrans
>>>>> diftrans diftrans diftrans
>>>>> testfunc.cal
>>>>> 0
>>>>> 9 0.2 0.2 0.2
>>>>> 0.2 0.2 0.2
>>>>> diftrans diftrans diftrans
>>>>> 
>>>>> -- 
>>>>> Dr.-Ing.  Jan Wienold
>>>>> Ecole Polytechnique Fédérale de Lausanne (EPFL)
>>>>> EPFL ENAC IA LIPID
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.radiance-online.org/pipermail/radiance-general/attachments/20150806/afe295c2/attachment-0001.html>


More information about the Radiance-general mailing list