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

Adding materials seems to be broken in latest dev! #312

Open
MisterMakerNL opened this issue Oct 12, 2023 · 14 comments
Open

Adding materials seems to be broken in latest dev! #312

MisterMakerNL opened this issue Oct 12, 2023 · 14 comments

Comments

@MisterMakerNL
Copy link

MisterMakerNL commented Oct 12, 2023

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.

@howetuft
Copy link
Collaborator

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
Copy link
Collaborator

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

@MisterMakerNL
Copy link
Author

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!

@howetuft
Copy link
Collaborator

howetuft commented Oct 22, 2023

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.

@yorikvanhavre
Copy link
Member

yorikvanhavre commented Oct 23, 2023

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

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

@davesrocketshop
Copy link

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
Copy link

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.

@berberic2
Copy link

Still broken.

1 similar comment
@berberic2
Copy link

Still broken.

@davesrocketshop
Copy link

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.

@howetuft
Copy link
Collaborator

howetuft commented Mar 23, 2024

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.

@davesrocketshop
Copy link

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?

@howetuft
Copy link
Collaborator

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
Copy link
Collaborator

howetuft commented Apr 7, 2024

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

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

5 participants