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.

Square or Hexagonal Shadow Generator (Virtual)

Started by samdavo, December 12, 2015, 04:54:13 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

samdavo

Another project for the Xmas hols :)
A square (or hexagon?) grid shadow generator.

I saw one of these printed with a 3D printer, but to be honest, in reality, you need a very small bright omni-directional light (not as easy).

HOWEVER, in the virtual world of DCAD - with shadows cast from a single light -  it should be "fairly easy" to replicate these pictures (I would have thought ?).   Given enough time and inclination :)   Cheers

PS Isn't that what Big Ben said to the Leaning Tower of Pisa - (?)
Something about "If you've got the inclination, I've got the time".

Adrian 2.0

Here you go!
Now, what am I going to do with the rest of Christmas?
The process:
Lay out a grid of hexagons and construct a sphere above the centre of one, then draw a 6 sided cone on each hex and gather the apexes together at the north pole of the sphere. ( I constructed one 90 degree segment then arrayed them to save time)
Combine the cones into one solid and subtract that from the sphere.
Construct a second smaller sphere with it's centre at the north pole of the first. (This is the origin in the drawing - makes placement of the light source easy)
Subtract that from the first sphere and add a point light at the origin.

I could've constructed a third sphere which was concentric with the first and subtracted that to give a constant thickness 'shell' but it'd make no difference to the shadow generated & this model gives a graphic description of how it works.

Your ball Sam... 8)

Adrian 2.0

Note that there is a glitch in the shadow at about 3 o'clock in the pic. - A rectangle has snuck in in one of the hexagon illuminations.
I have no idea where it has come from, I can't see any obstructions in any of the holes in the sphere. It seems to be a DesignCad specialty, getting everything nearly right....

Dr PR

If you look closely at the perforated sphere you can see an extra red facet on the left. I would guess this is caused by a reversed normal for that surface. This will cause the shadow to be projected in an "opposite" direction from where it should be. This is caused by a bug in the solid Boolean functions (mainly Solid Subtract and Solid Add).

Each side of the hexagonal tubes casts a shadow into the solid where in effect it is projected onto an inside surface (invisible from the outside). Instead this one has been projected outside the solid. If you explode the solid, delete this red facet and redraw it as a simple plane the wayward shadow should go away.

I see this all the time in my shaded images of my ship model - I have posted several examples on the forum. There are millions of facets in these large drawings and there is always a stray shadow. I have spent days tracking down and fixing mangled solids. I have one if these in my current drawing (about 120 Mbytes and growing) and I have redrawn almost everything at least once trying to find the bad solid. PITA!

Phil
DesignCAD user since 1987

samdavo

#4
Well done Adrian :)   You seem to have chosen 18-fold symmetry when rotating about the vertical axis XXX (edit) make that 6 fold, but 36 lines of longitude ... ( gemology terminolgy - I think ? lol) - makes sense - I think bees learnt that trick (with packed hexagons) a while back :)

and thanks Phil.
As you say, the small flaw in the shadow on the floor is puzzling.  I am still searching for the plane that you refer to.

I thought if I exported to SketchUp it might make it easier to find.  When I did I found (after that process) some missing planes, but nothing that would cause problems (that I can figure any way).
   
Just for interest, when SU opens the exported SKP file, you are presented with the following list of "complaints".  I am not convinced that this is a problem within DCAD, nor within SU, just some compatibility thing (my guess - pure guesswork).

Results of Validity Check.
*** Problems were found that could not be fixed! ***

The name for CLayer (13) is not valid
The start and end vertices are identical for CEdge (10444)
Entity CEdge (10444) should be erased - done
The start and end vertices are identical for CEdge (11545)
Entity CEdge (11545) should be erased - done
The start and end vertices are identical for CEdge (14835)
Entity CEdge (14835) should be erased - done
The start and end vertices are identical for CEdge (15576)
Entity CEdge (15576) should be erased - done
The start and end vertices are identical for CEdge (11159)
Entity CEdge (11159) should be erased - done
The start and end vertices are identical for CEdge (17462)
Entity CEdge (17462) should be erased - done
The start and end vertices are identical for CEdge (6681)
Entity CEdge (6681) should be erased - done
The start and end vertices are identical for CEdge (7314)
Entity CEdge (7314) should be erased - done
The start and end vertices are identical for CEdge (18524)
Entity CEdge (18524) should be erased - done
The start and end vertices are identical for CEdge (19071)
Entity CEdge (19071) should be erased - done
The start and end vertices are identical for CEdge (9386)
Entity CEdge (9386) should be erased - done
The start and end vertices are identical for CEdge (19255)
Entity CEdge (19255) should be erased - done
Edges are not connected in CLoop (6679) for CFace (6678)
Loop 0 of CFace (6678) is an invalid outer loop
Entity CFace (6678) should be erased - done
Edges are not connected in CLoop (7312) for CFace (7311)
Loop 0 of CFace (7311) is an invalid outer loop
Entity CFace (7311) should be erased - done
Edges are not connected in CLoop (9384) for CFace (9383)
Loop 0 of CFace (9383) is an invalid outer loop
Entity CFace (9383) should be erased - done
Edges are not connected in CLoop (11157) for CFace (11156)
Loop 0 of CFace (11156) is an invalid outer loop
Entity CFace (11156) should be erased - done
Edges are not connected in CLoop (11855) for CFace (11854)
Loop 0 of CFace (11854) is an invalid outer loop
Entity CFace (11854) should be erased - done
Edges are not connected in CLoop (14832) for CFace (14831)
Loop 0 of CFace (14831) is an invalid outer loop
Entity CFace (14831) should be erased - done
CLoop (15566) for CFace (15565) is not closed
Loop 0 of CFace (15565) is an invalid outer loop
Entity CFace (15565) should be erased - done
CLoop (16808) for CFace (16807) is not closed
Loop 0 of CFace (16807) is an invalid outer loop
Entity CFace (16807) should be erased - done
Edges are not connected in CLoop (17457) for CFace (17456)
Loop 0 of CFace (17456) is an invalid outer loop
Entity CFace (17456) should be erased - done
CLoop (18513) for CFace (18512) is not closed
Loop 0 of CFace (18512) is an invalid outer loop
Entity CFace (18512) should be erased - done
CLoop (18593) for CFace (18592) is not closed
Loop 0 of CFace (18592) is an invalid outer loop
Entity CFace (18592) should be erased - done
Edges are not connected in CLoop (18686) for CFace (18685)
Loop 0 of CFace (18685) is an invalid outer loop
Entity CFace (18685) should be erased - done
CLoop (19060) for CFace (19059) is not closed
Loop 0 of CFace (19059) is an invalid outer loop
Entity CFace (19059) should be erased - done
CLoop (19246) for CFace (19245) is not closed
Loop 0 of CFace (19245) is an invalid outer loop
Entity CFace (19245) should be erased - done
Edges are not connected in CLoop (19534) for CFace (19533)
Loop 0 of CFace (19533) is an invalid outer loop
Entity CFace (19533) should be erased - done
Edges are not connected in CLoop (19811) for CFace (19810)
Loop 0 of CFace (19810) is an invalid outer loop
Entity CFace (19810) should be erased - done
Edges are not connected in CLoop (19871) for CFace (19870)
Loop 0 of CFace (19870) is an invalid outer loop
Entity CFace (19870) should be erased - done
Edges are not connected in CLoop (20164) for CFace (20163)
Loop 0 of CFace (20163) is an invalid outer loop
Entity CFace (20163) should be erased - done
Edges are not connected in CLoop (20447) for CFace (20446)
Loop 0 of CFace (20446) is an invalid outer loop
Entity CFace (20446) should be erased - done
Edges are not connected in CLoop (20508) for CFace (20507)
Loop 0 of CFace (20507) is an invalid outer loop
Entity CFace (20507) should be erased - done
Edges are not connected in CLoop (20867) for CFace (20866)
Loop 0 of CFace (20866) is an invalid outer loop
Entity CFace (20866) should be erased - done
Edges are not connected in CLoop (21236) for CFace (21235)
Loop 0 of CFace (21235) is an invalid outer loop
Entity CFace (21235) should be erased - done
Edges are not connected in CLoop (21295) for CFace (21294)
Loop 0 of CFace (21294) is an invalid outer loop
Entity CFace (21294) should be erased - done
Edges are not connected in CLoop (21667) for CFace (21666)
Loop 0 of CFace (21666) is an invalid outer loop
Entity CFace (21666) should be erased - done

samdavo

#5
Anyway I deleted all planes except the outer skin, and came up with the following images :-

The first has no shadows on the far wall, but (I presume ?) that is because there is a directional light (H=0, V=0) which is illuminating the wall (with shadows tuned off).

The second is the same, with that directional light turned off (2 cents)

samdavo

#6
Here's another view with the addition of a spotlight at the front left corner of the room pointed at the centre of the "object", with a spot cutoff angle of 10 degrees  (2 cents)

PS All these things (with shadows) are pretty easy with DCAD - and I'm not even sure if Sketchup can do them - (?) Certainly I can't with SU lol.  Apologies if others can.  (edit)  When I say they are pretty easy, lol, I didn't mean to infer that they always come out as easy as they did on this occasion.  There are a few small problems that can creep in, of which anyone who has tried fancy shadows will be aware. :)

Dr PR

Sam,

It looks like you got rid of the offending plane when you deleted the guts of the sphere.

Often when the solid Boolean operations screw up the normals they also change the material of the aberrant polygon to "Aluminum" and/or move the polygon to layer zero. This makes it pretty easy to find them (I never use layer zero so anything that appears there is due to a bug.

Phil
DesignCAD user since 1987

samdavo

#8
Certainly not meaning to be picky / pedantic.  And thanks again to adriank for his speedy acceptance of the challenge (which I finally managed to emulate from first principles lol - I can easily draw it - enclosed - but  the shadows were a bit tricky :) ).   

But on another matter, I simply want to demonstrate the ease of checking faces (including any reversed faces) after exporting to SketchUp.   Herewith his drawing when exported to SU, then viewed with Faces\Monochrome.   I don't find any ADDITIONAL faces, but there are a couple MISSING (2 cents) - not that they matter a damn for the purpose of creating that shadow pattern (because they are just lining some of the hexagonal radiating pyramids).

The reason there is some dark blue there is that you are looking at the inside of a similar face beyond it - which is all as it should be. (ie all you have to do is add those missing faces, which would cover up the dark blue faces).

This is irrelevant for the shadow effect.  HOWEVER, it would have to be fixed up if you wanted to 3D-print it.

PS Certainly there are no planes blocking any of the hexagonal holes (which is implied by that additional bit of shadow).     

(edit) oops, the location (height) of the point-light is incorrect.  I post a corrected version in another post below.  However, I will leave this as well, because this DOESN'T have a problem with phantom or missing shadows, whereas the corrected one (below) does. (?)

samdavo

#9
Here's the second "bowl" (drawn by me) as seen in SU  - with shadows turned on (directional light as cast by the sun, with the month and time of day for that latitude as set by Geolocation).  It's OK to a point, ...   EXCEPT lol, that it misses the objective of the single light source casting the shadow pattern.   Probably my limited knowledge of SU is to blame.  :)

Dr PR

Sam,

You are right that the wayward shadow appears to be from something blocking the hole - but only if shadows are working correctly.

But they aren't. This little conundrum has sent me on many wild goose chases looking for surfaces that don't exist - no idea how many hours I have wasted looking for the "obvious."

But in this case there are no surfaces blocking an opening. That's what makes it so difficult to find the offending surface with a reversed normal.

I have found that if you rotate the viewpoint and generate successive shaded images with the "Move with Eye" option enabled in the "Options/Options/Light Source" dialog you can eventually get an idea of where the offending surface is located. A line from the shadow to the light source will pass through the offending surface. By carefully examining multiple images you can "triangulate" these shadow-light lines to get an idea of the location of the offending surface.

Also, the shape of the shadow will give you an idea of the shape of the abnormal surface.

Keep in mind that the shadow is not necessarily being cast by any visible surface. Internal surfaces in solids can cast wayward shadows and objects far removed from those being viewed may be the source of these shadows.

Phil
DesignCAD user since 1987

samdavo

#11
Corrected version (with point-light height at the correct position) ...
but with missing bits of shadow near the front (?)

Hence Phil, I have to agree, finding the source of that problem / these sorts of problems will not be easy.

Adrian 2.0

I've not had any spare time to do much investigation since I built that original model, but I can say that the red facet in one of the holes in my model was not the offending element causing the rogue shadow. I exploded the solid and deleted that surface but the extra shadow remains.
I agree with Phil - the shadow is not caused by a surface that should not be there, rather it is the wrong properties on one element that causes the shadow to project backwards. I've struggled with this for a long time now & I've posted examples in the past of shadows projecting onto other surfaces in the model.
Sam, I don't think that exporting to Sketchup and looking for the missing surfaces necessarily finds the faulty surface because I tend to get a lot of missing surfaces that need to be 'repaired' in Sketchup that don't cause any problems with my models in DCad.
Using 'solid subtract' to make penetrations through elements does massively raise the chance of SKP having missing faces, so I'm thinking that there is some issue with that function in DCad.
I now try any way I can to build models without using solid subtract if I know I'm going to export it. That's unfortunate because solid subtract is a very powerful & quick tool & building up elements with penetrations in sections & using solid add to connect them is a lot more time consuming - but it does give a clean model to export.

samdavo

Thanks again Adrian and Phil,
FWIW, I was able to correct both drawings (yours with extra shadow, and mine with missing shadow), by deleting the half of the object that had that problem, and mirroring the good half.  (2 cents)

"If your left arm offends thee, cut it off"  as they say.  (Old Testament? - not sure - somewhere  :) )