Hi david,
I think, you have posted in the wrong thread?!
Hi david,
Does the final result have a wrong spotlight or is the spotlight only displayed wrongly in the FreeCAD window (since there were some problems with displaying spotlights in the past already)?
Yes, you can adjust the mesh resolution by selecting the object, going into the "View" tab of the object properties and change the values of "Angular Deflection" and "Deviation", they are used by the workbench when creating the mesh.Zoltan wrote: ↑Thu Jun 02, 2022 10:10 pm My other question is related to mesh resolution. My surfaces are B-spline surfaces, which are not supported directly (would it be difficult to implement?). Rather, the surfaces are first meshed. How can I change the mesh density? In its current form, it is very crude, leading to an ugly result.
As far as I know, there is no option to keep showing the surface edges during rendering since POV-Ray focused on rendering and not modeling. If it's really important maybe you can try to sweep a small circle along the edges and give the sweep a dark color but I admit that this is a very crappy solution
I checked it by placing the light sources "below" the geometry. First test: spotlight. Apparently, the object is not lit. Then I used area light at the same placement as the spotlight. Here, the rendered result is believable. For reference, here is the FreeCAD-rendered result, where the light source seems to coincide with the camera view.The_Raytracers wrote: ↑Sun Jun 05, 2022 3:30 pm Does the final result have a wrong spotlight or is the spotlight only displayed wrongly in the FreeCAD window (since there were some problems with displaying spotlights in the past already)?
It greatly improved the result. However, the minimum value is 5° for the angular deflection and 0.05 for the deviation. Is there a (possibly undocumented) way to go below these values?The_Raytracers wrote: ↑Sun Jun 05, 2022 3:30 pm Yes, you can adjust the mesh resolution by selecting the object, going into the "View" tab of the object properties and change the values of "Angular Deflection" and "Deviation", they are used by the workbench when creating the mesh.
Thank you, that would be great. Custom objects are represented by B-spline curves and surfaces. If your rendering approach worked, many people using the Curves workbench could benefit from it.The_Raytracers wrote: ↑Sun Jun 05, 2022 3:30 pm I'm not that familiar with B-splines, so I don't know how hard it would be to implement them, I can look into it though
Another solution is to associate different textures with the different surfaces.The_Raytracers wrote: ↑Sun Jun 05, 2022 3:30 pm As far as I know, there is no option to keep showing the surface edges during rendering since POV-Ray focused on rendering and not modeling. If it's really important maybe you can try to sweep a small circle along the edges and give the sweep a dark color but I admit that this is a very crappy solution
right! thank you to notify me.The_Raytracers wrote: ↑Sun Jun 05, 2022 3:23 pmHi david,
I think, you have posted in the wrong thread?!
Could you share the macro code you used so I can be sure, I'm doing the same thing like you? I guess there is something wrong in the spotlight code...Zoltan wrote: ↑Sun Jun 05, 2022 4:18 pm I checked it by placing the light sources "below" the geometry. First test: spotlight. Apparently, the object is not lit.
spot_light.png
Then I used area light at the same placement as the spotlight. Here, the rendered result is believable.
area_light.png
For reference, here is the FreeCAD-rendered result, where the light source seems to coincide with the camera view.
model.png
Here, in my FreeCAD with the following version I can lower these values down to 1° and 0.01. But unfortunately I also don't know a way to go below these values, even by setting the values per console doesn't work.
Code: Select all
OS: Linux Mint 20.1 (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: 0d9536ed3e8c7f40197b5606e1b7873625e1d6fe
Python version: 3.8.10
Qt version: 5.12.8
Coin version: 4.0.0
OCC version: 7.5.2
Locale: German/Germany (de_DE)
See the macro attached. The spotlight does not point to the right direction becauseThe_Raytracers wrote: ↑Tue Jun 07, 2022 5:20 pm Could you share the macro code you used so I can be sure, I'm doing the same thing like you? I guess there is something wrong in the spotlight code...
My FreeCAD version isThe_Raytracers wrote: ↑Tue Jun 07, 2022 5:20 pm Here, in my FreeCAD with the following version I can lower these values down to 1° and 0.01. But unfortunately I also don't know a way to go below these values, even by setting the values per console doesn't work.Code: Select all
OS: Linux Mint 20.1 (X-Cinnamon/cinnamon) Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.19. Build type: Release Branch: unknown Hash: 0d9536ed3e8c7f40197b5606e1b7873625e1d6fe Python version: 3.8.10 Qt version: 5.12.8 Coin version: 4.0.0 OCC version: 7.5.2 Locale: German/Germany (de_DE)
Code: Select all
OS: Ubuntu 18.04.6 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 2021.615.24301 +3747 (Git) AppImage
Build type: Release
Branch: LinkDaily
Hash: ecbfba008c481db4cb17bf8bd514b2d12690a8e5
Python version: 3.9.4
Qt version: 5.12.9
Coin version: 4.0.1
OCC version: 7.5.2
Locale: English/United States (en_US)
Hi Zoltan,
Shouldn't an automatic light source positioning feature be added to your plugin (the same strategy as for the camera, which takes into account the current viewpoint)?The_Raytracers wrote: ↑Fri Jun 10, 2022 5:38 pm as far as I understand, there is no bug in the code, it's just that the spotlight points to -y and therefore it has to be rotated 90° around the x-axis to create the desired result (what is done if you rotate the spotlight with the "Transform" tool).
I do know it. If this rotation is consistently required (i.e. in all the cases, 90° rotation must be performed around the x-axis), I can help you implement it programmatically.The_Raytracers wrote: ↑Fri Jun 10, 2022 5:38 pm Unfortunately I don't know how to do this with Python
You mean, that the lights are positioned by the user and then during rendering the position and rotation of the camera is added to the lights? I think that is indeed a good idea! What do you think about an option for the lights to be positioned relative to the camera (on some models you might want to have both)?
Thank you, I'm not that deep into the mathematics of rotation (FreeCAD uses quaternions to represent the rotation) to implement it on the FreeCAD side. But if you want something like I sketched above this would be on the POV-Ray side where the rotation is handled a bit more intuitively.Zoltan wrote: ↑Fri Jun 10, 2022 6:43 pmI do know it. If this rotation is consistently required (i.e. in all the cases, 90° rotation must be performed around the x-axis), I can help you implement it programmatically.The_Raytracers wrote: ↑Fri Jun 10, 2022 5:38 pm Unfortunately I don't know how to do this with Python
I was thinking of something simpler:The_Raytracers wrote: ↑Sat Jun 11, 2022 2:17 pm You mean, that the lights are positioned by the user and then during rendering the position and rotation of the camera is added to the lights? I think that is indeed a good idea! What do you think about an option for the lights to be positioned relative to the camera (on some models you might want to have both)?
Code: Select all
obj.Placement = Gui.ActiveDocument.ActiveView.viewPosition()
Code: Select all
obj.Placement = Gui.ActiveDocument.ActiveView.viewPosition()
I don't know how you construct the spotlight and why it is pointing to another direction than the area light. Setting the direction of the spotlight should be no different from that of the area light. As you could see in my macro I attached previously, setting the placement (i.e. the position and the direction) of the lights is done with the codeThe_Raytracers wrote: ↑Sat Jun 11, 2022 2:17 pm Thank you, I'm not that deep into the mathematics of rotation (FreeCAD uses quaternions to represent the rotation) to implement it on the FreeCAD side. But if you want something like I sketched above this would be on the POV-Ray side where the rotation is handled a bit more intuitively.
Code: Select all
obj.Placement = Gui.ActiveDocument.ActiveView.viewPosition()