Solar diagrams

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: Solar diagrams

Post by pablogil »

I also would like to see any kind of shadows, as @saso says it's not necessary that they are real light projections. Actually, Inventor and Solidworks use fake shadows...
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Solar diagrams

Post by microelly2 »

easy to do are projections of the objects to other faces and create fake shadows (like Facebinder objects or Shape2dView) this way:

http://freecadbuch.de/doku.php?id=blog: ... te_flaeche

can this be a way?
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: Solar diagrams

Post by pablogil »

microelly2 wrote:easy to do are projections of the objects to other faces and create fake shadows (like Facebinder objects or Shape2dView) this way:

http://freecadbuch.de/doku.php?id=blog: ... te_flaeche

can this be a way?
I would say it's a nice start, yes, it could work.
Is it possible to make the light source (yellow point of your experiment) "cast" shadows to all object in the scene? or maybe just a selection (maybe as a parameter list of the yellow point)?
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Solar diagrams

Post by microelly2 »

pablogil wrote:
microelly2 wrote:easy to do are projections of the objects to other faces and create fake shadows (like Facebinder objects or Shape2dView) this way:

http://freecadbuch.de/doku.php?id=blog: ... te_flaeche

can this be a way?
I would say it's a nice start, yes, it could work.
Is it possible to make the light source (yellow point of your experiment) "cast" shadows to all object in the scene? or maybe just a selection (maybe as a parameter list of the yellow point)?
May be, I will test it.
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: Solar diagrams

Post by pablogil »

microelly2 wrote: May be, I will test it.
Great :D
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Solar diagrams

Post by microelly2 »

for planar faces it will work
Attachments
bp_244.png
bp_244.png (16.37 KiB) Viewed 2857 times
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: Solar diagrams

Post by pablogil »

microelly2 wrote:for planar faces it will work
Very cool!

I was thinking about the "fast or fake" shadows inside FreeCAD:
  • wouldn't it be faster and easier to cast a shadow based on a direction (directional light) instead of a point (point light)? I have read they are normally less CPU consuming than point light "algorithms"
  • would it be possible to have the shadows casted on an invisible floor placed on XZ (or configurable) plane?
  • is it possible to apply kind of a FX to blur the casted shadow object?
  • and/or set transparency to it?
Thanks
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Solar diagrams

Post by microelly2 »

pablogil wrote:
microelly2 wrote:for planar faces it will work
Very cool!

I was thinking about the "fast or fake" shadows inside FreeCAD:
  • wouldn't it be faster and easier to cast a shadow based on a direction (directional light) instead of a point (point light)? I have read they are normally less CPU consuming than point light "algorithms"
I use plane.Shape.makePerspectiveProjection and can replace it by the parallelProjection method
[*]would it be possible to have the shadows casted on an invisible floor placed on XZ (or configurable) plane?
the shadows are face objects and can be placed anywher
[*]is it possible to apply kind of a FX to blur the casted shadow object?
[*]and/or set transparency to it?[/list]
Thanks
will be configuable,

the problems I see are nonplanar faces and shadows over edges.
these will need extra programming and cpu time to calculate
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Solar diagrams

Post by yorik »

it is not hard to fake shadows, but it can become very slow for huge documents... I would still like to be able to do it the Coin way, because modern GPUs can compute shadows very fast.

But fake shadows like microellys can be a good alternative. Especially that what takes a lot of time is unioning all the projected faces, but if you paint them all in a same color and set them in Shaded display mode, maybe there is no need to union them...

Also, then these shadows might be placed on a TechDraw doc! How cool would that be! 8-)
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Solar diagrams

Post by microelly2 »

These are the profiler data for my test

most time is needed for Part.show the projected wire,
I need this for Draft update
Can I update a shape on the direct way? Maybe I modify the Draft.update method

the big recompute at the end is needed
and the cleanup remove objects can be eleminated when I can update


ncalls tottime percall cumtime percallfilename:lineno(function)
1 0.041 0.041 6.563 6.563<input>:1(runall)
95 0.000 0.000 0.162 0.002<input>:10(delo)
1 0.000 0.000 6.563 6.563<string>:1(<module>)
8 0.000 0.000 0.000 0.000Draft.py:169(getType)
104 0.011 0.000 0.248 0.002Draft.py:2832(upgrade)
8 0.002 0.000 0.009 0.001Draft.py:2899(closeWire)
94 0.058 0.001 0.130 0.001Draft.py:3002(makeFaces)
2 0.000 0.000 0.002 0.001Draft.py:3020(makeWires)
511 0.003 0.000 0.003 0.000DraftGeomUtils.py:188(geomType)
104 0.000 0.000 0.001 0.000DraftTools.py:77(translate)
104 0.000 0.000 0.003 0.000DraftTools.py:81(msg)
2 0.000 0.000 0.000 0.000{FreeCAD.activeDocument}
104 0.003 0.000 0.003 0.000{__FreeCADConsole__.PrintMessage}
10 0.000 0.000 0.000 0.000{built-in method __sortEdges__}

94 3.099 0.033 3.099 0.033{built-in method show}

623 0.000 0.000 0.000 0.000{isinstance}
443 0.000 0.000 0.000 0.000{len}
106 0.081 0.001 0.081 0.001{method 'addObject' of 'App.Document' objects}
1150 0.000 0.000 0.000 0.000{method 'append' of 'list' objects}
1 0.000 0.000 0.000 0.000{method 'disable' of '_lsprof.Profiler' objects}
104 0.000 0.000 0.000 0.000{method 'encode' of 'unicode' objects}
314 0.000 0.000 0.000 0.000{method 'extend' of 'list' objects}
1020 0.000 0.000 0.000 0.000{method 'hashCode' of 'Part.Shape' objects}
189 0.001 0.000 0.001 0.000{method 'hide' of 'Gui.ViewProvider' objects}
114 0.001 0.000 0.001 0.000{method 'isClosed' of 'Part.Shape' objects}
214 0.000 0.000 0.000 0.000{method 'isDerivedFrom' of 'Base.BaseClass' objects}

376 0.770 0.002 0.770 0.002{method 'makePerspectiveProjection' of 'Part.Shape' objects}

1 2.223 2.223 2.223 2.223{method 'recompute' of 'App.Document' objects}

199 0.250 0.001 0.250 0.001{method 'removeObject' of 'App.Document' objects}

1 0.016 0.016 0.016 0.016{method 'removeSplitter' of 'Part.Shape' objects}
104 0.000 0.000 0.000 0.000{method 'startswith' of 'str' objects}
8 0.000 0.000 0.000 0.000{method 'toShape' of 'Part.GeomCurve' objects}
1 0.000 0.000 0.000 0.000{range}
104 0.001 0.000 0.001 0.000{translate}

But the quality is okay:
shadows on a transparent background
]
bp_246.png
bp_246.png (20.62 KiB) Viewed 2811 times
Post Reply