FreeCAD-render
FreeCAD-render copied to clipboard
Adding materials seems to be broken in latest dev!
I get following error message:
19:15:05 Exiting rendering - Return code: 0
19:15:29 Traceback (most recent call last):
19:15:29 File "C:\github repros\out\freecadinstall\Mod\Arch\ArchMaterial.py", line 653, in chooseMat
19:15:29 self.material = importFCMat.read(self.cards[card])
19:15:29 File "C:\github repros\out\freecadinstall\Mod\Material\importFCMat.py", line 103, in read
19:15:29 material = materialManager.getMaterialByPath(filename)
19:15:29 LookupError: Material not found
If I add the material in 0.21 everything works fine in dev version.
Hello @MisterMakerNL , I tried to install dev version that week-end, but did not succeed (I was short in time...). I'll retry next week-end, to give you an answer.
So, some news: I eventually installed latest dev version (0.22) on my PC and I can reproduce the bug.
What happens: Render WB is based on FreeCAD's materials management system, that's been a design choice since the beginning. The problem is that this system is being completely overhauled in version 0.22, and some recent developments have changed the behavior of some material objects we use. I still have to investigate if this requires just a minor adjustment from my part or if I have to rewrite the objects. It may take a few days...
Take your time, with the amount of tiny bugs the overlay system has brought it's going to take a while until 0.22 gets released!
Guys, they've completely changed the materials management system in version 0.22 (what a mess)!
So, after half a day reading their code, I made a partial fix #318: it avoids the error message and the material can be created. However the underlying material values are not imported yet: still a lot of work to be done.
Guys, they've completely changed the materials management system in version 0.22 (what a mess)!
Indeed... @davesrocketshop could you give some assistance here?
Guys, they've completely changed the materials management system in version 0.22 (what a mess)!
So, after half a day reading their code, I made a partial fix #318: it avoids the error message and the material can be created. However the underlying material values are not imported yet: still a lot of work to be done.
It is in fact not completely changed. It is in mid change so it may get worse before it gets better. I would not expect render to work with 0.22 at this point as there's a lot of work still to be done.
For background on what's being done, see https://forum.freecad.org/viewtopic.php?style=4&p=685834#p685834 For a more detailed explanation of where it is https://youtu.be/PNetPYZlf9o
I will be able to help with this but it is premature at this point. Let the dev version stabilize a bit first.
Hold off on fixing this for 2 reasons:
- I want to see if we can maintain compatibility. This should be possible
- I want to help ensure that the workbench is migrated to the new material subsystem in the recommended fashion. There are supports for external workbenches.
This is a good test case. Once I get my current PR merged I'll be in a better position to help.
Still broken.
Still broken.
An update since I know people have been waiting on this for a while. There has been a lot of progress made in the migration to v0.22.
- Render WB model definitions are in the dev branch. This will allow the Render WB to use the new materials
- Materials have been created in the new format. For compatibility both old and new versions will be included
- Waiting on 2 things to be merged into the dev branch. A PR has been submitted and awaiting merge to use the new materials for appearances. The second, under development, are UI supports for this including preference page updates, and a new material selection widget. This will follow soon after the current PR is merged.
To some degree coding can't progress until those items are merged, but I will be doing as much as possible until then. We're now at the mercy of the merge process.
Hello David, That's good news! Indeed, I think it's starting to become a handicap not to be able to use Render fully with version 0.22. Moreover I've got a few ideas in the pipeline to extend the material rendering features, including a major feature to take advantage of PBR materials available on the Internet, and I'd really like to integrate all that into 0.22! Thus, I can't wait to see the results of the PR you've suggested.
Hello David, That's good news! Indeed, I think it's starting to become a handicap not to be able to use Render fully with version 0.22. Moreover I've got a few ideas in the pipeline to extend the material rendering features, including a major feature to take advantage of PBR materials available on the Internet, and I'd really like to integrate all that into 0.22! Thus, I can't wait to see the results of the PR you've suggested.
Do you anticipate any changes to the property models, or is it too early to ask this question?
No change in the property model! I've just found a way to download materials from big web sites like https://matlib.gpuopen.com or https://ambientcg.com/ and to convert them to our internal format (Disney shader), thanks to MaterialX library (https://materialx.org/). This gives access to hundreds of PBR materials with just a few clicks!!! The project is well advanced and is in my 'materialx' branch.
Hello @davesrocketshop, Any update about the merging process? Thank you!
Hello all, Seems to me that last developments have addressed the point. I close the issue: please open a new one if new problems occur.