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: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: shadows in the freecad viewport

Post by paullee »

Thanks, that's tricky :D

I meant I want the shadow edge be more sharp / straight.

I try Spotlight which gives a more shape edge, but it is not natural as the cone of light is too narrow...

When set the Cut Off Angle from 45 deg to say 75 deg, the edge become blurred again :(

Screenshot from 2020-06-15 01-32-04.png
Screenshot from 2020-06-15 01-32-04.png (615.3 KiB) Viewed 3859 times
Screenshot from 2020-06-15 01-48-12.png
Screenshot from 2020-06-15 01-48-12.png (373.42 KiB) Viewed 3859 times
Screenshot from 2020-06-15 01-46-18.png
Screenshot from 2020-06-15 01-46-18.png (394.17 KiB) Viewed 3859 times
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: shadows in the freecad viewport

Post by realthunder »

paullee wrote: Sun Jun 14, 2020 5:52 pm I meant I want the shadow edge be more sharp / straight.
Then, you need to turn off SpreadSize and SpreadSampleSize, set Precision to 1.0, and change Smooth Border. There is something not quite right with the smooth border at the moment. I'll fix it soon.
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
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: shadows in the freecad viewport

Post by realthunder »

paullee wrote: Sun Jun 14, 2020 5:52 pm I meant I want the shadow edge be more sharp / straight.
Image 0615 released. Here is shadow with SmoothBorder 2, followed by comparison without SmoothBorder
Screenshot from 2020-06-16 05-40-16.png
Screenshot from 2020-06-16 05-40-16.png (311.69 KiB) Viewed 3772 times
Screenshot from 2020-06-16 05-54-17.png
Screenshot from 2020-06-16 05-54-17.png (283.11 KiB) Viewed 3772 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
paullee
Veteran
Posts: 5098
Joined: Wed May 04, 2016 3:58 pm

Re: shadows in the freecad viewport

Post by paullee »

Thanks :)

It helps in some way, with Smooth Border, the anti-aliasing -look edges becomes less sharp though.

For a shadow at a distance, the one cast on the ground, it look sharper. For the one on the building rooftop, the anti-aliasing steps are quite big that it needs a much higher Smooth Border figures to 'smooth' it out while it blur in another way.

See any other thing else I can help testing.



Screenshot from 2020-06-17 06-19-24.png
Screenshot from 2020-06-17 06-19-24.png (390.24 KiB) Viewed 3686 times
Screenshot from 2020-06-17 06-20-14.png
Screenshot from 2020-06-17 06-20-14.png (417.96 KiB) Viewed 3686 times
Screenshot from 2020-06-17 06-20-52.png
Screenshot from 2020-06-17 06-20-52.png (459.9 KiB) Viewed 3686 times
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: Mon Jun 15, 2020 9:57 pm
I love the ground back face culling. It completes the shadow on the transparent ground mode. Also the light manipulator is a more than welcomed addition. Thank you.

Given that you layed such a solid ground for the "shadow" display mode don't you think that this should evolve into it's own workbench where the user can add multiple lights, environment and ground textures etc . Something similar to the "texture addon" . Hopefully in the future we could add materials and textures to 3d objects not only to the ground. The workbench could be called "texturing and lighting" and in my opinion, taking this route would brake all the settings regarding texturing and lighting for a scene into more manageable and ordered chunks. Just a thought.

Also your branch touches so many aspects of the Freecad experience that reporting bugs or asking for features becomes difficult to do in a thread like this one because it may touch other aspects , not only the shadow mode. Similarly for the overlay mode thread. Could you please open a thread in the "developers corner" sub forum where we can discuss about your development branch and not flooding the individual features threads if that is necessary.

For now I continue to report some issues I have found here lol....

phpBB [video]



min. 00.12 -Minor issue, translucent bodies don’t cast any shadow.

min. 00.24 -Upon reopening a file, transparent bodies don’t display the transparency either in “as is” or “shadow” display mode restoring it only after tweaking the transparency value.

min. 01.00 -This is my biggest issue so far as the F16 project has become a test bed for me using your branch. The visibility issue displayed here has brought me to a halt because I can't map LCS's to features of the underlying bodies.
Adding a asm4 “model” will change the behavior of the edit mode visibility setting for the underlying bodies. At times it is enough to press the space bar to re enable the visibility of the previous feature but in the case of LCS’s it is imposible to re enable the visibility.
This renders impossible to map or alter the mapping of sketches, datum or LCS’s etc. because the underlying feature is not visible and nothing can be selected. Unfortunately , this behavior is present only in your branch and not in FC trunk .

min. 02.07 -Again, transparent objects wont display correctly when reopening a file.

min. 02.13 -Feature request. Can we please have the “shadow” display mode respect the individual bodies shading mode selected in the body properties. In this particular example I would like the canopy to display withbought the flat lines but the rest of the model with. This is possible in the “as is” display mode.

min. 02.39 -The overlay display for the combo view enables all panels. After disabling them one by one toggling the overlay re enables all of them forcing the user to go and disable them one by one. The overlay display should remember the settings of the displayed panels.

Thank you for preparing FC for the next big release :D
F16.jpeg
F16.jpeg (277.52 KiB) Viewed 3596 times
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: Sun Jun 21, 2020 9:27 pm Given that you layed such a solid ground for the "shadow" display mode don't you think that this should evolve into it's own workbench where the user can add multiple lights, environment and ground textures etc . Something similar to the "texture addon" . Hopefully in the future we could add materials and textures to 3d objects not only to the ground. The workbench could be called "texturing and lighting" and in my opinion, taking this route would brake all the settings regarding texturing and lighting for a scene into more manageable and ordered chunks. Just a thought.
That is certainly on my todo list. In fact, I was quite drawn to rendering and stuff after having so much fun playing around with shadows. I feel that Coin3D, despite being 'outdated', still has its potential.

Also your branch touches so many aspects of the Freecad experience that reporting bugs or asking for features becomes difficult to do in a thread like this one because it may touch other aspects , not only the shadow mode. Similarly for the overlay mode thread. Could you please open a thread in the "developers corner" sub forum where we can discuss about your development branch and not flooding the individual features threads if that is necessary.
I alway try to keep this thread about 'Shadows' only. And yes, other features should have their own thread. Feel free to open new thread if you see fit.

I have fixed most of the issues you mentioned pretty quickly, but got stuck with the transparent object shadow casting. It is really a feature request, as Coin3D explicitly turned off shadow for transparent objects. After some struggling, I finally got it working. Now looking back, it is actually not that difficult, once I get used to all those OpenGL and shader stuff. I think I've gained enough experience to try some other advanced effects, maybe ambient occlusion as you mentioned.

New image not ready yet. stay tuned.
Screenshot from 2020-06-28 14-16-03.png
Screenshot from 2020-06-28 14-16-03.png (62.65 KiB) Viewed 3460 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 »

realthunder wrote: Sun Jun 28, 2020 9:05 am
I'm reading on the various threads where i have stalked you.....and all I can say is THANK YOU.
And I will thank you in every individual thread :lol:
Check out my Youtube channel at: https://www.youtube.com/@OficineRobotica
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: shadows in the freecad viewport

Post by pablogil »

This semitransparent shadows are amazing!!

If you get ambient occlusion working it would be really game changing.

As OficineRobotica, I’m throwing you an idea: what about scriptable materials? I’m not talking about Blender’s node system (that would be awesome but a huge work) but something easy to setup that would work... maybe importing the shaders from another software...

Again, thanks for your great visual work, I’m sure it will help FreeCAD reach new levels and toons of new users.

Cheers
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: shadows in the freecad viewport

Post by pablogil »

OficineRobotica wrote: Sun Jun 28, 2020 10:08 am
realthunder wrote: Sun Jun 28, 2020 9:05 am
I'm reading on the various threads where i have stalked you.....and all I can say is THANK YOU.
And I will thank you in every individual thread :lol:
+1
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
realthunder
Veteran
Posts: 2190
Joined: Tue Jan 03, 2017 10:55 am

Re: shadows in the freecad viewport

Post by realthunder »

New image released.

Transparent shadow is controlled by a new document parameter 'Transparent shadow'. It is by default off because it takes a bit more overhead when enabled. You can find the same parameter in draw style preference setting. The picture I posted previously had some issue with color blending. The shadowed part should never be brighter than the non-shadowed part. The transparent shadow will gradually lose its color and fade to dark grey when decreasing the transparency of the casting object.
Screenshot from 2020-07-06 17-18-17.png
Screenshot from 2020-07-06 17-18-17.png (158.54 KiB) Viewed 3188 times

Another new parameter to control the display mode while in shadow draw style. Again, you can preset it in preference dialog.
Screenshot from 2020-07-06 17-20-31.png
Screenshot from 2020-07-06 17-20-31.png (21.44 KiB) Viewed 3188 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
Post Reply