News:

Please note new Forum URL: forum.designcad.com

Main Menu
DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

Reversed normals

Started by Dr PR, August 05, 2016, 01:50:04 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr PR

I have attached a file with a drawing of a quick acting air tight door. It has 21 raised rectangular "bumps" that strengthen the flat metal plate of the door face.

The door front is a plane and the bumps are each made up of four angled side planes and a front plane that extend 0.125 above the door front. The edge of the door is beveled all around.

But that is not how it is being displayed. Look at the attached image. The shading (OpenGL Gouraud) makes it look the bumps are recessed behind the door surface. This is impossible because the door surface is a plane.

Also, one segment of the bevel around the door edge at the top is displayed reversed. The equivalent segment at the bottom originally was displayed reversed but I selected it, deleted it and drew a new segment which displays correctly.

The rest of the door seems to be displaying correctly.

I see this with DesignCAD V24.1x64 21-Nov-14 running on a laptop with Windows 10 Home and with DesignCAD V25.2x64 18-Dec-15 on my Win 7 Pro 64 system.

The problem appeared in a large 222 Mbyte file, but it copied over to this smaller 635 Kbyte file.

****

Does anyone else see the same problem?

Does anyone know how to fix it?

Phil
DesignCAD user since 1987

DrollTroll

Essentially, it appears to be a limitation of DesignCAD's shading algorithm. In the absence of actual facet normals, DesignCAD does "double-sided" shading, and makes the best guess it can as to which "side" is facing the viewer. Sometimes it gets it wrong, as evidenced here.

You *might* have somewhat better results if you made the door a solid and added the bumps to that flat surface. Then their context to one another could help DesignCAD make a better decision about which way was facing the viewer.
25 years with DesignCAD

Adrian 2.0

Hi Phil,
I can see the issue with the rounded top edge of the door but the top 2 raised rectangles appear to be pushed out from the plane correctly for me.
I see that if you render it in GDI everything displays correctly. This is a glitch that I come across quite regularly but because it displays correctly in the final render I let it go.
I took the liberty of exporting your door to Sketchup to see if it rejected those planes as invalid & it appears to import fine and also displays fine - except that it loses the detail on the plate at the top of the door.
(I think you made that as a solid with different colour surfaces but all on a common plane - If the planes align exactly Sketchup combines them so the pattern was lost - sorry about that!)

Adrian

Dr PR

#3
DT,

This is just one of about 30 different types of doors and hatches on the ship that use this rectangular raised "bump" pattern, and all the rest seem to be shading correctly.

I think the problem here is the result of mirroring the original door - I have seen some weird shading effects after mirroring objects. Most of the surfaces shade correctly, so I don't know what is the problem with the surfaces that don't.

The original that I mirrored does shade correctly. I just made new mirrored copies of it on the X, Y and Z axes and all shade abnormally like the first. So it is something about the mirroring that is causing the problem.

Normally I group everything (single level) so the door behaves as a single object.

I am pretty sure I can just redraw the parts that shade incorrectly and the problem will go away. In this case that will be pretty simple to do. But I wish there was a way to correct the problem when it occurs in more complex objects.

Maybe I will try making the door front a solid.

Phil

PS: I did delete all of the offending surfaces and redrew them, and everything renders OK.
DesignCAD user since 1987

Dr PR

Adrian,

Thanks. Yes, the detail plate at near the top of the door was made up of several different colored planes to create the black circle with the black "X" on an aluminum background.

Because of the Z buffering effects of rendering multiple surfaces that are stacked very close together you can't "paint" one surface on top of another. Viewed up close in a drawing that isn't very deep these stacked surfaces give the impression of one being painted on the other. But when viewed at a distance, especially in a drawing with significant depth, the surfaces are treated as if they were in the same plane and blended - typically creating a "zebra stripe" image of alternating colors from the two planes. This is pretty ugly!

So to create "painted" patterns I make individual planes of each color shaped to fit together in the same geometrical plane. This way the planes are not stacked and they render correctly.

It is interesting that SketchUp automatically combines all of the co-planar parts. So how do you "paint" a multi-colored pattern on a surface with SketchUp so that it doesn't have Z buffer problems when viewed from a distance?

Phil
DesignCAD user since 1987

Adrian 2.0

Phil,
I can't say I've needed to do that but I think putting the different elements in different layers would do the trick.
You can also render using an image as a material but it does get flakey trying to get the image to fit the object exactly.
That solution also works well in DCad by texture-mapping the image onto the plane.

Adrian

bdeck

Quote from: Dr PR on August 06, 2016, 12:23:46 PM
I think the problem here is the result of mirroring the original door - I have seen some weird shading effects after mirroring objects. Most of the surfaces shade correctly, so I don't know what is the problem with the surfaces that don't.

Hi Phil,

Have you tried using the info box to reverse the point order of the resulting mirrored entity? (Not sure if that will help, but it might lead to the cause)

BD

Dr PR

#7
BD,

I though of that too. It had no effect. The planes still shaded "backwards."

I just redrew the offending objects and deleted the originals. But I still winder what causes this to happen when objects are mirrored. Especially since it doesn't always happen.

DT said it is a problem with the shading algorithms making  an incorrect guess as to which side is facing the viewer - or the light source in this case since I have the light "move with the eye."

All of these errant surfaces are angled 45 degrees to the vertical XY plane or horizontal XZ plane. I don't know if this is the case every time this happens or if it happens with surfaces at other angles. But if it only happens at 45 degree angles it could be a case of the shading algorithm using the cosine function.

cos 45  = cos -45 = 0.707.

So a calculation using the cosine to determine which side is facing the light could produce ambiguous results for surfaces angled at 45 degrees.

Phil

Note: The cosine of X = cosine -X for all angles.
DesignCAD user since 1987

Dempsey

Phil,

I used your dcd file and mirrored the whole door on the z-axis (V25.2 64-bit). Looks fine to me now.
Dempsey

Dr PR

Dempsey,

The drawing in the file was a mirror image of the original - mirrored on the Z axis - and it had shading problems.

So you mirrored the mirror image and it looks like it went back to the normal shading of the original.

Interesting! I didn't try that.

****

When I mirror the door as you did the mirrored copy shades correctly, like the original. Then when I mirror the mirror copy again I get another copy with the incorrect shading! So some surfaces are mirroring correctly and others aren't.

Only the surfaces that are rotated from the horizontal/vertical around the X axis are having problems.

Phil

DesignCAD user since 1987

Dempsey

Hi Phil,

I noticed that the protruding rectangles are not solids. So I tried something else. Mind I have no explanation.

Using your mirrored dcd.
Mirrored that around z-axis to get the original.
Select the 5 surfaces a one protruding rectangle, and defined that as a solid.
Mirrored again around the z-axis to get again the mirrored version, and now the solid protruding rectangle remained shaded correctly.

See whether you get the same results.
Dempsey

Dr PR

Dempsey,

So I tried your idea and just made each rectangular bump a solid. Same results - on the right in the picture. The flat faces of the bumps are rendered as if they were curved, but the sides do appear to be rendered correctly.

DT suggested making the entire door surface a solid, so I tried that. You can see the results on the left in the attached picture. At least the top edge facet is rendered correctly.

I think the curved face happens because DesignCAD considers the angle between polygons in solids and grids to determine how multiple polygons are to be rendered. If the angle is small enough the program renders the surface as a smooth curve.

In this case it displays the sharp angle between the surfaces of the bumps but still displays the flat face as if it was curved around the X axis.

I have seen the same "inside out" shading problem on single flat planes that were mirrored, even planes that were rotated with respect to two axes. It is pretty annoying! I guess the only solution is to delete and redraw the offending surfaces.

Phil
DesignCAD user since 1987