shadows in the freecad viewport

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
paullee
Veteran
Posts: 5118
Joined: Wed May 04, 2016 3:58 pm

Re: shadows in the freecad viewport

Post by paullee »

Thanks :)
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: shadows in the freecad viewport

Post by realthunder »

Image updated.

I have included my patched Coin3D. Bump map shall work now.

I have added another patch to implement the transparent shadow feature, requested by @pablogil.

It is controlled by GroundTransparency property. Set it to 1.0 to make the ground completely transparent. Only the shadowed part of the ground will be shown with some transparency. It works better if you set your ground color the same as your background (or darker). The ground transparency can be pre-set in the draw style preference dialog.
Screenshot from 2020-05-22 19-57-43.png
Screenshot from 2020-05-22 19-57-43.png (97.56 KiB) Viewed 1831 times
shadow-transparency.gif
shadow-transparency.gif (279.19 KiB) Viewed 1831 times
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
OficineRobotica
Posts: 433
Joined: Thu Feb 21, 2019 8:17 am
Contact:

Re: shadows in the freecad viewport

Post by OficineRobotica »

The ability to set defaults for the shadowed mode is so handy. Thank you. This is getting better and better. Just out of curiosity. Having a patched coin3d has any disadvantages? That is...if someone what's to compile FC does it have to always patch coin3d and compile that as well?
Check out my Youtube channel at: https://www.youtube.com/@OficineRobotica
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: shadows in the freecad viewport

Post by realthunder »

OficineRobotica wrote: Sat May 23, 2020 8:07 am The ability to set defaults for the shadowed mode is so handy. Thank you. This is getting better and better. Just out of curiosity. Having a patched coin3d has any disadvantages? That is...if someone what's to compile FC does it have to always patch coin3d and compile that as well?
No, the patch is optional. FreeCAD code compiles the same with or without it. I will submit the patch to Coin3D upstream once it is matured, but there is no guarantee that they'll accept it.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
carlopav
Veteran
Posts: 2062
Joined: Mon Dec 31, 2018 1:49 pm
Location: Venice, Italy

Re: shadows in the freecad viewport

Post by carlopav »

With:

Code: Select all

OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.20886 +2287 (Git)
Build type: Release
Branch: LinkStage3
Hash: 5f7898eae20e4e8ef3e6190ad8b354e23bbf66e7
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Italian/Italy (it_IT)
Really cool!
Tried to apply a normal map to the ground, and it is correctly displayed!
When the ground has the normal map, it does not receive the shadow anymore.
follow my experiments on BIM modelling for architecture design
User avatar
pablogil
Posts: 882
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: shadows in the freecad viewport

Post by pablogil »

Oh yeah!!
Working like a charm, really cool build, congrats!

More Santa Claus wishes:
  • option to tweak the bump height (intensity)
  • "ground auto position" to FC preferences... maybe all ground and shadow parameter fit into FC preferences as they are something that the user would like the same in all his projects and, so that, he would like to have a global default.
  • IMHO shadows are not a "draw mode" but an option into the "draw mode" list, I mean, I would like to be able to choose if turn the shadows ON or OFF for all the draw modes (as is, Points, Wireframe, Hidden Line, etc...). I don't know if I would move this option out of the "draw mode" list and place it inside "View" menu or keep it there but as a checkbox button (if it's possible, or course)
Anyway, your images are my default FreeCAD build by now ;)
Thanks!
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
nic
Posts: 136
Joined: Thu Apr 18, 2019 1:14 pm
Location: France

Re: shadows in the freecad viewport

Post by nic »

pablogil wrote: Sat May 23, 2020 9:50 pm your images are my default FreeCAD build by now ;)
By the way, I personally wish I could use this appimage as default Freecad, but I always wondered if the files made with this appimage are guaranteed to work with "main stream" daily Freecad?
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: shadows in the freecad viewport

Post by realthunder »

nic wrote: Sun May 24, 2020 8:29 am By the way, I personally wish I could use this appimage as default Freecad, but I always wondered if the files made with this appimage are guaranteed to work with "main stream" daily Freecad?
There is certainly no guarantee of that, because many features are missing in upstream. Opening files from upstream should have no problem. My fork is probably just a few weeks behind the upstream. If you uses the common feature set of my fork and the upstream, then the file should be interchangeable, and if you find any problem, I'll fix it.
Try Assembly3 with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
User avatar
pablogil
Posts: 882
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: shadows in the freecad viewport

Post by pablogil »

pablogil wrote: Wed May 20, 2020 2:08 pm I have just found another lighting issue: depending on the camera point of view, not only the ground surface is shadowed differently, but the shadow itself too:
1.jpg
2.jpg
3.jpg
From a top view the shadow even dissapears...
I think I have a new clue about this issue: the shadow is behaving as a normal "shaded face", it means it will be shaded depending on the position of light and view. The casted shadow, at least when displayed with the ground disabled, should behave as a "shadeless face". Could this be done?

Cheers
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
OficineRobotica
Posts: 433
Joined: Thu Feb 21, 2019 8:17 am
Contact:

Re: shadows in the freecad viewport

Post by OficineRobotica »

realthunder wrote: Sat May 23, 2020 8:20 am

Taken from here.
https://forum.freecadweb.org/viewtopic. ... 10#p402123

At least on that model I get a big performance difference in frame rate between regular and spotlight. Usually the spotlight is 10x faster than regular light. I get around 3 to 10 fps when navigating the 3d viewport when using the regular light whereas I get a minimum of 30fps with the spotlight on the same scene and same machine . For my usual modeling(mechanical) I prefer the spotlight but that doesn't play really well with architectural models where the regular light makes more sense.

Also, if you have the time, can we get a better explanation of the shadow properties like epsilon, precision, quality, and spotlight cutoff angle, spotlight dropoff rate. With some of these properties I get more of an on/off effect when modifieng the values and I can't really understand they'r use.

Thank you for your hard work.
Check out my Youtube channel at: https://www.youtube.com/@OficineRobotica
Post Reply