Problem with imported object normals

This topic has been viewed 6365 times and has 9 replies
Thread status: Active
Looking for a particular 3D model or texture? [img]http://www.sweethome3d.com/images/flags/en_small.gif[/img]
Post Reply New Topic
mrencyc
Posts: 3
Joined: Fri Jul 07, 2023 4:02 pm
Country: US

Problem with imported object normals

Post by mrencyc »

I'm having difficulty importing sets of books I created in Blender. In Blender, they look fine

Image

but when I try to import them to Sweet Home 3D they look like this:

Image

It seems like there's something weird going on with the normals, but they render correctly in every other program and as far as I can tell they're correct in Blender. When I turn on backface culling in Blender every face still renders correctly.

I uploaded the .obj file here if anyone would like to take a look and see what I'm doing wrong.
User avatar
Keet
Posts: 1807
Joined: Fri Apr 08, 2022 7:13 am
Country: Netherlands

Re: Problem with imported object normals

Post by Keet »

Your zip file is missing/invalid so I can't take a look at it.
Dodecagon.nl
1300+ 3D models, manuals, and projects
mrencyc
Posts: 3
Joined: Fri Jul 07, 2023 4:02 pm
Country: US

Re: Problem with imported object normals

Post by mrencyc »

Thanks, the link should work now.
User avatar
Keet
Posts: 1807
Joined: Fri Apr 08, 2022 7:13 am
Country: Netherlands

Re: Problem with imported object normals

Post by Keet »

Looking from the right at the books they are fine, from the left they are missing textured faces. Looks to me like you missed something in Blender, i.e. the books left side faces.
Dodecagon.nl
1300+ 3D models, manuals, and projects
sjb007
Posts: 300
Joined: Tue May 18, 2021 1:49 pm

Re: Problem with imported object normals

Post by sjb007 »

Looking quickly in Blender one thing I notice is that the facing sides of each pair of books are at the exact same y coordinate. This is probably the source of the weird rendering in SH3D. SH3D is using OpenGL, and overdrawing of exactly aligned faces can can cause weird artefacting in SH3D. Try separating them by a tiny amount.
User avatar
Keet
Posts: 1807
Joined: Fri Apr 08, 2022 7:13 am
Country: Netherlands

Re: Problem with imported object normals

Post by Keet »

And check that all faces are oriented outward. You might have a few faces that are facing in the wrong direction.
Wouldn't be the first time that happened with models created in Blender [:)]
Dodecagon.nl
1300+ 3D models, manuals, and projects
mrencyc
Posts: 3
Joined: Fri Jul 07, 2023 4:02 pm
Country: US

Re: Problem with imported object normals

Post by mrencyc »

I had a weird thought and tried changing the .png file to .jpg and that appears to have fixed the problem. I've also had issues importing PNGs as textures so I think the issue is a bug in PNG support in Sweet Home 3D.
User avatar
Keet
Posts: 1807
Joined: Fri Apr 08, 2022 7:13 am
Country: Netherlands

Re: Problem with imported object normals

Post by Keet »

If the problem is solved by converting the PNG to JPG it's probably that tranparency in the PNG caused it, not a bug in Sweethome3D. I have never had problems with PNG's in Sweethome3D which of course respects the transparency in PNG's. Very useful to add an overlay text PNG with a transparent background for signs.
Dodecagon.nl
1300+ 3D models, manuals, and projects
Greymagic27
Posts: 8
Joined: Sat Jan 28, 2023 11:59 am

Re: Problem with imported object normals

Post by Greymagic27 »

I've had this issue as well. If it's just because of transparency when using .png then at least that's an easy fix. I can just rebake my textures into jpg.

Not my thread I know but helpful nonetheless, thanks OP!
User avatar
Daniels118
Posts: 503
Joined: Wed Nov 17, 2021 9:04 pm
Country: Italy

Re: Problem with imported object normals

Post by Daniels118 »

The problem is caused by the way raster 3D graphic handles transparent objects. Although your object is not transparent, it is treated as such because the texture has some transparent pixels. You can still use the PNG format as long you fill the whole image with fully opaque pixels (i.e. try to fill the transparent area with white).
The alternative is to divide the object in multiple shapes so that the rasterizer can draw them in the proper order.

For those interested I recommend these 3 lectures (must be read all in this order):
1) https://www.geeksforgeeks.org/z-buffer- ... er-method/
the point 9 leaves with an open question, which is solved by this:
2) https://computergraphics.stackexchange.com/a/7630
and so this:
3) https://en.wikipedia.org/wiki/Painter%27s_algorithm
when you'll read the "Limitations" paragraph you'll understand the reason.
Post Reply New Topic

Who is online

Users browsing this forum: No registered users and 2 guests