Dielectric normal interpolation


When looking at the normals at intersection points of a dielectric object, it looks quantised even though the vertex normal are provided in the original OBJ file (obj2mesh was used to convert to RTM). Is normal smoothing performed over dielectric material surfaces?


Normals are interpolated from an OBJ mesh for most types, including dielectric. Are you certain the normals are shared between adjacent polygons in your .OBJ file, and not all set to the same direction for each face? If you e-mail me your .OBJ file, I can take a look at it.

Thanks a lot but unfortunately I can’t share the OBJ file, so I’m going to have to figure this out in some other way.

What I’m seeing is that the XYZ coordinates of the intersection points are not tessellated, they look smooth, so I guess some form of interpolation is taking place. However if I’m looking at nx/Nx or ny/Ny outputs from rtrace, they look severely quantised.

So I want to make sure by following the code that normal interpolation does indeed take place, and would appreciate any guidance on how to find it. Closes I found is in o_mesh function in “o_mesh.c”, where it reads in line 195:

if (flags & MT_N) { /* interpolate normal */

Well, it doesn’t go into the if clause since flags==5, as it turns out. Am I looking in the right place at all? And if so why doesn’t interpolation happen?

Well, that flag gets set if all three triangle vertices have associated normals from the original .OBJ file. The XYZ intersection points will vary smoothly with the triangle’s plane equation, whether normals are being smoothed or not. If normal smoothing is on for a given triangle, then the -oN and -on outputs of rtrace should be slightly different. If they are not, then it’s a pretty sure bet that triangle doesn’t have normals, unless the normals it has already coincide with the plane normal.

I see, so basically to verify that, I need to look at some triangle, find it’s normal, and then look at the vertex normals of the vertices that define this triangle. If they turn out the same, that mean those vertex normals don’t add any useful information for smoothing. Is that what you mean?

Unless due to some problem, the normals were not transferred when the OBJ was converted with obj2mesh?

How can I verify that the normals were correctly converted?

There is no easy way to confirm what the normals are in the mesh file, but I’ve used obj2mesh quite a bit, and I believe it to be reliable. You can also try using obj2rad and looking at the output file to see if normal interpolation happens on the triangle(s) in question. If it happens there, then it should happen in a mesh.

I’m pretty sure it’s not a bug in obj2mesh, yet if the vertex normals are defined int he OBJ file (and they are), then they must get lost somewhere in the conversion process. It could be a problem in the file itself, just not sure how to verify it.

If you can’t share the .OBJ file, can you at least share some small segment of the output from obj2rad when you use that for your conversion? Just the part that pertains to the dielectric you’re having problems with.

I might be able to do that… in the mean time, what happens if a vertex that is shared by several triangles has a different normal for each one of them? How does Radiance deal with that?

I’m not sure what you are asking. If the OBJ file specifies different normals to interpolate for the same vertex position, then those different normals will be used. If normals are shared along with the vertex positions, then smooth interpolation occurs.