Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycles needing to be compiled standalone should be made more clear. #310

Open
metalex201 opened this issue Sep 22, 2023 · 29 comments
Open

Comments

@metalex201
Copy link
Contributor

its not made clear except for just a few lines in the docs, i took the time to compile it for windows, is there any way we could have a download of it somewhere so that other people dont need to compile it? Heres a link. https://we.tl/t-nLB9fxdJSP

@luzpaz
Copy link
Contributor

luzpaz commented Sep 23, 2023

Related: #288 (comment)

@howetuft
Copy link
Collaborator

its not made clear except for just a few lines in the docs

I explicitly mentioned it twice:
https://github.com/FreeCAD/FreeCAD-render/blob/master/docs/EngineInstall.md#cycles-standalone-1
https://github.com/FreeCAD/FreeCAD-render/blob/master/docs/EngineInstall.md#notes-on-installing-cycles-for-render-standalone-version
So, IMO, I thought I did the job. However, if you think you can improve the wording, please propose a PR!

is there any way we could have a download of it somewhere so that other people dont need to compile it? Heres a link. https://we.tl/t-nLB9fxdJSP

There is already MisterNL's link, but plenty is no plague: please propose a PR with your own link in addition!
Just a restriction: I tried your link and I was required to create an account to download the file; we should avoid this hassle to the user. MisterNL hosts its executable directly in GitHub, I personally prefer this solution...

@metalex201
Copy link
Contributor Author

@howetuft, sorry i didnt specify what i meant exactly.
What i mean is that random people like me could mistake cycles itself just needing the blender.exe instead of being an entirely different program.
I have made a pull request to indicate this difference in the readme and the UI of the workbench. and i also added an extra download link for a newer compiled version with all the needed dll's for it to run by itself. i'm unsure if the link made by @MisterMakerNL should be removed for it is an older version, i left it in the pr incase my compiled version has any issues.

Is there any specific reason that this standalone version is even used? Is it more compatible with the formating of these .xml files? I think it would be better if we could somehow format template files into .blend files cause this would allow eevee support, altought my coding abilities are lacking on this regard, but if a parser/converter to blend files is made would that help in development?

@howetuft
Copy link
Collaborator

Hello,
Thank you for your PR (merged).

I think it would be better if we could somehow format template files into .blend files

Yes, I do think so too but... blend format is out of reach for Render: it is a binary format, whereas Render is designed to export text format, and moreover it's a very complex format.

A solution would be to export in glTF format (https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html), I've been thinking of it for months, but it's a bit of work I just can't bring myself to do, for at least two reasons:

  • Writing and maintaining a new plugin is time-expensive (maybe I should deprecate pbrt?)
  • Blender support for glTF is not exhaustive (for instance, lacking sunsky light...). They are open to contributions, but it's time-consuming.

@metalex201
Copy link
Contributor Author

@howetuft Blender has a python module called bpy, maybe integration would be possible throught that. In what way does the cycles standalone receive model/scene data?

@howetuft
Copy link
Collaborator

Blender has a python module called bpy

Yes this is another option: export in Python.

In what way does the cycles standalone receive model/scene data?

Cycles standalone SDL (Scene Description Language) is in XML format.

Please note that, once Cycles is installed, there is no more problem as, actually, Blender in its entirety is not a target for Render; only the renderer engine is. So, the effort could also focus on Cycles installation...

@yorikvanhavre
Copy link
Member

Indeed it would do good to have a cycles standalone version somewhere for people to download... But I think this is more a jog for Cycles people. It would take us a lot of time to do that and keep it up to date, and it's not even our project.

I see our support of cycles above all as an effort to show Blender people that Cycles is used outside of Blender and incentivize them to keep maintaining the standalone version. Who knows at some point if enough people ask for it they'll offer a package for it. That's in any case a request that could be made at https://projects.blender.org/blender/blender/issues

@luzpaz
Copy link
Contributor

luzpaz commented Sep 25, 2023

I see our support of cycles above all as an effort to show Blender people that Cycles is used outside of Blender and incentivize them to keep maintaining the standalone version.

How could it be incentivized ?

@yorikvanhavre
Copy link
Member

We should show them we are using it... We need more cool renderings!

What about organizing some sort of a render contest?

@howetuft
Copy link
Collaborator

Hello,

My 2 cents:

I see our support of cycles above all as an effort to show Blender people that Cycles is used outside of Blender and incentivize them to keep maintaining the standalone version. Who knows at some point if enough people ask for it they'll offer a package for it. That's in any case a request that could be made at https://projects.blender.org/blender/blender/issues

Well, my own experience is that they do not care very much at ours. Cycles Standalone is not a packaged product, it's aimed at devs. At least, that is what they answered me a few years ago:

https://devtalk.blender.org/t/building-cycles-standalone-not-working-for-me/17861/6

What about organizing some sort of a render contest?

Yes, that would be very cool! I think Render's feature set is now rich enough to provide some decent renderings of any kind of models (parts, architecture...). But it could be open to other solutions (sverchok, pov-ray WB etc.).
And what about a section dedicated to rendering in FreeCAD forum?

@MisterMakerNL
Copy link

MisterMakerNL commented Sep 27, 2023

When I compiled Cycles I noticed it gets updated frequently, but the updates seems to be aimed at professional paid for software. Those are probably funding cycles standalone too.
But since we lack a lot of funding, we can just jump on the boat for free.
Also Freecad doesn't need the latest and greatest cycles, just one that works. And maybe update once a year or less.
I really would like too see that render workbench just downloads cycles from a repro automatically. Or maybe we make a workbench called "Cycles Windows" and "Cycles Linux" And mac...

@metalex201
Copy link
Contributor Author

metalex201 commented Sep 27, 2023

Please note that, once Cycles is installed, there is no more problem as, actually, Blender in its entirety is not a target for Render; only the renderer engine is. So, the effort could also focus on Cycles installation...

I think to some degree cycles is built deeply into blender and cycles-standalone is just a thrown togheter ripped out version of cycles, rendering straight from a python script running inside a blender process would make things more easy in my opinion and in the future it could give access to stuff outside of the cycles render engine like compositor nodes, modifiers, animations, etc. (it would be cool if we could get an exploding animation working with projects that contain a lot of tiny parts that go togheter) and it would negate having to download cycles seperately entirely considering most of the people that will render with cycles will already have blender installed. Also theres things that just arent implemented into the standalone version to my knowledge, like denoising, and as i mentioned before both cycles and eevee could be rendered from basically the same script (maybe with slight modifications to materials will be needed in some rare cases)

When I compiled Cycles I noticed it gets updated frequently, but the updates seems to be aimed at professional paid for software. Those are probably funding cycles standalone too. But since we lack a lot of funding, we can just jump on the boat for free. Also Freecad doesn't need the latest and greatest cycles, just one that works. And maybe update once a year or less. I really would like too see that render workbench just downloads cycles from a repro automatically. Or maybe we make a workbench called "Cycles Windows" and "Cycles Linux" And mac...

Since i already posted a link to a repo containing just the files nescecary i dont think this would be hard to implement? Why would we need seperate workbenches? that seems unescecary, we could just have python check which os you have and get the specific files. If nescecary i could compile one for linux too.

@howetuft
Copy link
Collaborator

howetuft commented Sep 28, 2023

A few comments:

cycles-standalone is just a thrown togheter ripped out version of cycles

No, Cycles Standalone is Cycles. It is the development base of Cycles and it is really amazing how they succeeded in providing multiple API at the same time, in Python, in C++ and in XML so that the same code can exist both embedded in Blender and standalone.
Problem is, they don't want to promote and package the standalone version, but apart this, Cycles Standalone is really the same engine as you find in Blender and full-featured, once you have compiled it. Note this is not just an opinion but a conclusion after having studied the code for years (for Render development) and also contributed to it.

Also theres things that just arent implemented into the standalone version to my knowledge, like denoising,

Hey, no! Good news: 1. denoising is available in Cycles Standalone, and 2. it can be activated in Render!

rendering straight from a python script

Yes, that could be the solution (or glTF...)

@metalex201
Copy link
Contributor Author

metalex201 commented Sep 28, 2023

A few comments:

cycles-standalone is just a thrown togheter ripped out version of cycles

No, Cycles Standalone is Cycles. It is the development base of Cycles and it is really amazing how they succeeded in providing multiple API at the same time, in Python, in C++ and in XML so that the same code can exist both embedded in Blender and standalone. Problem is, they don't want to promote and package the standalone version, but apart this, Cycles Standalone is really the same engine as you find in Blender and full-featured, once you have compiled it. Note this is not just an opinion but a conclusion after having studied the code for years (for Render development) and also contributed to it.

So cycles is a modular component of blender?

Hey, no! Good news: 1. denoising is available in Cycles Standalone, and 2. it can be activated in Render!

I didnt know that! I cant find any docs on cycles-standalone, so i couldnt find anything about denoising.

Yes, that could be the solution (or glTF...)

Is there any specific reason as to why you would use gLTF specifically?

Also maybe we could just ask for the maintainers or cycles-standalone to have github actions setup so that we could just get the latest build everytime, whitout them having to manually compile it everytime.

@howetuft
Copy link
Collaborator

howetuft commented Sep 28, 2023

So cycles is a modular component of blender?

Yes, absolutely.

I cant find any docs on cycles-standalone

There is no documentation, you have to study the code. It's a bit disconcerting at first, but once you become familiar with its structure, it's pretty straightforward, because the code is of very high quality.

Denoiser is controlled by integrator node: https://github.com/blender/cycles/blob/main/src/scene/integrator.cpp#L142

Is there any specific reason as to why you would use gLTF specifically?

Yes: it is an industry standard, so it would be reusable for other renderers or CG apps.

@metalex201
Copy link
Contributor Author

metalex201 commented Sep 28, 2023

@howetuft, I might try and make renderer plugin with python and the bpy module in blender (to have atleast eevee support) but for some reason the link in Writing a new renderer plugin doesnt go anywhere?

@howetuft
Copy link
Collaborator

howetuft commented Sep 28, 2023

Sorry, link was broken, but it's fixed now.
Moreover, I've just realized the target page is incomplete, lacking materials/textures features. You may have to study the code for these topics - or ask.
Maybe a few hints:

  • Take an existing plugin as a template
  • Keep the material topics for the end. Start with meshes (ignore materials), lights and render.
  • If you're stuck, just ask.

Good luck!

@MisterMakerNL
Copy link

Could we provide cycles as a flatpack for linux?

@howetuft
Copy link
Collaborator

That sounds a good idea. Is someone around here skilled in flatpack?

@luzpaz
Copy link
Contributor

luzpaz commented Oct 23, 2023

CC @hfiguiere & @adrianinsaval

@adrianinsaval
Copy link
Member

Could you give me a quick summary of the discussion? Is this a missing dependency on the flatpak package or what are we talking about?

@hfiguiere
Copy link

I you want cycles as a new flatpak, sorry I'm out of cycles (pun intended). Feel free to submit it to flathub.

@MisterMakerNL
Copy link

Could you give me a quick summary of the discussion? Is this a missing dependency on the flatpak package or what are we talking about?

Cycles isn't currently available as download and needs to be compiled. Making a flatpack would make it very easy to use on Linux. It's already available as compiled windows.

@yorikvanhavre
Copy link
Member

yorikvanhavre commented Oct 23, 2023

Honestly guys, unless someone is willing to do the work, I think we could ask for help from the Blender community on this... Creating and maintaining a flatpak will require some time and work, and maybe it's a pity to spend it there instead of coding :)

@adrianinsaval
Copy link
Member

how does tha addon call the binary? would a flatpak actually be suitable for this use? inter operation between sandboxed applications is tricky

@howetuft
Copy link
Collaborator

how does tha addon call the binary?

The standard process to run the renderer is:

  1. Export the scene from FreeCAD into renderer input format (for Cycles, it's a xml file)
  2. Run the renderer (binary) on the exported file
  3. Get the generated image file

Running the binary just uses Popen magic (https://github.com/FreeCAD/FreeCAD-render/blob/master/Render/rdrexecutor.py#L89). Input and output files are specified as command-line options.

Please note this is actually the standard way to do for all renderers (Cycles, Luxcore etc.) .

@adrianinsaval
Copy link
Member

where is the output file expected to be?

@howetuft
Copy link
Collaborator

By default, the output file is directed to FreeCAD transient directory. User can also ask for another location via an option.

@MisterMakerNL
Copy link

I don't think we need to maintain the flatpack all that much, once a year is more than enough. We don't need all the latest and greatest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants