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.

surface shading color bleed through problem

Started by Dr PR, June 02, 2010, 12:10:06 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr PR

I have had a lot of problems with rendering drawings with parallel surfaces that are separated by very small distances, especially curved surfaces. Occasionally I want to "paint" over a surface with letters or symbols, like letters on a sign. To do this I create a new parallel surface in the shape of the letter and position it in front of the larger background surface.

Rationally, if the surfaces are separated by any distance, no matter how small, the nearer surface should be displayed in front of the rear surface. In fact, this doesn't always happen and the rear surface color "bleeds through" to cause streaks in the nearer surface. This is a bug.

For a simple example draw two coplanar square planes, one twice as long on a side as the other. Make the large plane green and the small plane red. Position the smaller plane in the exact center of the larger plane.

Now move the small red plane 0.001 units in front the green plane. In theory the red plane should be visible only from one side of the green plane. This is true with Quick and Gouraud shading with graphics acceleration enabled. But with graphics acceleration disabled part of the red plane is visible from every direction with Quick, Gouraud or Phong shading (001 front.jpg).

Now move the red plane 0.01 unit farther in front of the green plane (0.11 units separation). Again, view from both sides with graphics acceleration off. Now the "front" view, with the red plane closer to the viewer, displays correctly (01 front.jpg). But from the rear side part of the red square is still visible at some viewing angles (01 rear.jpg).

Again, move the red plane another 0.1 unit in front of the green plane (0.111 units separation). Now the two planes display correctly from any angle.

This is a simple example. With curved coplanar surfaces the rear color will bleed through for closely spaced surfaces, even when graphics acceleration is enabled. You have to use relatively large separations to prevent bleed through for all surface facets and all viewing angles.

This causes two problems. First, if you preview with Gouraud shading and graphics acceleration enabled you may not see this display aberration. However, when you take the time to do a lengthy Phong shading the results can be badly messed up. Second, often the gap to prevent color bleed through has to be so great that you can see a shadow between the "paint" and the underlying surface.
DesignCAD user since 1987

DrollTroll

As I understand it, this is a resolution limitation of the z-buffer shading algorithm used by DesignCAD.
25 years with DesignCAD

Rob S

Quote from: DrollTroll on June 03, 2010, 07:43:43 AM
As I understand it, this is a resolution limitation of the z-buffer shading algorithm used by DesignCAD.

So, DT,  you running for politics now?   Would the translation of all that be - "bug"?  ;D

Knowing what causes it, can you provide any hints what one might be able to do to avoid this "resolution limitation of the z-buffer shading algorithm used by DesignCAD"
User since forever

DrollTroll

It's been a long time since I reviewed z-buffering, but as I recall it works sort of like this:

Divide the depth of the objects being shaded into some discrete number of "slices". When two surfaces are in different "slices" all is well. When two surfaces are inside the same "slice" however, things get ambigalent (I made that word up just now), and you may not always get "logical" separation of your shaded surfaces. The more "slices" you have, the less often you'll see this problem.

So no, not "bug". "Limitation". On that mythical day when we get true ray-tracing in DesignCAD, this should go away.

Trolls don't do politics. That's a human invention.
25 years with DesignCAD

magic

Hi Sir Troll,

Here's a link to an article about ray tracing, but you have probably already read it: http://www.codermind.com/articles/Raytracer-in-C++-Introduction-What-is-ray-tracing.html

Is it something to do with Obama?
It's a kind of magic!




Dr PR

DT,

I knew it was something like that. Years ago I dabbled in video game graphics programming just enough to produce some really bad code.

It isn't a bug from the code standpoint - it is a necessary limitation. It is a bug from the end result standpoint - not what the user desires. OK, so the world isn't perfect. Get used to it.

What I was wondering is how to predict the thickness of a slice - in other words, is there any rule of thumb for the separation distance between surfaces?

My current solution is to extrude the "paint" surfaces into solids. Giving the paint a nonzero thickness seems to help. However, on highly curved complex surfaces a corner of a background surface facet may protrude through the paint. Rotating the view slightly may move the facet into a more distant slice and hide it again - but it may also move another facet into a closer slice. A lot of experimentation is often necessary.
DesignCAD user since 1987

hepcat

I have used Design CAD for a long time but rarely venture into 3D; however I did dabble a few months ago to supply a picture to one of the model aircraft forums of my centre of gravity checker. (In case you wonder, the wing is placed on the two knife edges at the top right and the model adjusted fore and aft until it balances.  The distance of the CG from the leading or trailing edge of the wing (depending on which way the model is placed) is read off on the scales pointing to the left.)

Those scales give this some relevance to the thread.  I tried to 'draw' them on thin white paper and got some of the effects mentioned in the thread.  I tried leaving a gap and got clear shadows even when the gap was small.  I finished with 0.02 thick paper and this gave me a good enough picture to send.  I seem to remember that use of Selection Edit>Display Order on the numbers and paper and so on also needed some careful handling to get things more or less correct.

I assumed my problems were all due to my incompetence; it is comforting to know that perhaps it was not all my fault.  I don't visit Upperspace as often as I should because I always learn something when I do.

John


Dr PR

hepcat,

Same problem. You have to fiddle with spacings a bit and get the right viewing angle.

By the way, Upperspace is history. They sold DesignCAD to IMSI quite a while back.

****

There is a problem with the paint "extrusion" technique. If the color is very light the edges of the extrusion will show up much brighter than the surfaces of the paint with some lighting angles. This can be very annoying. If the color is dark the edges are not as visible.
DesignCAD user since 1987