Comments (16)
CC #15 - related issue for spec.
from gltf.
@pjcozzi @RemiArnaud @tparisi we need to specify how shaders are generated. With premultiplied alpha or not ? that's a context info on WebGL. Where should we put this in glTF ? in profile ? a root property to carry all context infos ? any suggestion ?
from gltf.
Why does glTF need to support the WebGL context-level premultiplied alpha?
Why not just support UNPACK_PREMULTIPLY_ALPHA_WEBGL
for textures?
from gltf.
Shader are normally written/thought with or without premultiplied , this goes not only for texture but for computed colors in shaders too. We must support both and tell developers how the context should be set to be able to render correctly provided shaders.
from gltf.
This really feels outside the scope of glTF. This is an asset format, not a scene format. I don't know how we expect assets to dictate how the context should be created. That implies that I'm able to create/recreate the context when I encounter the asset. ha. Not likely for real apps.
from gltf.
The following comments only applies when developers want to use shaders generated by the converter. (or any other tool...).
Here is how I see things:
- It is not an option for glTF to enforce support for only pre-multiplied or not by SPEC. (you didn't suggest that, but I want this to be explicit).
- The converter should provide options to generate shaders for pre-multiplied alpha or not.
- 2 assets shouldn't be merged in a scene if one has shaders generated using pre-multiplied and one not. It will look wrong. How can a developer could check this ?
- Say I have a glTF asset with custom shader, I want to update shaders in this glTF asset as post processing step, how do I know if the shaders have been generated with pre-multiplied on ? And this would not fit in the
details
property because it would be mandatory and global.
Overall, I understand what your concern is @pjcozzi but if we provide shaders, pre-multiplied alpha is an implementation details that is one aspect driving how shaders are generated.
And shaders are implementation... so we shouldn't be surprised that kind of details surface eventually.
Wherever it is and how it is specified (could be a hint ?) should be exposed somewhere in the glTF file.
Before going further about the way to implement this, I'd like we agree on the principle.
Also I mentioned, again a converter option, let's have a configuration file to manage options better #166
from gltf.
Ah, I see. This is really just asset-level metadata on how the shader was generated. OK with me. (Also good info on this topic here).
Do you have JSON examples for your proposals? If this were a root-level property, what potential future properties would it include?
from gltf.
Well, I have an urgent need for this, so I'll add a converter option and and extra in asset
which looks to be a good candidate until we reach an agreement for this.
something like:
"asset": {
"generator": "collada2gltf@042d7d2a3782aaf6d86961d052fc53bea8b3e424",
"extras" : {
"premultipliedAlpha" : true
}
},
Toggling premultipliedAlpha will impact the generated shaders and states (blend func).
from gltf.
Also, after this change the default in the converter will change.
We were generating states for non-premultiplied alpha, but we will align with WebGL who has premultipliedAlpha switched on...
from gltf.
just pushed the change (merged from mini branch premulatiplied-alpha-rework
) e7a5277
from gltf.
@fabrobinet do you have any ideas for what the final JSON should look like?
Perhaps it is as simple as
"asset": {
"generator": "collada2gltf@042d7d2a3782aaf6d86961d052fc53bea8b3e424",
"premultipliedAlpha" : true
},
Or do you see premultipliedAlpha
being on a sub-property of asset
?
from gltf.
@pjcozzi Yes, that's what I had in mind, but I have put an extras before we reached agreement.
@RemiArnaud , @tparisi OK with you ? I plan to move forward quickly on this low-hanging fruit.
from gltf.
I'm working on the schema now (in the new schema branch). Can we move premultipliedAlpha
directly under asset
for dev-6?
"asset": {
"generator": "collada2gltf@042d7d2a3782aaf6d86961d052fc53bea8b3e424",
"premultipliedAlpha" : true
},
from gltf.
Fixed in dev-6.
from gltf.
@fabrobinet OK to close?
from gltf.
yes
from gltf.
Related Issues (20)
- Coordinate System and Units HOT 2
- KHR_draco_mesh_compression and triangle strips HOT 1
- how to use this project? HOT 1
- typo in pbr.frag
- Re-using materials on meshes with different attributes HOT 3
- Accessor zero-initialization: Allow default-initialization? HOT 2
- Add ENVOKE vendor prefix
- glTF2 'sparse' object has redundancy in its indices object HOT 1
- Z values stored in many normals textures are incorrect HOT 13
- GRIFFEL_bim_data.schema.json is an invalid json schema HOT 1
- Clarification regarding `image` entries HOT 1
- Description of morph targets in mesh.primitive.schema.json is misleading
- Ad some video file capability HOT 3
- Typo in Smith joint shadowing-masking function HOT 2
- Wrong pseudocode in BRDF reference implementation HOT 2
- Question about Accessor's Min-Max bounds with normalized data. HOT 1
- Undefined behaviour in KHR_materials_volume HOT 10
- 3.7.3.3 how many non-zero weights per vertex HOT 1
- 3.7.2.1 COLOR_0 is special? HOT 1
- KHR_materials_clearcoat Fresnel should not influence material emission HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gltf.