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.

Shading problem

Started by Dr PR, July 01, 2012, 11:15:32 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Dr PR

I occasionally see an annoying failure in the shading routines - Gouraud (with hardware acceleration), Phong (no acceleration) and in the  "File/Image/Save Image File" function. This happens with and without shadows. You can see the problem in the attached image.

On the left the porch deck is rendered black, with no shadows. On the right the same deck is rendered in the proper brown color, with shadows. The only difference is the slight view rotation difference between the two images. The problem is not limited to horizontal surfaces (relative to the light) and can appear on any surface at a high angle to the line of sight.

The light source is a single Directional Light above and to the left. Changing the light source angle does not change the problem.

I have seen this in many files for several versions now, but this is the first time I have reported it.

Phil

PS: The house is a pre Civil War era officer's house we are returning to it's original location at Fort Hoskins, Oregon.

http://www.afrana.org/Current%20projects.html
DesignCAD user since 1987

Adrian 2.0

Hi Phil,
I've run into that one regularaly too.
It seems to be down to the view angle. I always render first with acceleration on and drag the view angle around until the black surfaces flash back to correct render finish. It's not a gradual transition, it jumps from a good finish to black with only one degree movement.
When I'm satisfied I have the best angle I render it in phong only to find the image renders completely differently with graphics off & it's not an acceptable result!
The whole render routine is still a bit flakey - mirrored planes / surfaces still render the wrong side of the surface until you reverse the order of points etc, but it's still way better than it was a few generations ago.

Adrian

DrollTroll

Check your light sources -- is the "Move with eye" option checked? If so, that'll change the way the light hits the surface each time you adjust the view angle. In Dr PR's first image, the light is hitting the porch floor at an almost horizontal slant, so not much light is reflecting back to the viewer; the shadows then don't show up very well on that dark surface.
25 years with DesignCAD

MarkX

Maybe use 2 lights - one off to the right and one off to the left, and both at about 80 degrees. The default light setting acts like there's a torch on your head.

The way things render so differently for each mode is very frustrating.

Mark

Dr PR

DT,

I'm pretty sure that "Move with eye" was selected - I almost always use that. However, I never use the default horizontal and vertical angles setting at zero. The vertical angle was set to somewhere between +25 and +40 degrees, and the horizontal angle was about -3 to -6 degrees. This is my normal operating procedure.

So the light should have been falling on the deck from above at about 30 to 45 degrees, and the deck should have been brightly illuminated.

The problem seems to be with the eye to surface angle, regardless of the lighting. When it is a very small angle the program just doesn't render any light from the surface.

I do as Adrian suggested, view the scene with Gouraud (acceleration enabled) and watch for the surfaces to flash black. Then I adjust the angle slightly to get the color back.

However, this has significant shortcomings:

First, if there are many surfaces at small angles to the line of sight it may be impossible to find a viewing angle that causes them all to be rendered correctly.

Second, I often want a "low" viewing angle that produces a small view angle to the horizontal. The house on the left of the image I posted is an example. I wanted the eye point to be about the natural elevation of a person standing in front of the house. This causes the deck to be black.

Note: The view distance was pretty small - 750 (inches) I think. I did make it 10,000 at one point and I am pretty sure I still saw this problem (that would make the eye to deck surface angle even smaller). I'll experiment more with this when I have time.

Phil
DesignCAD user since 1987

JJG

Like DrPR, I have this "problem" sometimes ...

I bypasse it, or correct it (if you prefer), in Photoshop with his curves-tool, which allow me to quickly obtain the expected color.

magic

Hi doctor,

I think, what DT means is: Try unchecking the Move with eye. If Move with eye is checked, the Light (and therefore the color) may change, when you change the viewing angle.

Personally, I hardly ever check the Move with eye box. It gives a more constant ligthing.

Also, as Mark suggests, I almost always set up at least two or three light sources.
It's a kind of magic!




Dr PR

magic,

I have tried using more than one light source but the results have been less than satisfactory. When one source gets brighter the others get dimmer - another screwball "feature" of lighting in DesignCAD. The entire scene loses contrast when additional lights are added.

I always use the "Move with eye" option. That way the part of the object I am looking at is always illuminated. Otherwise I would have to fiddle with lighting angles every time I rotate the view.

I use only the Directional Light. In the past other light types really screwed up rendering and shadows. I also set all intensity sliders to maximum so the materials properties govern what a material looks like.

I would like to have a "skylight" light source (non-directional surround) to create a fill light - I think TurboCAD has this. With outdoor scenes the blue sky is the light source in shadows - that's why shadows have a bluish color on clear days.

Phil
DesignCAD user since 1987

MarkX

#8
Quote from: Dr PR on July 02, 2012, 10:37:24 PM
I have tried using more than one light source but the results have been less than satisfactory. When one source gets brighter the others get dimmer - another screwball "feature" of lighting in DesignCAD. The entire scene loses contrast when additional lights are added.

Set the two lights the same intensity. Sometimes it works ;-)

Mark
Edit: Are you saying this house was moved once, and is now being moved again?

Dr PR

#9
I have installed V22.0 5/16/2012 and have been experimenting with the shading problem.

Note: Perspective view with a view distance of 1000 (drawing size 516x323x336). All parts of the drawing have a positive Y coordinate - nothing is below the Y=0 plane.

Changing the angle of the light source does not affect the problem.

Adding a second Directional Light doesn't change the problem.

Disabling "Move with eye" doesn't help.

Adding a Spot Light shining directly onto the deck doesn't change the problem.

Changing the view distance from 1000 to 100,000 does solve the problem (the deck renders the correct color at all angles).

Changing to Isometric or Parallel view fixes the problem.

"Set View by Drawing Center" and "Set View by View Center" both cause the problem.

****

So the problem seems to be related to Perspective view. If the vertical viewing angle (view rotation about the X axis - the second number from left in the View Toolbox) goes negative the deck becomes black. If it goes positive the deck is rendered correctly. This definitely seems to be a part of the problem. View rotation about the Y axis has no effect.

I have no idea what the negative view angle means since in both cases the view is from above the deck.

I thought maybe it had something to do with the drawing center, so I drew a cube 1000 inches below the bottom of the house. The drawing center should be far below the house. Now when I rotate a close-up view with a view distance of 1000 the deck renders correctly (no negative vertical angle) but some of the panels on the balcony ceiling that are angled at 45 degrees to the vertical turn black as the drawing is rotated, even though the angle between the viewpoint and the surfaces is quite large! Also, the perspective is really screwed up because of the cube 1000 inches below the house.

The problem seems to have something to do with the relationship of the viewpoint with the drawing center.

Phil
DesignCAD user since 1987

MarkX

Does it work better in parallel view?

Mark

Dean

With the light source options window open you can view most adjustments on lights (except shadows)in real-time (after clicking apply) with graphic acceleration enabled. I like using colors assigned to lights because I can see the intensity and placement of each light. Then when I am satisfied with the results I change them back to a more neutral color of white or gray and perform a phong render. Also before doing a render I am totally aware of the x,y,z coordinates of the object being rendered. I think the lights are calculated from 0,0,0. At least this does follow some sort of formula.  It would be an added bonus if you could view the shadow adjustments with the light source options window open.
DesignCad 3D max 2021
Lenovo 17.3"Laptop Intel(R) Core(TM) i7-9750H CPU @ 2.6GHz/Turbo boost 6 cores 12 threads.16GB memory.SSD 256GB/HDD 1TB 7200 Rpm.Nvidia Graphics GeForce GTX 1660 Ti 6GB
Windows 10 Home 64 bit

Dr PR

Dean,

Thanks. I do adjust lights in Gouraud mode with graphics acceleration enabled. The Light Source dialog "Apply" button adjusts the light in real time. You can't see shadows, but I have rendered so many times I can pretty much tell what the shadows will look like from the lighting angles in Gouraud mode.

I normally use only one light because most of my scenes are outside. I want to simulate direct sunlight, so I don't want more than one Directional Light. I have the Ambient slider set to maximum and this gives a bit of surround light, but it is a poor substitute for true skylight. I always use "Move with eye" because it makes it unnecessary to worry about object coordinates and light source coordinates. No matter how you rotate the view the side facing the viewpoint will be illuminated. I do fiddle with horizontal and vertical angles a bit to fine tune the shadows.

There was a time several versions ago when DT cautioned us to use only Directional Lights. The other types were really screwing up rendering. I don't know if the problems have been fixed - I haven't heard anything more.

Phil
DesignCAD user since 1987