Luxrender
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Luxrender
Hi all,
I've finally managed to build a simple system to use luxrender in freecad:
It behaves almost exactly like the povray system, you have a new toolbar button to create a new luxrender project (the "raytracing project" has been renamed to "povray project"), and the same button used to place parts in a povray project can be used to place parts in the lux project too, depending on which one is present or selected. I also added a new button that resets the camera direction of a povray or lux project to match the current view. Finally, the export button can export an .lxs (luxrender scene file) and the render button also handles lux projects and opens the luxrender interface, if its path has been configured in the preferences.
The only template available currently has an external "wall" of 10 x 10 units, so don't render objects outside that area for now... But making new templates is easy, there are just 2 lines to add to a .lxs file such as those produced by blender.
This is quite different than the approach used by mrlukeparry some time ago, but I found it interesting to try to keep things to the most simple possible implementation. In short, any feature you want, outside putting objects inside the render, has to be made in templates. Mrlukeparry's work is here for who's interested: https://github.com/mrlukeparry/FreeCAD_ ... raytracing His idea was more to create a full-featured render interface in freecad.
I'd be interested if someone could give it a test, it is not in master yet, but in a separate branch: https://github.com/yorikvanhavre/FreeCAD/tree/lux
Also if some of you C++ gurus could give a quick look to check that I didn't commit any big sin, I'd appreciate: https://github.com/yorikvanhavre/FreeCA ... x?expand=1
Hope you'll like!
I've finally managed to build a simple system to use luxrender in freecad:
It behaves almost exactly like the povray system, you have a new toolbar button to create a new luxrender project (the "raytracing project" has been renamed to "povray project"), and the same button used to place parts in a povray project can be used to place parts in the lux project too, depending on which one is present or selected. I also added a new button that resets the camera direction of a povray or lux project to match the current view. Finally, the export button can export an .lxs (luxrender scene file) and the render button also handles lux projects and opens the luxrender interface, if its path has been configured in the preferences.
The only template available currently has an external "wall" of 10 x 10 units, so don't render objects outside that area for now... But making new templates is easy, there are just 2 lines to add to a .lxs file such as those produced by blender.
This is quite different than the approach used by mrlukeparry some time ago, but I found it interesting to try to keep things to the most simple possible implementation. In short, any feature you want, outside putting objects inside the render, has to be made in templates. Mrlukeparry's work is here for who's interested: https://github.com/mrlukeparry/FreeCAD_ ... raytracing His idea was more to create a full-featured render interface in freecad.
I'd be interested if someone could give it a test, it is not in master yet, but in a separate branch: https://github.com/yorikvanhavre/FreeCAD/tree/lux
Also if some of you C++ gurus could give a quick look to check that I didn't commit any big sin, I'd appreciate: https://github.com/yorikvanhavre/FreeCA ... x?expand=1
Hope you'll like!
Re: Luxrender
I see basically user has now two options to export to PovRay or LuxRender in Rendering Workbench and both have the possibility to be set in Preferences and run directly from FreeCAD. I imagine only one at a time is possible and it's not possible to use both at the same time?
Nice and yes a template or two to produce nice results for each would be great then users would not be overwhelmed by the steps they have to do to get decent results.
Nice and yes a template or two to produce nice results for each would be great then users would not be overwhelmed by the steps they have to do to get decent results.
Re: Luxrender
You can put two project in a same document, one povray and one luxrender. But you still need two separate ones. I thought about doing some intelligent object that would decide what kind of data to output depending on the template type, but this seemed complicated to me, separated objects seemed a more solid basis...triplus wrote: I imagine only one at a time is possible and it's not possible to use both at the same time?
Re: Luxrender
I had a quick look at it and the code looks very clear and clean. There is only a little change to make for rescaleMatrix. Change its interface fromAlso if some of you C++ gurus could give a quick look to check that I didn't commit any big sin, I'd appreciate: https://github.com/yorikvanhavre/FreeCA ... x?expand=1
Code: Select all
rescaleMatrix(std::string mat, float factor)
Code: Select all
rescaleMatrix(const std::string& mat, float factor)
Now you will become more and more a C++ guru
Re: Luxrender
Great! Thanks a lot for reviewing Werner. I'll merge into master so more people can test. Time to write some docs too...
I ended up removing that matrix rescale stuff because matrixes in a luxrender file are a weird thing, they stack, each one influence the following, and you end up with very crazy transformations, and touching them never produced the desired result...
I ended up removing that matrix rescale stuff because matrixes in a luxrender file are a weird thing, they stack, each one influence the following, and you end up with very crazy transformations, and touching them never produced the desired result...
Re: Luxrender
Yes that would be cool and now when we have exporter it will be fun to try out LuxRender in combination with FreeCAD.Great! Thanks a lot for reviewing Werner. I'll merge into master so more people can test.
Re: Luxrender
Two little issues:
1. When building the sources the template file LuxClassic.lxs wasn't copied to the destination directory.
2. When starting LuxRender FreeCAD will become inaccessible because of the use of Python's subprocess module
Besides that I wasn't able to get such a nice image like you. All what I got is an almost black image with some undefinable stuff inside. Any ideas?
1. When building the sources the template file LuxClassic.lxs wasn't copied to the destination directory.
2. When starting LuxRender FreeCAD will become inaccessible because of the use of Python's subprocess module
Besides that I wasn't able to get such a nice image like you. All what I got is an almost black image with some undefinable stuff inside. Any ideas?
Re: Luxrender
Thanks for testing Werner!
Strange, for me the LuxClassic.lxs template was correctly copied to the install dir... I'll check again.
Indeed the luxrender subprocess stops freecad, that is something I should solve. With povray it wasn't a big problem, but luxrender takes much, much more time... (It can take forever, the idea is that you just stop it when you find the result satisfactory)
About your scene being black: I'm realizing the template is really not good... It defines a 10x10x10 cube around the origin, to act as a "shell" (the big advantage of luxrender is that it calculates light bouncing, so it is always better to place objects inside a container, light gets much better), but the lights are much too close to the origin.. probably the objects you placed are hiding the light objects. I definitely need to make a new template.
Attached is a file that is sure to work with the default template, but I'll work on a better one that can work with any file.
Strange, for me the LuxClassic.lxs template was correctly copied to the install dir... I'll check again.
Indeed the luxrender subprocess stops freecad, that is something I should solve. With povray it wasn't a big problem, but luxrender takes much, much more time... (It can take forever, the idea is that you just stop it when you find the result satisfactory)
About your scene being black: I'm realizing the template is really not good... It defines a 10x10x10 cube around the origin, to act as a "shell" (the big advantage of luxrender is that it calculates light bouncing, so it is always better to place objects inside a container, light gets much better), but the lights are much too close to the origin.. probably the objects you placed are hiding the light objects. I definitely need to make a new template.
Attached is a file that is sure to work with the default template, but I'll work on a better one that can work with any file.
- Attachments
-
- render test.fcstd.zip
- (38.62 KiB) Downloaded 192 times
Re: Luxrender
Hi Yorik,
I have checked again and the file definitely isn't copied. When I e.g. remove the file ProjectStd.pov and rerun make I get a messageStrange, for me the LuxClassic.lxs template was correctly copied to the install dir... I'll check again.
But for LuxClassic.lxs there is no such message.make wrote: Generating ../../../../data/Mod/Raytracing/Templates/ProjectStd.pov
Ah, that's probably the problem. I created the standard box which already has the dimensions of 10x10x10 and thus covers the complete volume.It defines a 10x10x10 cube around the origin, to act as a "shell" (the big advantage of luxrender is that it calculates light bouncing, so it is always better to place objects inside a container, light gets much better), but the lights are much too close to the origin
Re: Luxrender
Ah got it... there was an error in the cmake stuff. It should be fixed now.wmayer wrote:But for LuxClassic.lxs there is no such message.