artifact while rendering glass in tmesh solved?

Hi Iebele,

The thread with Francesco was discussed off-line. It had to do with the way Blender and Python were outputting surface normals. Are you using Blender to create your model? Perhaps the problem persists.

The obj2mesh program is supposed to handle odd vertex normals and correct them if they disagree with the surface orientation or whatnot. I can't say what's going on in your case without getting an example file from you and spending some time on it.

Cheers,
-Greg

···

From: Iebele Abel <[email protected]>
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

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 <[email protected]>
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

Hi Greg,

Thanks for digging into this problem. The model I send you was just a
try to see how tessellated nurbs would behave when rendering in
Radiance using HDR skies. The actual project is simulating the
behavior of biological cells exposed to strong mental attention. I
have no geometry of that at this stage, it (the nurbs) should be
generated in an automated way. That's quite a task on its own, so in
my case the easiest way will probably be to re-hack glass.c. Since I
use osx I haven't used the source distribution for a while, but that
should not be a problem. Many thanks for your quick and detailed
reply. I'll keep you updated,

Cheers,
Iebele

···

2012/2/3 Greg Ward <[email protected]>:

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\-&gt;crtype &amp; SHADOW\) &amp;&amp; hastexture\) \{
                           VSUM\(p\.rdir, r\-&gt;rdir, r\-&gt;pert, 2\.\*\(1\.\-rindex\)\);
                           if \(normalize\(p\.rdir\) == 0\.0\) \{
                                   objerror\(m, WARNING, &quot;bad perturbation&quot;\);
                                   VCOPY\(p\.rdir, r\-&gt;rdir\);
                           \}
                   \} else \{
                           VCOPY\(p\.rdir, r\-&gt;rdir\);
                           transtest = 2;
                   \}

to read:

                   VCOPY\(p\.rdir, r\-&gt;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 <[email protected]>
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

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Hi Greg,

Changing the file rt/glass.c as you described below fixed the artifact.
Again, thanks a lot for your help.

But now suppose I would not have changed rt/glass.c Your remark that a
texture applied to an infinitely thin layer of glass should perturb
transmitted rays (and in effect an applied texture will smooth the
triangulation) did me think of using a BRTD material instead of glass.
Maybe it is a stupid thought, but would it be possible to model glass using
BRTD in such way that the transmitted component remains unaffected while
the reflected component is smoothed by a texture?

My best,

Iebele

···

2012/2/3 Greg Ward <[email protected]>:
> 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 <[email protected]>
>> 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
>
> _______________________________________________
> Radiance-general mailing list
> [email protected]
> http://www.radiance-online.org/mailman/listinfo/radiance-general

I just checked -- the BTRDfunc type has the same perturbation of transmitted rays. The newer BSDF type does not, but it's very difficult to get a clear image through a data-driven model.

-Greg

···

From: Iebele Abel <[email protected]>
Date: February 19, 2012 6:25:07 AM PST

Hi Greg,

Changing the file rt/glass.c as you described below fixed the artifact. Again, thanks a lot for your help.

But now suppose I would not have changed rt/glass.c Your remark that a texture applied to an infinitely thin layer of glass should perturb transmitted rays (and in effect an applied texture will smooth the triangulation) did me think of using a BRTD material instead of glass. Maybe it is a stupid thought, but would it be possible to model glass using BRTD in such way that the transmitted component remains unaffected while the reflected component is smoothed by a texture?

My best,

Iebele

Ok, thanks for checking the idea, I get along with the modified glass
source.

Cheers,
Iebele

···

2012/2/19 Greg Ward <[email protected]>

I just checked -- the BTRDfunc type has the same perturbation of
transmitted rays. The newer BSDF type does not, but it's very difficult to
get a clear image through a data-driven model.

-Greg

> From: Iebele Abel <[email protected]>
> Date: February 19, 2012 6:25:07 AM PST
>
> Hi Greg,
>
> Changing the file rt/glass.c as you described below fixed the artifact.
Again, thanks a lot for your help.
>
> But now suppose I would not have changed rt/glass.c Your remark that a
texture applied to an infinitely thin layer of glass should perturb
transmitted rays (and in effect an applied texture will smooth the
triangulation) did me think of using a BRTD material instead of glass.
Maybe it is a stupid thought, but would it be possible to model glass using
BRTD in such way that the transmitted component remains unaffected while
the reflected component is smoothed by a texture?
>
> My best,
>
> Iebele

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general