Author Topic: Impact of Mesh Topology on the Refraction Behavior of Glass (Curved Surfaces)  (Read 4501 times)

2024-05-31, 12:27:52
Reply #15

pokoy

  • Active Users
  • **
  • Posts: 1927
    • View Profile
I'm on max 2021.

Looking at your mesh screenshot, the wire looks identical in both cases (imported, not rebuilt), that's why I was asking.

2024-05-31, 12:33:18
Reply #16

James Vella

  • Active Users
  • **
  • Posts: 629
    • View Profile
Ive attached the 2021 version to my previous post.

2024-05-31, 12:34:15
Reply #17

pokoy

  • Active Users
  • **
  • Posts: 1927
    • View Profile
Oh wait, I'm seeing it now, missed the artifacts on the lens type of mesh. The cylindrical mesh looks good however. It's strange indeed.

@OP - can you post the CAD objects exported to IGES or STEP? Since you can import these in Max it's worth trying going with CAD formats imported directly instead.

2024-05-31, 12:38:55
Reply #18

James Vella

  • Active Users
  • **
  • Posts: 629
    • View Profile
The cylindrical mesh looks good however. It's strange indeed.

I thought so too at first, but when I rotated it a little more I start to see the center seam (not as bad stretching as the OP but it shouldnt have this seam)

2024-05-31, 13:28:33
Reply #19

pokoy

  • Active Users
  • **
  • Posts: 1927
    • View Profile
You're right, seeing this one now, too.

An explanation might be that the OBJ exporter does that, or the import does weird things.
Another reason might be that the objects aren't modeled accurately in the CAD app. The tessellation on both objects suggests that there are irregularities in the surfaces itself, these might be a result of manual placing of control points. Especially for the cylindric mesh, the tessellation should be completely regular at the center but it's not, suggesting there actually IS a sharp seam.

I'm currently reconstructing both objects in CAD to check if accurately modeled surfaces would introduce similar artifacts. On a quick cylinder test, I'm not seeing any problems at all.

@OP - if you can, please share both objects in CAD formats, either 3dm, STEP or IGES will do.

2024-05-31, 14:56:45
Reply #20

ATa

  • Active Users
  • **
  • Posts: 12
    • View Profile
Hi James,

As you can see, the unusual shading issue on refractions is still present. Smoothing groups and normals are exported correctly, as these issues only occur with the refraction of glass; the reflections are accurate.

Hi Pokoy,

I am an experienced 3D modeler using Rhino (CAD-based software). The exported 3D meshes are simple curved surfaces with low complexity, yet the unusual render outputs from Corona suggest that the issue might be related to the light solver and rendering algorithms of engines like Corona. Consequently, I am posting these refraction render issues here in the hope of receiving assistance and potentially seeing improvements from the active developer teams.

Creating quad or non-quad meshes is a technique to achieve precise 3D models, not an end goal. CAD-based 3D software can generate highly accurate meshes that are 3D printable and more, without the need for time-consuming topology optimization. It would be highly beneficial if render engine solvers could separate realistic refraction behavior from topology, regardless of whether the mesh is quad-based or not.

For instance, 3ds Max added the Weighted Normal modifier due to the importance of bridging 3D software meshes together, but it cannot handle the refraction issue. I hope the Corona engine can address this specifically, as it is a rendering issue and not a modeling one.

As illustrated in the attached pic1, my normals are correctly exported as an OBJ file. I understand the importance of explicit normals, and for this case, I also tried exporting in FBX format, but the refraction issues persist.

I appreciate any insights or suggestions you might have to improve the realistic output and address the refraction issues. 🤠

2024-05-31, 15:10:21
Reply #21

James Vella

  • Active Users
  • **
  • Posts: 629
    • View Profile
Interestingly when I import this into blender and use one of the built-in HDRIs. Indeed the geometry looks correct (same obj as the one imported into 3dsmax).

2024-05-31, 15:19:51
Reply #22

pokoy

  • Active Users
  • **
  • Posts: 1927
    • View Profile
At least for the cylinder, there's a tiny angle at the center. In my CAD test object, there's no seam visible. You probably mirrored one half of the object but there's a tiny angle at the center, resulting in a slight break in surface continuity. Sorry if you feel like I'm stepping on your toe but the tessellation suggests this, too, and I just can't think of any other reason why a cylinder should have a slight angle at its center.
For the lens object - mine looks less mangled but it still displays some clearly visible artifacts at the edges.

In Corona, light/camera normals and surface normals are two different things, similar to how shadows will produce artifacts on the shadow terminator or SSS/absorption will reveal geometry tessellation. On top of that, Corona can't properly handle explicit normals in some cases. At least for the lens object, it's quite inacceptable.

Devs/support should chime in and give their perspective but this is a long standing issue and with the current target audience (archviz/DCC apps not CAD) I guess the priority will be low.

For the record, I totally support this and think that CAD objects should render perfectly in Corona, too.

FWIW, I'm rendering some comparisons and will post images + a max scene.

2024-05-31, 16:21:27
Reply #23

ATa

  • Active Users
  • **
  • Posts: 12
    • View Profile
Oh, James, could you provide more render shots by rotating the object in the viewport?

Thanks, Pokoy. but the convex shape is an accurate model. As you focus and zoom in to the boundaries of the topology, refraction issues start to appear where the quad meshes change into non-quads!

2024-05-31, 16:31:44
Reply #24

pokoy

  • Active Users
  • **
  • Posts: 1927
    • View Profile
Here are my tests:

1. Cylinder - original object -> seam visible


2. Cylinder - reconstructed in CAD -> no seam visible


3. Lens - original object -> heavy artifacts visible


4. Lens - reconstructed in CAD, imported as BodyObject, Face Angle 10 -> less artifacts visible


5. Lens - reconstructed in CAD, imported as BodyObject, Face Angle 1 -> no artifacts visible



The cylindric objects - mystery remains but it looks like a clean start resolves the issue.

As for the lens - yes, artifacts will be visible, probably due to the fact that Corona doesn't interpolate explicit normals (like it does for normal smoothing).

The only solution (or rather a workaround, not a solution) I found is to use high tessellation. If you import the original CAD file in an format that Max can read, you can dynamically change the tessellation to whatever is needed.
For this to work: Import file > Convert to Mesh = OFF, this will import the object as a BodyObject where tessellation can be controlled at any time.

Attaching a zip file with the max 2021 scene and the exported IGS CAD objects from MoI3d.

FWIW - @OP, you'll find similar problems with shading for non-transparent objects. Two options to handle this:
- again, high tessellation
- or: Render dialog > 'Development/Experimental Stuff' rollout (might have to be enabled in Corona System setting, enabled by checking 'enable devel/debug mode') > 'Terminator Handling' > set 'Shadow Shift' to 1 (0 by default). This will mostly fix shadowing artifacts on CAD models. Might however introduce shading artifacts on low resolution geometry using standard Max smoothing.

Guess development needs to have a look at properly handling CAD normals sooner or later. We have to use workarounds for quite some time now so please have some mercy devs :D
« Last Edit: 2024-05-31, 16:49:09 by pokoy »

2024-05-31, 16:41:51
Reply #25

James Vella

  • Active Users
  • **
  • Posts: 629
    • View Profile
Blender file attached (Blender 4.1 required), just go to render mode in viewport and click on the object and rotate it, it looks fine from all angles.

2024-05-31, 17:38:50
Reply #26

ATa

  • Active Users
  • **
  • Posts: 12
    • View Profile
Yeah, the 4. Lens.jpg you uploaded shows the same refraction issue that I have. As you said, it seems it's time for Corona developers to tackle this refraction issue. I was hoping the new physical materials in Corona could handle it, but they can't. Considering the fact that a vast number of professional 3D artists sync their meshes between CAD-based 3D software like Rhino and 3ds Max, it could be a priority to resolve! 

Let's enhance rendering to be more realistic and seamless for everyone!🤠
« Last Edit: 2024-05-31, 17:43:49 by ATa »

2024-06-01, 23:47:25
Reply #27

ATa

  • Active Users
  • **
  • Posts: 12
    • View Profile
Corona Team,

Today, I decided to investigate further into the jagged refraction issue on glass renders. I applied the retopology modifier to the mesh to convert it into quads, hoping it would solve the problem. However, as you can see from the attached pictures, the issue has worsened.

As discussed previously, this mesh is a closed OBJ export from CAD-based software (Rhino7). It's a simple model without complexity, including its smoothing groups and normals. Despite testing various methods like weighted normals, the problem persists, indicating a rendering issue rather than a modeling one.

For 3D artists, importing/exporting between CAD and non-CAD software and adjusting topology (quad or non-quad) are standard practices. These modeling techniques should not negatively impact rendering.

Please provide an explanation and resolution for this bug in future updates, or if I am mistaken, help me resolve it, as this issue is quite frustrating.

Thank you for your attention to this matter.

The OBJ mesh is attached for reference.

2024-10-14, 11:36:16
Reply #28

maru

  • Corona Team
  • Active Users
  • ****
  • Posts: 13154
  • Marcin
    • View Profile
Sorry for reviving such an old thread, but I have some findings:
- The issue is related to refraction, not reflection. You can check this by assigning a Corona Legacy Material to the object and then enabling refraction only without reflection (or reflection only without refraction).
- The object renders the same (with the jagginess error) in both Corona and V-Ray. I doubt that both renderers are doing something wrong, so I would blame the CAD > Max import process. Something gets wrong with the mesh smoothing and it results in broken refraction.

Unfortunately, I don't think there is anything we could fix in Corona here.
Marcin Miodek | chaos-corona.com
3D Support Team Lead - Corona | contact us