FreeCAD-render icon indicating copy to clipboard operation
FreeCAD-render copied to clipboard

Adding materials seems to be broken in latest dev!

Open MisterMakerNL opened this issue 1 year ago • 14 comments

I get following error message: afbeelding

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.

MisterMakerNL avatar Oct 12 '23 17:10 MisterMakerNL

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.

howetuft avatar Oct 16 '23 07:10 howetuft

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

howetuft avatar Oct 22 '23 10:10 howetuft

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!

MisterMakerNL avatar Oct 22 '23 11:10 MisterMakerNL

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.

howetuft avatar Oct 22 '23 20:10 howetuft

Guys, they've completely changed the materials management system in version 0.22 (what a mess)!

Indeed... @davesrocketshop could you give some assistance here?

yorikvanhavre avatar Oct 23 '23 09:10 yorikvanhavre

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.

davesrocketshop avatar Oct 23 '23 16:10 davesrocketshop

Hold off on fixing this for 2 reasons:

  1. I want to see if we can maintain compatibility. This should be possible
  2. 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.

davesrocketshop avatar Oct 23 '23 16:10 davesrocketshop

Still broken.

berberic2 avatar Nov 07 '23 10:11 berberic2

Still broken.

berberic2 avatar Dec 31 '23 15:12 berberic2

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.

davesrocketshop avatar Mar 22 '24 23:03 davesrocketshop

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.

howetuft avatar Mar 23 '24 19:03 howetuft

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?

davesrocketshop avatar Mar 23 '24 19:03 davesrocketshop

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.

howetuft avatar Mar 23 '24 20:03 howetuft

Hello @davesrocketshop, Any update about the merging process? Thank you!

howetuft avatar Apr 07 '24 20:04 howetuft

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.

howetuft avatar Jul 05 '24 07:07 howetuft