Page 8 of 8

Re: New Raytracing Workbench: POV-Ray-Rendering

Posted: Sun Jun 12, 2022 3:50 pm
by The_Raytracers
Zoltan wrote: Sun Jun 12, 2022 7:34 am I was thinking of something simpler:
  • The camera setting would be left as it is, i.e. take the current view.
  • As for the lights: when the user clicks on the icon of any of the three light source types, the light source would be positioned based on the current view.
Yes, that's also a good idea. But I would make this optional since it is quite uncommon that objects are automatically placed at the camera. Therefore I would suggest a button that places all selected light sources to the camera (if no light source is selected, all lights will be moved). Do you agree?
Zoltan wrote: Sun Jun 12, 2022 7:34 am 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 code

Code: Select all

obj.Placement = Gui.ActiveDocument.ActiveView.viewPosition()
.
I also don't know why the spotlight points to -y, it doesn't seem like a reasonable choice... But I figured out how to apply the 90° rotation in FreeCAD so this also wouldn't be a problem anymore.

Re: New Raytracing Workbench: POV-Ray-Rendering

Posted: Mon Jun 13, 2022 7:12 am
by Zoltan
The_Raytracers wrote: Sun Jun 12, 2022 3:50 pm But I would make this optional since it is quite uncommon that objects are automatically placed at the camera. Therefore I would suggest a button that places all selected light sources to the camera (if no light source is selected, all lights will be moved). Do you agree?
By what logic do you currently place the light sources?
  • If you have a reasonable initial placement for the light, then leave it as it is. Then repositioning the light according to the current camera view could be an optional choice, as you suggested (i.e. the user selects the lights he wants to reposition according to the current view, and then presses a button).
  • If you have no preferred initial placement for the light, the current camera view would be a good default choice. In this case, there is no need to add a button to the user interface because the user selects the preferred view before allocating the light source.
The_Raytracers wrote: Sun Jun 12, 2022 3:50 pm I also don't know why the spotlight points to -y, it doesn't seem like a reasonable choice... But I figured out how to apply the 90° rotation in FreeCAD so this also wouldn't be a problem anymore.
Fine, if you solved it. However, it would be worthwhile to understand why this "anomaly" happens with the spotlight, so as to avoid further surprises. Once I have some time, I can look into the code. Is this the active repository: https://gitlab.com/usbhub/exporttopovray (I don't see new commits) ?

Re: New Raytracing Workbench: POV-Ray-Rendering

Posted: Sun Jun 19, 2022 11:19 am
by The_Raytracers
Zoltan wrote: Mon Jun 13, 2022 7:12 am ...
Hi,
I attached a small macro (and a rudimentary icon for it) that places all selected lights (indeed all selected objects) to the camera. If you find any bugs, please tell me :)

The reason for default direction of the spotlight is the line "point_at <0, -1, 0>". As I mentioned, I don't know why I chose this direction, it doesn't seem reasonable but cannot be changed now since this would break existing models with spotlights.

We have two repositories. Initially we used the GitLab repo but there were problems with GitLab and the Addon Manager and therefore we also added the code to GitHub.

Best regards!

Re: New Raytracing Workbench: POV-Ray-Rendering

Posted: Sun Jun 19, 2022 1:39 pm
by Zoltan
The_Raytracers wrote: Sun Jun 19, 2022 11:19 am I attached a small macro (and a rudimentary icon for it) that places all selected lights (indeed all selected objects) to the camera. If you find any bugs, please tell me :)
Hello,

I like the icon. I tested your macro with different selection scenarios. It works well, however, your approach is intrusive: if the user selects a custom object, which has a "Part::FeaturePython" type (happens for many custom objects!), it will transform that object too. To avoid this, I modified your script so that it changes the placement for light objects only.
PositionToCamera_mod.FCMacro
(762 Bytes) Downloaded 83 times

The_Raytracers wrote: Sun Jun 19, 2022 11:19 am The reason for default direction of the spotlight is the line "point_at <0, -1, 0>". As I mentioned, I don't know why I chose this direction, it doesn't seem reasonable but cannot be changed now since this would break existing models with spotlights.
When (or if) you introduce a new version of the workbench that breaks backward compatibility, you can fix this orientation issue as well...

Re: New Raytracing Workbench: POV-Ray-Rendering

Posted: Thu Mar 02, 2023 7:25 pm
by The_Raytracers
Hi all,
today was our presentation on the FreeCAD Users Conference 2023, thanks for all who participated :)
I attached the files we created.
Cheers
The Raytracers

Re: New Raytracing Workbench: POV-Ray-Rendering

Posted: Fri Mar 03, 2023 12:00 pm
by Brodie
I really enjoyed this one!
Thanks for sharing the files too.

Re: New Raytracing Workbench: POV-Ray-Rendering

Posted: Sun Aug 20, 2023 8:48 pm
by The_Raytracers
Hi all,
just a small information for you: We implemented hybrid textures that take information from the "FreeCAD texture" (e.g. the color of the object in FreeCAD) and combine this with a POV-Ray material. For instance the "Gradient Peel" texture now takes the color from the FreeCAD object, see the attachment below.

Hope you enjoy :)

Re: New Raytracing Workbench: POV-Ray-Rendering

Posted: Sat Apr 13, 2024 10:24 am
by Prajna
Hi, I've only just begun exploring the POV-Ray workbench and I have immediately run into the following error:

Code: Select all

An error occurred while rendering:
-----------------------------------------
File: asm_SMT-Mk4.pov  Line: 37
File Context (5 lines):
polygon {
	5, <-109.34112548828125, -82.00584411621094>, <-109.34112548828125,
 82.00584411621094>, <109.34112548828125, 82.00584411621094>,
 <109.34112548828125, -82.00584411621094>, <-109.34112548828125,
 -82.00584411621094>
	pigment {	finish
Parse Error: No matching } in 'pigment', finish found instead

-----------------------------------------
If the error occurred in the pov file or the mesh file, please report a bug to us.(See the wiki, link is in the help tab of the dialog)
Please let me know if there is more info you need. The model is too large to post here and I don't know which Part is causing the error so that I could upload just that part.

My current installation is:

Code: Select all

OS: Linux Mint 21.3 (X-Cinnamon/cinnamon)
Word size of FreeCAD: 64-bit
Version: 0.21.2.33771 (Git)
Build type: Release
Branch: (HEAD detached at 0.21.2)
Hash: b9bfa5c5507506e4515816414cd27f4851d00489
Python 3.10.12, Qt 5.15.3, Coin 4.0.0, Vtk 9.1.0, OCC 7.6.3
Locale: English/United Kingdom (en_GB)
Installed mods: 
  * DynamicData 2.60.0
  * Assembly4 0.50.12
  * POV-Ray-Rendering
  * NikraDAP 2.0.0
  * fasteners 0.5.15
  * sheetmetal 0.4.10
  * CurvedShapes 1.0.8
  * Manipulator 1.5.7
  * Defeaturing 1.2.2
  * freecad.gears 1.2.0