[Radiance-general] artifact while rendering glass in tmesh solved?

Greg Ward gregoryjward at gmail.com
Thu Feb 2 19:34:26 PST 2012


Hi Iebele,

Just so this answer doesn't get lost like Francesco's, I'm taking us back online to discuss this.  Thanks for sharing your model and results.

The problem occurs because of a hack I introduced into the glass material type, about which I had completely forgotten.  It was my answer to the question, "Should a texture applied to an infinitely thin layer of glass perturb transmitted rays?"  I decided it should, because in most cases, a texture is applied to introduce some effect to the surface.  

The problem here is that the texture is being applied to correct the effects of triangulation, thus smoothing rather than roughening the surface.  Without a texture, the transmitted component would be unaffected, but the reflected component would show your model's tessellation.  There are three possible solutions.

The first possible solution is to give your car windows real thickness and use a dielectric material rather than glass.  You would need to be careful that your surface normals were directed outwards for the outer layer and inwards for the inner layer.

The second possible solution is to turn off surface normal smooth just for the window layer.  This will as I said show up the tessellation of your reflections, but it would fix the transmission.

The third possible solution is to re-hack the source file rt/glass.c.  At line 114, simplify:

			if (!(r->crtype & SHADOW) && hastexture) {
				VSUM(p.rdir, r->rdir, r->pert, 2.*(1.-rindex));
				if (normalize(p.rdir) == 0.0) {
					objerror(m, WARNING, "bad perturbation");
					VCOPY(p.rdir, r->rdir);
				}
			} else {
				VCOPY(p.rdir, r->rdir);
				transtest = 2;
			}

to read:

			VCOPY(p.rdir, r->rdir);
			transtest = 2;

This should fix the problem without having to change your model.  Of course, the problem will come back the next time you update Radiance, unless folks convince me that my hack was ill-conceived to begin with.  I'm open to the possibility.

Cheers,
-Greg

> From: Iebele Abel <iabel at iebele.nl>
> Date: February 2, 2012 11:38:28 AM PST
> 
> Hi group,
> 
> Can the artifact which occurs when rendering glass in a tmesh
> (obj2tmesh) be solved? This artifact has already been described in the
> following thread, but it does't seems to be followed up by an answer.
> Any help would be appreciated.
> 
> http://www.radiance-online.org/pipermail/radiance-general/2005-June/002777.html
> 
> Thanks,
> 
> Iebele



More information about the Radiance-general mailing list