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

I'm giving up with Google Filament for the web #1865

Closed
ansorre opened this issue Nov 11, 2019 · 7 comments
Closed

I'm giving up with Google Filament for the web #1865

ansorre opened this issue Nov 11, 2019 · 7 comments
Assignees

Comments

@ansorre
Copy link

ansorre commented Nov 11, 2019

I'm giving up with Google Filament for the web.
I wanted to create A 3D online editor but after almost 3 weeks of tries I understand now that Filament is not made for this kind of uses. The javascript interfaces only offers "set" methods, which in itself would not be a showstopper but it becomes when you load things with gltf. Yes entities are there and you can add them to the scene, but it's almost just that, you cannot get the geometries and change them, you cannot get the materials and change them. Yes set methods are there, but not knowing the initial values is like being blind, and not only. You cannot choose which ubershader gltfio uses to import materials which means that if this ubershader does not offer you (as in fact it does not) the ability to customize parameters like reflectance or clearCoat (which in my opinion together with automatic shadows are the real strengths of Filament when compared to threejs, babylonjs, etc.) you cannot change those values even if you wanted to do that blindly without knowing the initial values. One could argue that the gltf ubershader does not handle those other paramenters because they are not communicable with gltft anyway, but that is not a good reason, of course after the import you could make changes if the ubershader allowed them. On the other side one could say that nothing prevents you from building the materials on your own and apply those to the imported entity. Yes it is true, but it's like rewriting the gltf importer on your own and at that point one wonders if it's easier doing that or building reflections and shadows on your own in other engines like threejs and the like and go with those other engine. I know it's not even remotely the same, otherwise I would have not started with Filament to begin with, but for now I'm forced to fallback to this other path, I need to have a prototype of what I'm trying to achieve as soon as possible, this is mandatory for me.
There is also a bug somewhere in Filament which sometimes causes the browser to consume 100% GPU (not CPU) forever even if nothing at all happens in the scene. I've tried all my best to make this reproducible but had no success, it seems to happens really randomly, and in the end I can't be sure if it's a Filament bug or a chrome one.
Anyway I like a lot Filament, and I'll continue to follow the project. I really hope that in the future I can switch back to it. In the meantime I'm strongly grateful for all the very quick answers I got from the people involved in this project. This has been very appreciated and gives me the confidence that the project will always move in the right directions.
Good luck and see you soon.

@romainguy
Copy link
Collaborator

Thank you for your feedback! I'm sorry to hear that it didn't work out for you. Just so that we understand where the limitations are, your main issue is really related to the gltfio library right? It is true that this library has been mostly designed — so far — to load glTF files and not edit them, which explains the lack of "getters" you mentioned.

@ansorre
Copy link
Author

ansorre commented Nov 11, 2019

Yes @romainguy I confirm: for my needs the limitations are mainly related to the gltfio library and the fact that you cannot edit the loaded content after the imports.

@romainguy
Copy link
Collaborator

Thank you. Probably the best thing we could do for you would be to have a way to ask gltfio to enable all the features in the ubershader so you could edit them all in your UI. Would that work?

And do you want to be able to set features that are not supported by glTF too? You mentioned clearCoat and reflectance for instance, which are not provided by glTF (clearCoat will be at some point with an extension). We can't really make the glTF ubershader support all those features. That's really why we have filamat which allows you to create new materials at runtime. But in your case you'd need JS bindings for filamat and a way to query the different parameters loaded from glTF to preserve them.

@ansorre
Copy link
Author

ansorre commented Nov 11, 2019

After studying the code for some days I've come up with the idea that the best thing you could do to allow potential editors would be:

  1. Give developers a way to pass their how filamat file to the gltf loader as a url or binary content (Uint8Array) and have the loader use it to create materials. Of course specification could dictate that this custom material should extend the minimalist one the gltf needs, and point to it for developers to see it and extend it. I think at the moment there are more than one, I'm not sure, they seems to be derived from a file called ubershader.mat.in which I suppose is specialized in final filamat files at build time, I'm not sure I didn't understand very well that so far. But this could not be a problem, just tell developers what they should provide in the mat as mandatory then developers can only add parameters and pass this filamat file to the gltf loader.

  2. When creating materials, but even entities and geometries, it would be great if a client could register as a call back receiver of what you are doing. For example if when you call createMaterial in MaterialGenerator.cpp a third party developer could register with a callback to receive the same parameters you use to create things, that would be enough for the developer to know initial parameters values of what your are creating and they would not be forced to create entities and materials on their own while you are already doing it the right way! ;)

The reasons I suggest only these two modifications are:
a) maybe these are few, easy, quick modifications for you to do. They seems so to me, or at least I was not able to find something even simpler, quicker and lightweight than these. The editor itself could even become heavier, of course, it's possible, it's an editor, but with just these few modifications...
b) ... there is no more need for "get" methods which would be a major modification and maybe one that would impact the Filament filosophy you promote in your home page "We are very conscientious about keeping Filament small, fast to load, and focused on rendering" which is one of the thing I too really appreciate about this project.

Thanks for asking.

@prideout
Copy link
Contributor

prideout commented Nov 11, 2019

I like the callback idea. Currently our helmet.html demo loops over entities to enable shadows, and this has always felt a bit awkward to me. In general I think it would be good to keep FilamentAsset simple, and instead use our existing ECS functionality as much as possible.

We have also been thinking about making the ubershader mode more customizable. This might be useful for advanced users who are willing to run matc as part of their build process.

Somewhat unrelated, but I also think the clone() idea from #1513 would make gltfio usable in more scenarios.

@prideout
Copy link
Contributor

@Antonio-Sorrentini I haven't seen the 100% CPU usage bug you've described but it is very concerning -- please let us know if you manage to come up with repro steps.

@ansorre
Copy link
Author

ansorre commented Nov 11, 2019

Absolutely @prideout but it was not CPU it were GPUs at 100%. It happened two times, in two different days. Should I see it again I'll send you all the html/js files that caused it.

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

3 participants