Hi, I’d like to create a new material which is a slight modification of “dielectric”.
I would like to keep the original dielectric and just add a new material definition.
What are the steps required to do something like that, in high level?
It would be helpful to know what you want to modify. Depending on what you need, you could either write a cal file to modify a dielectric definition in your model, but if you really need to reinvent the dielectric wheel, you could make a new material def in the source code. I doubt that’s necessary, but anything is possible with Radiance!
I agree with Rob. It’s possible, but rarely worth the effort to add a new material. Radiance predates C++, so there is a lot of “glue code” that comes with each new type, and it ends up requiring dozens of changes here and there to various routines and supporting tools (like xform).
Basically I’d like to turn off specular reflections completely when using the “dielectric” material.
I guess I better make that selectable in order to maintain backwards compatibility…
Any ideas on how I might go about that?
Well, you can always set “-lr 0”, but that turns off reflections and bounces for every material.
If you just want to be able to control dielectrics, you can hack it so a negative index of refraction is interpreted as a flag to turn off reflections. Just a thought – much easier than adding a new material.
I think I misunderstand something…the documentation for rtrace says that -lr 0 will cause termination to be determined by Russian roulette, so how does that guarantee that no specular reflections will occur?
In any event setting it to 0 didn’t eliminate the reflections…I should mention that my dielectric is a mesh with several surfaces in it, so the ray has to go through all of those surfaces…is there an underlying assumption or limitation regarding that?
So digging into the code I found this bit in “rayrace.c” line 119:
if ((maxdepth <= 0) & (rc != **NULL** ))
I’m a bit confused as to the purpose of “maxdepth” variable. The comments say it limits the recursion depth, but it seems like it only limits the number of specular reflections, but the depth of the ray tree can be larger than “maxdepth”. Am I getting this right?
In any even I ended up simply modifying it to this:
if ((maxdepth < 0) & (rc != **NULL** ))
Which seems to work. I realise this will turn off reflections for all materials, which I’m fine with. I just wanted to make sure I’m not getting myself into any trouble by making this modification?
Yes, maxdepth only limits reflections, as these would be the cause of any infinite recursion. As long as we’re getting through a material, the assumption is that the ray will leave the scene eventually
Regarding your change, this should be safe. I altered the meaning of the -lr 0 setting at some point to mean no limit on reflections, since Russian roulette is only strictly unbiased in this case. You are just changing it back to the original interpretation.