Giter Site home page Giter Site logo

Comments (3)

pjcozzi avatar pjcozzi commented on July 30, 2024

@javagl thanks for all the research. Is this now duplicate with KhronosGroup/glTF#576? Should we consolidate these issues?

from gltf-sample-models.

javagl avatar javagl commented on July 30, 2024

They are related, at least.

This issue only refers to the fact that a technique that eventually refers to a semi-opaque PNG does not contain the GL_BLEND state - but I think that it has to contain this, in order to be rendered properly (and in a previous version, it did contain it).

If it contained the GL_BLEND state, it would require additional techniques.states.functions - and this is the relationship to the other issue:

The issue 576 asked about these boxes. They appear in "non-sopisiticated" renderers (that do not use OIT or other fancy stuff). The reason of why the boxes appear is what I currently consider as an error in the glTF file: I think that that blendFuncSeparate parameters are wrong for transparent materials. At least, using GL_SRC_ALPHA for the source seems to be intuitively reasonable, and at corresponds to the "typical" setting that is also mentioned in https://www.opengl.org/archives/resources/faq/technical/transparency.htm#blen0020

I wondered about where to report this: Here in glTF-Sample-Models, or in COLLADA2GLTF, or the gltf-pipeline? You added the collada2gltf label at the other issue, and that's certainly a reasonable point to start investigating both issues (although one could first check whether the technique is already wrong or ambiguous in the .DAE input file, and only start digging deeper if not)

EDIT: From a quick glance, at least the technique.states.functions part seems to be based on the premultipledAlpha setting ( https://github.com/KhronosGroup/COLLADA2GLTF/blob/master/shaders/commonProfileShaders.cpp#L385 ). I'll have to read more about this. Sorry for bothering you.

from gltf-sample-models.

javagl avatar javagl commented on July 30, 2024

So I'll have read more about premultiplied alpha (which is ENabled in WebGL by default, but DISabled in OpenGL usually), find the answer to the question of whether the fragment shader should be

gl_FragColor = color;
gl_FragColor = color * u_transparency;
gl_FragColor = vec4(color.rgb * diffuse.a, diffuse.a * u_transparency);
gl_FragColor = vec4(color.rgb * diffuse.a * u_transparency, diffuse.a * u_transparency);

(or whatever) in conjunction with the premultiplied alpha setting, and figure out how to render two assets at the same time, one with premultiplied alpha and one without. But all this is probably only an issue of the renderer implementation, and not of the sample models. Sorry again for the noise caused by my lack of knowledge here.

The texture is still rendered in "opaque black" in cesium, but maybe this is not an issue.

from gltf-sample-models.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.