Luxrender

Info about new community or project announcements, implemented features, classes, modules or APIs. Might get technical!
PLEASE DO NOT POST HELP REQUESTS OR OTHER DISCUSSIONS HERE!
User avatar
yorik
Site Admin
Posts: 11044
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Luxrender

Postby yorik » Tue Oct 01, 2013 10:00 pm

Hi all,
I've finally managed to build a simple system to use luxrender in freecad:
Image

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!
triplus
Posts: 8342
Joined: Mon Dec 12, 2011 4:45 pm

Re: Luxrender

Postby triplus » Wed Oct 02, 2013 1:58 am

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.
User avatar
yorik
Site Admin
Posts: 11044
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Luxrender

Postby yorik » Wed Oct 02, 2013 3:18 am

triplus wrote: I imagine only one at a time is possible and it's not possible to use both at the same time?
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...
wmayer
Site Admin
Posts: 14061
Joined: Thu Feb 19, 2009 10:32 am

Re: Luxrender

Postby wmayer » Wed Oct 02, 2013 8:03 am

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
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 from

Code: Select all

rescaleMatrix(std::string mat, float factor)
to

Code: Select all

rescaleMatrix(const std::string& mat, float factor)
because then no copy of a string is created when calling the method.

Now you will become more and more a C++ guru :D
User avatar
yorik
Site Admin
Posts: 11044
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Luxrender

Postby yorik » Wed Oct 02, 2013 3:24 pm

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...
triplus
Posts: 8342
Joined: Mon Dec 12, 2011 4:45 pm

Re: Luxrender

Postby triplus » Wed Oct 02, 2013 4:16 pm

Great! Thanks a lot for reviewing Werner. I'll merge into master so more people can test.
Yes that would be cool and now when we have exporter it will be fun to try out LuxRender in combination with FreeCAD.
wmayer
Site Admin
Posts: 14061
Joined: Thu Feb 19, 2009 10:32 am

Re: Luxrender

Postby wmayer » Thu Oct 03, 2013 8:41 am

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?
User avatar
yorik
Site Admin
Posts: 11044
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Luxrender

Postby yorik » Thu Oct 03, 2013 1:49 pm

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.
Attachments
render test.fcstd.zip
(38.62 KiB) Downloaded 133 times
wmayer
Site Admin
Posts: 14061
Joined: Thu Feb 19, 2009 10:32 am

Re: Luxrender

Postby wmayer » Thu Oct 03, 2013 3:13 pm

Hi Yorik,
Strange, for me the LuxClassic.lxs template was correctly copied to the install dir... I'll check again.
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 message
make wrote: Generating ../../../../data/Mod/Raytracing/Templates/ProjectStd.pov
But for LuxClassic.lxs there is no such message.
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
Ah, that's probably the problem. I created the standard box which already has the dimensions of 10x10x10 and thus covers the complete volume.
User avatar
yorik
Site Admin
Posts: 11044
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Luxrender

Postby yorik » Thu Oct 03, 2013 3:40 pm

wmayer wrote:But for LuxClassic.lxs there is no such message.
Ah got it... there was an error in the cmake stuff. It should be fixed now.