[Radiance-general] Turning off specular reflections in rtrace

Greg Ward gregoryjward at gmail.com
Fri Jan 11 12:09:02 PST 2019


Yeah, I looked at the code and the -st 1 trick only works for plastic, metal and trans surfaces with non-zero roughness.  It doesn't work for glass or dielectric or perfectly smooth materials.  So, sorry about that.

If you want your -lr 0 trick to work, you can try this one-line change to raytrace.c like so:

*** raytrace.c	5 Dec 2018 02:12:23 -0000	2.74
--- raytrace.c	11 Jan 2019 20:08:05 -0000
***************
*** 116,122 ****
  		if (photonMapping && rt != TRANS)
  			return(-1);
  	}
! 	if (maxdepth <= 0 && rc != NULL) {	/* Russian roulette */
  		if (minweight <= 0.0)
  			error(USER, "zero ray weight in Russian roulette");
  		if (maxdepth < 0 && r->rlvl > -maxdepth)
--- 116,122 ----
  		if (photonMapping && rt != TRANS)
  			return(-1);
  	}
! 	if (maxdepth < 0 && rc != NULL) {	/* Russian roulette */
  		if (minweight <= 0.0)
  			error(USER, "zero ray weight in Russian roulette");
  		if (maxdepth < 0 && r->rlvl > -maxdepth)


> From: Jon Sargent <j.a.sargent at gmail.com>
> Date: January 11, 2019 11:10:21 AM PST
> 
> Thanks Greg,
> 
> -st 1 sounds like the trick I need, but I can't seem to get the specular bounces to go away.  For example, if I shoot a ray (0 0 1 0 0 -1) down at a piece of glass,
> 
> void glass myglass 0 0 3 .5 .5 .5
> myglass polygon srf
> 0
> 0
> 12
>     -1 -1 0
>     1 -1 0
>     1 1 0
>     -1 1 0
> void glow myglow 0 0 4 1 1 1 0
> myglow source ground 0 0 4 0 0 -1 180
> myglow source sky 0 0 4 0 0 1 180
> 
> a reflection ray bounces back, even with -st >= 1.  E.g., rtrace -oTsdV -ab 0 -st 1 gives:
> 
> 	ground	0.000000e+000	0.000000e+000	-1.000000e+000	4.585344e-001	4.585344e-001	4.585344e-001	
> 	sky	0.000000e+000	0.000000e+000	1.000000e+000	5.234219e-002	5.234219e-002	5.234219e-002	
> srf	0.000000e+000	0.000000e+000	-1.000000e+000	5.108765e-001	5.108765e-001	5.108765e-001
> 
> I see the same thing for a specular plastic BTW. Any other settings I need to tweak?
> 
> The purpose is an annual calculation, where the direct-direct contribution is removed from the daylight coefficients and replaced by a more accurate calculation.  Indeed, I can write a version of the scene with the specular properties removed (as Andy does in 5-phase), but the scene materials need to maintain their transmissive properties, so something like glass requires a work-around.  Maybe that's the only tricky one ... I was just trying to see if I could rtrace-settings my way out of writing special handlers for all the transmissive types. :)
> 
> Cheers,
> 
> Jon
> 
> 
> On Fri, Jan 11, 2019 at 8:44 AM Greg Ward <gregoryjward at gmail.com> wrote:
> Hi Jon,
> 
> It may seem counter-intuitive, but you can set the specular threshold (-st) to 1.0 or even higher and that should prevent specular reflections from being followed during rendering.  It won't be the same as not having that component at all, since the specular component for each surface (whatever it is) will be lumped in with the diffuse, instead.  Also, you will still see specularities from light sources.  The only way to turn that off is to have only glow sources in your scene.
> 
> Of course, we also provide C code with Radiance, which you are welcome to hack.  It's designed to give physically accurate results, but you can rewrite it to do whatever you like.  An easier fix is to have a set of materials that matches the original ones but without the specular component.
> 
> It might help to know the purpose of this exercise....
> 
> Cheers,
> -Greg
> 
>> From: Jon Sargent <j.a.sargent at gmail.com>
>> Date: January 11, 2019 8:27:38 AM PST
>> 
>> Does anyone have a trick for turning off specular reflections in rtrace?  It would be extremely helpful if there were a setting like -lr 0 that set the reflection limit to zero (rather than no limit).
>> 
>> -Jon
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.radiance-online.org/pipermail/radiance-general/attachments/20190111/cb7678d7/attachment.html>


More information about the Radiance-general mailing list