-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
GLSL, Vulkan, and portable materials #733
Comments
A big +1 from me. Spec updates are very simple here (first thoughts):
With such scheme, API specifics don't affect asset's compatibility as long as there are high-level (like PBR) material properties. Also, having API specifics in separate objects doesn't require us to align APIs with each other (think of UBOs, framebuffers, renderpasses, transform feedback, etc). |
Other API-related stuff:
Anyway, I think that moving away from a specific API is a good thing for broad glTF adoption, but we still need to keep in mind that glTF aims to be a runtime format. @pjcozzi What do you think? |
Agreed. Do you think it is possible to do this in a backwards compatible way? For example, when
Also agreed. You bring up a lot of good points for making glTF broadly tuned for multiple graphics APIs. I feel like it is a lot to try to tackle everything at once. Do you think it is a reasonable approach to focus on:
|
I think we must very accurately estimate real usage of the current (1.0) spec version in terms of existing content and runtime/pipeline maturity. Backwards compatibility isn't always a good thing: think of the whole desktop GL history; OpenGL ES 1.1 -> 2.0 transition was much cleaner, imho. Making drastic changes at the beginning of the format's life is easier than making them later.
Considering growing industry attention to glTF, I think we should make next format's version as future-proof as possible and freeze major/minor version number for several years. See related thoughts from the PNG spec:
Those renderers have to use not-so-good hacks and quirks. Supplying custom shaders for them is almost broken (with current glTF core). I don't think we should encourage such approaches.
For an asset to be portable, such "tuning" for Khronos APIs should be defined as ratified glTF extension, not as user/vendor custom fields. I think we should start with a clear definition of "spec version" vs "spec profile". Do we want any API profile to be a part of core glTF spec? If so, could new profiles be defined for already existing spec version? The other approach is to remove all API references from core. |
Do we have a list of all shader options we want to support? It could become a pretty large matrix. For instance, these are some of the obvious cases:
Then there's all the different versions of the shader languages. I assume we pick a couple of common ones. I also need multi-view (GL_OVR_multiview2) variants of the shaders. This is obviously an important extension for VR but there may be many other extensions that turn out to be important to people. Supporting such extensions can significantly blow up the support matrix. And I guess we will support "fat" glTF files that include all shader variants that are supported which means all variants need to be able to coexist. |
Not yet; we need to set the scope. Besides your five options, there's also ESSL (1.0 and 3.0), which is the only way for WebGL.
We could think of "feature/capability flags" for each provided "technique". It could be up to runtime to choose proper technique/program.
Exactly. That's why all technique/shader/etc objects should be provided in |
Rather than creating a lot of "fat" glTF files, I would rather see (a) a shaderless PBR glTF file that can be rendered similarly on any platform using the rendering engine's own PBR shader, or, failing that, (b) a client issues a REST request clearly stating which shader flavor is desirable for that platform, and gets a response with only the correct shader language baked in. I think (a) is more practical than (b) in general. For web-based clients using (b), of course WebGL (GLSL/ESSL) shaders would be requested exclusively. Only native clients (desktop or mobile non-web) would request glTF with anything other than WebGL shaders, and those clients are more likely to have glTF files bundled into the installer from the start. But ideally, if we can make robust PBR support, we can relegate customized shaders to the land of lesser-used extensions. It would mean every glTF reader would ship with its own PBR shader, but I think this would be a win across the board. |
They still could have different versions of the same shader to support more platforms. Other option could be to provide multiple flavors of the same asset instead of one "fat" glTF.
Couldn't agree more. Possible GLSL variations make glTF too fragile. |
That's what we did in the ovrscene format. Shaders were not part of the format and the scene could effectively only use one of four shaders:
And then each surface could use one of four blend options:
https://developer3.oculus.com/documentation/mobilesdk/latest/concepts/mobile-fbx-overview/ I like the flexibility that comes with storing the shaders in the glTF format, but all different shader variants makes it a mess. If we can untangle that as a set of extensions then we have the best of both worlds. |
Sorry for the slow response; I was out all last week. It looks like this discussion has converged nicely: If I understand correctly, we all agree that making PBR core in glTF would be the best approach, then extensions would allow API-specific shader payloads. I still feel like doing this all at once would be a lot of work. I would suggest doing PBR first (which appears to be moving quickly) and mapping out what the API-specific extensions would look like, using the current WebGL/GLSL payloads as a concrete example and perhaps WebGL 2 / Vulkan, but not doing all of them now. Also, @mre4ce if you are interested in PBR discussions, check out these issues. In particular, #696 is a great discussion that we need to converge on. |
For glTF 2.0, this is resolved with |
Metal Roughness PBR was added to the core spec in #830. |
Tagging as "archive" and closing. |
For consideration post 1.0.1...
glTF currently requires that renderers be able to use embedded/referenced GLSL shaders. I'd like us to consider moving this to an extension for the following reasons:
To stay with the spirit of glTF's simplicity, it will be key that the material description payload be reasonable to implement and that plenty of sample code is available.
I'm open to proposals from the community on how this would be designed (GLSL extension + PBR work already in progress). I am also happy to propose ideas.
The text was updated successfully, but these errors were encountered: