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.

Rendering bug

Started by Dr PR, June 18, 2010, 01:35:29 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

Dr PR

V20.0
Vista 64

Here is a weird one! This is part of a six and one half month project that was finished (I thought) today! Finally! But when I rendered the job I saw a strange color pattern in part of the drawing when rendered with Gouraud and graphics acceleration enabled. If graphics acceleration is disabled the objects render correctly with Gouraud shading (essentially Phong shading), but are still basackwards with Quick shading. Phong shading renders OK without shadows enabled. With shadows enabled I sometimes see strange shadows around the middle upper surface.

"light angle bug 1.jpg" shows the surfaces with the light from above (vertical angle >0). All but the middle section render as if the light was below.

When I change the light direction vertical angle to -40 I get the shading shown in "light angle bug 2.jpg."

All of the objects have identical material properties in the Info Box - Default material and the same color red.

I have attached the file for anyone to play with.

Note: these objects were originally created months ago. At the time all were a part of a solid and all rendered correctly. Sometime since then these objects became screwed up as the file was being edited. The original solid has not been edited since it was created. This is another example of the file being screwed up for no apparent reason.

Many, many, many, many times with this file I have seen the rendering problem where the edges of planes were rendered with shadows as if the plane was curved around the edges. This bug has been reported earlier. However, closing the file and reopening it has always caused that problem to go away. This new problem is not cured by closing and reopening the file.

So now I am screwed! I may have to regenerate a significant part of this half year project. If anyone can figure out how to fix the file I will be very grateful!
DesignCAD user since 1987

Adrian 2.0

Doc,
I have seen this problem many times - I reported it back in V19, but I am sure it was not addressed in V20.
It seems that the display properties of the surface are getting transposed with the properties of the reverse of the surface.

It happened to me when I mirrored the item. I was modelling a car body - design one side, mirror it & the other side was screwed up  >:(
Reversing the points does not help.
You can 'reset' the display properties by exporting to IGES, then re-importing to DCad. this reduces the colour depth to 16 and re-numbers the layers by 1 (no layer 0 in IGES). It also explodes surfaces into multiple planes, which means they are a nightmare to edit and they don't 'smooth' the same - but you will fix the patchwork quilt.

I just experimented with your file - thinking about our recent discussions regarding 'hidden' points & what happens if you delete the 'seed' point in hatches.
I deleted one point in the 'black' surface then added a new point (stretched the surface back) at the deleted location. The problem was fixed!
I'm not suggesting you try to do that to a large file, you would most certainly go mad & we need you here to help us!

Dr PR

adriank,

Thanks!

I suspected the Mirror function - Z axis - to be the cause of the problem, but I haven't actually caught it in the act. However the original problem appeared in both the original object and the mirrored copy.

I also suspected that it had something to do with point order. This is a major design fault in DesignCAD - many functions rely on the order the points appear in the drawing file, and not in their relative positions to one another. If the point order gets screwed up the object will not work correctly with many commands. That's why they added the "Reverse Point Order" kludge in the Info Box.

It also appears that it is not the mirrored object or the copy that gets screwed up. It is other unrelated objects in the drawing that have the point order scrambled. That's why you don't notice the problem right away - it is some object hidden away on a disabled layer or not displayed on the screen that gets messed up.

Over time these problems multiply until you get a lot of objects that do not render correctly. This is probably where all the objects come from that cause "reverse shadows" - where the shadow is projected toward the light source instead of away from it. I have dozens of these things in the current drawing, and I will have to hunt them down one by one. PITA!
DesignCAD user since 1987

Dr PR

Aha! Caught it!

I repaired the original drawing object by exploding it, deleting the surfaces that were causing the inverse shading problem, and reconstructed the object. All elements were regrouped.

"mirror bug 1.jpg" shows the resulting object shaded with Gouraud and graphics acceleration enabled.

Next I selected the group and mirrored it along the Z axis while the drawing was rendered with Gouraud shading.

"mirror bug 2.jpg" shows the result. The screwed up shading appeared immediately after the mirrored copy appeared.

Then I clicked the "Undo" button. The mirror copy disappeared and the shading of the original group became completely screwed up, with each of the dozens of surfaces having different shades of red.

I clicked the "Undo" button again (ungrouping the objects) and the normal appearance (shown in "mirror bug 1.jpg") reappeared.

I tried selecting the ungrouped objects and mirroring them - same results. However, when I clicked the "Undo" button the program crashed. The message "To stop redraw, press Esc." was flashing repeatedly in the Status Bar and the program would no longer respond. Meanwhile all of the surfaces in the object were flashing different shades of red and purple. Great!

CTRL-ALT-DEL again!

Note: deleting points from the surfaces and adding new points did not correct the problem. I suspect that a single point is the culprit, and I didn't delete the right point.
DesignCAD user since 1987

Adrian 2.0

I think it must have something to do with the 'seed' points - or the point that relates to origin. When the object gets mirrored it's like it creates an origin 'shadow' in the polar location. Whatever, it's way beyond my brainpower. I hope they fix it because it makes the rendering option useless for presentation work.
I tend to photoshop the problems away mostly!

Dr PR

adriank,

I have used Photoshop for years to correct DesignCAD rendering problems. It is a pretty pathetic solution!

I repeated the mirror using the Y axis and got the same screwed up results.

However, I did mirror on the X axis and the rendered results were no worse than the original. Then I rotated the mirror copy 180 degrees around the Y axis. The resulting object was the same as if I had mirrored on the Z axis, except the rendering of the original and copy wasn't screwed up.

For me, whatever is causing the screwed up files and useless renderings is bug number 1.
DesignCAD user since 1987

Dr PR

I went back to an earlier copy of the drawing and copied the problem object to the clipboard. Then I opened another drawing and pasted the object into it.

The display problems were gone!

I mirrored the object on the Z axis and the shading problem returned.

I closed the drawing and opened another new drawing. Then I pasted the object from the clipboard again. It rendered correctly.

Then I mirrored the object on the X axis. Both objects rendered correctly! Then I rotated the copy 180 degrees around the Y axis, and both objects still rendered correctly.

It looked like the problem was solved. So I copied both objects to the clipboard and opened the latest working drawing.

After I pasted the two new objects into this drawing both rendered with the original problems!

Apparently it may not be a problem with these objects at all, but with some other screwup in the file!

This is a nasty bug! The whole six and a half months effort may have to be discarded!

That would be enough to make me change to another program and forget DesignCAD completely!
DesignCAD user since 1987

magic

Hi all,

I just had a quick look at this, and it seems that its only a problem with Graphics acceleration enabled. If you switch it off, it renders OK.

See below:
It's a kind of magic!




DrollTroll

#8
Don't know how it got this way, DP, but you've got some non-planar "planes" here. This is undoubtedly throwing off the normal calculation when rendering with OpenGL, and thus causes the different shading behaviors. DesignCAD's native renderer will just figure an average normal, but OpenGL is more "partikalar" about its normals.
(Actually, I don't think the native renderer even uses normals in the "normal" sense).


What I did:
1) Exploded all solids
2) Used the Selection Filter to select all Plane entities.
3) Vector Convert on the selected planes
4) Select each vector one at a time and try Make Plane. Several of them popped up the "points are not coplanar" message box.
25 years with DesignCAD

Adrian 2.0

DesignCad calculates the lightsource differently (wrong) with graphics acceleration turned off.
This is a bug I uncoverd a year ago. This was the thread.
http://forum.designcad.com/index.php?topic=2097.0

It seems that when you rotate an object, what you are in fact doing is rotating the lightsource as well as the object. But with graphics 'off' it rotates the light at twice the rate as the object. You only see the effect of this with 'move with eye' turned off.
The problems may well be related because this issue seems to be relating to the individual element's perception of where the light is.
So Magic, I think turning off graphic Acc. masks the problem, does not actually solve it. Possibly it even causes it?

Dr PR

DT,

You are right about the non-planar planes. This is not accidental. Also, the file sample I provided is just a small section of the original entire bilge keel shown in the "mirror bug 1.jpg" image.

I originally tried to create the upper surface of this bilge keel as a grid, but it is a flat plate 0.375" thick that is a non-planar surface, curved in such a way as to fit around the shape of the hull to match the direction of water flow (to generate the least drag). Consequently, it must be "extruded" in a constantly changing direction from end to end, which you cannot do in DesignCAD (or any CAD program?). Think of the constant variation in surfaces in a helix and you can get the idea of what I am talking about. Furthermore, the width of the surfaces from inboard to outboard varied from end to end. The only way I could think of creating it was piece by piece - hundreds of them.

Therefore I created the surface planes one by one and extruded them 0.375" perpendicular to the plane. Since each section was not coplanar with its neighbors I repositioned the points at each corner in Point Select mode, using the midpoint of a line drawn between each pair of corresponding points to make the points coincident, generating a smooth continuously twisting surface - essentially what you would get in a grid. Unfortunately, there is no way to stitch together a collection of planes to form a grid, so the next best thing was to select them all and make them a solid. I subsequently exploded the solid (breaking up all solids into planes) while trying to solve the rendering problem.

Now that I have the desired shape I can use it as a template to draw curves at each section boundary and use Surface Connect to produce real grids for the top, bottom and edge surfaces. Then I can delete the hodgepodge of individual twisted surfaces. However, I think this will not solve the problem.

The nonplanar planes are not what is causing the rendering problem. If I copy and paste the entire bilge keel into an empty drawing it always renders perfectly. I have also saved the keels in V15 format, opened them in V15, and they render perfectly (Gouraud and Phong). Then I saved the bilge keel file in V15, opened it again in a blank drawing in V20.0, and it again rendered perfectly. However, when I copy and paste these bilge keels into the original V20.0 37.7 Mbyte file (743,768 points, 70,721 entities with 28,805 grid surface entities) the copies render exactly as the original bilge keels, with exactly the same screwed up shading!

I think this proves that there is something messed up in the original drawing file not related to the bilge keels that is causing the rendering problem. Likewise, it is not the twisted planes that cause the problems. Every facet in a complex curved grid surface is nonplanar and they render correctly - most of the time.

Also, as demonstrated in an earlier post, the mirror operation seems to provoke the problem in files containing nothing but the bilge keels.

There are between 1000 and 1500 individual grids in the original drawing, including surfaces of solids (see attached image). The hull is built up individual plate by plate, line the real ship. The images are to be used as illustrations, so rendering blemishes are a problem. I can correct most in Photoshop, but I really would like to figure out how to fix the problem in DesignCAD, because the problems seem to be growing exponentially (there are dozens of misdirected shadows and improperly rendered surfaces if you look closely). And they appear in all images.

I may try copying elements from the original drawing into a new drawing bit by bit (successive approximation) to try to find the element(s) causing the rendering problem. With more than 1500 objects to copy, this may take a while.
DesignCAD user since 1987

bdeck

Hello Doc,

Very fine work.

Did the hull surface render well before you added thickness?


BD

Dr PR

#12
BD,

I don't know where the problem came in. The original bilge keel was created several years back (this project has been going for six years, with a few more years to go). I have renderings from August 2007 showing it. However these images were rendered without shadows (the reverse angle shadows and shadows from objects on hidden layers screwed up the images). They were done with Gouraud shading with graphics acceleration on and there were no shading problems. The first images I have with shadows (Phong) were made in January 09. There were no shading problems. These were made on a model with a simple smooth surface - no actual hull details.

In January of this year I started working on the plated hull shown in the image above. It took six months to piece it together. None of the plates have actual thickness - they are just grid surfaces. I manually added the plate edges where plates overlapped or where plates of different thicknesses butt together. After the plates were finished I copied the bilge keel from the original smooth hull drawing and added it to the new drawing.

The new hull is a bit more accurate so I had to make some adjustments to the bilge keel. I did this by finding the surface intersection of the top surface of the bilge keel plates with the surfaces of the hull plates. Then I selected the bilge keel, and in Point Select mode selected groups of points along the length of the keel and dragged them into the new positions. This maintained the width of the keel and the angles between top and bottom plates (as defined in the blueprints).

All of this has undoubtedly twisted something's tail to cause the strange rendering problems. But I am not convinced the problem is in the bilge keel itself. There were months of work in the drawing before the bilge keel was added, and I saw a few odd shading glitches before it was added. All I know now is that somewhere in the file something is screwed up.

Images from 4 June 2010 with the new hull have no shading problems on the bilge keels. 8 June 2010 images have the odd dark blotches. So whatever caused it happened after the bilge keel modifications were made.


DesignCAD user since 1987

Dr PR

I have experimented with this problem a bit, and it definitely seems to be related to non-planar planes. You can twist a plane out of shape in Point Select mode by selecting a point and moving it out of the plane of the surface. If the distortion is minor the plane shades OK - it even shades as a curved surface should. However, if the plane is twisted too much DesignCAD has trouble deciding which side is up. This can cause the shading to be distorted, with the bottom side up over part of the surface and vice versa on the rest.

I reconstructed the bilge keel shown above, using a single grid for the top and bottom surfaces instead of the collection of twisted planes in the original. The shading problems went away. A similar problem was solved in another part of the drawing by replacing a twisted surface with a grid.

I also suspect this may have a part in the reversed shadows that sometimes appear projected toward the light source instead of away from it, but I haven't proved that yet.

So, it really is an operator problem (my bad). The solution is Don't do that!

I have been twisting surfaces for years. Problems only started appearing since shadows were added to the program. My reason for doing this is simple - to reduce file size. One twisted plane has fewer points/lines/surfaces than a grid or collection of planes.

In some cases twisted surfaces were created unintentionally when points on one solid were moved to positions on the surface of another solid. The end surface of the modified solid ends up being bent around the surface of the other solid. I do this as a last resort when the solid Boolean operations screw up and create a mess. Fortunately, the Boolean operations work much better in the latest versions of DesignCAD and I haven't needed to do this very often.
DesignCAD user since 1987

DrollTroll

QuoteUnfortunately, there is no way to stitch together a collection of planes to form a grid,

There's no automatic way, no. Once you have the planes in place, however, you can create a series of grid lines along the "horizontal" edges of the planes using Gravity Snap. Then use Surface Connect to connect the lines, with no breaks between the lines. That ought to get you a decent enough grid.
25 years with DesignCAD