Comments (4)
I agree, this looks sketchy. @tfili do you know off the top of your head if this is what is actually intended:
color = vec4(color.rgb * diffuse.a, diffuse.a * u_transparency);
gl_FragColor = color;
from collada2gltf.
@javagl @pjcozzi Just taking a quick look this is what I've scraped together:
If you look at the COLLADA spec (https://www.khronos.org/files/collada_spec_1_4.pdf) under the section Determining Transparency (Opacity)
on page 223. You'll see that for A_ONE
opaque mode the color is defined
result.r = fb.r * (1.0f - transparent.a * transparency) + mat.r *
(transparent.a * transparency)
result.g = fb.g * (1.0f - transparent.a * transparency) + mat.g *
(transparent.a * transparency)
result.b = fb.b * (1.0f - transparent.a * transparency) + mat.b *
(transparent.a * transparency)
result.a = fb.a * (1.0f - transparent.a * transparency) + mat.a *
(transparent.a * transparency)
And in the getTransparency
function here we compute the value that will eventually become u_transparency
to be (transparent.a * transparency)
.
So with all that I think there is a bug and the actual shader code should be
color = vec4(color.rgb * u_transparency, diffuse.a * u_transparency);
Does that sound right to everyone?
from collada2gltf.
So with all that I think there is a bug and the actual shader code should be
color = vec4(color.rgb * u_transparency, diffuse.a * u_transparency);
Does that sound right to everyone?
I think that
color = vec4(color.rgb * diffuse.a * u_transparency, diffuse.a * u_transparency);
// ^^this^^^
may not be omitted here, depending on where exactly the initial value of diffuse.a
comes from (a texture or a uniform), but I'd have to match this with the writer code that you linked to. At least for the case of one of the VC model shaders ( https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/1.0/VC/glTF/VC2FS.glsl ), I think it is necessary for the case that someone set the u_diffuse
uniform to something where a < 1.0
, and additionally sets the u_transparency
uniform to be < 1.0.
Iff this is right, it would be in line with what I wrote in javagl/JglTF#6 (comment) , and I think that this could eventually fix KhronosGroup/glTF#576 . And, just as another pointer: The "Possibly unrelated..." part from KhronosGroup/glTF-Sample-Models#8 is actually related to this issue.
from collada2gltf.
2.0 implementation of shader generation (based on gltf-pipeline) should do this correctly - closing.
from collada2gltf.
Related Issues (20)
- Can't find COLLADA2GLTF-bin[.exe] after building the sln
- Export settings for CityEngine
- Exported file wrong transform mode resulting in broken animation and models
- Model will lose when have lots of components?
- I/O warning : failed to load external entity HOT 2
- texture with spaces in name
- Some parts of model are converted with wrong position
- Texture coords not being exported HOT 1
- GLTF::Node::Transform must have virtual destructor
- Nothing happens when I type .\COLLADA2GLTF-bin in terminal
- COLLADA2GLTF-v2.1.5-windows-Release-x64 canot convert dae to gltf 1.0, but v2.1.4 can HOT 2
- Transparency conversion seems to be lost
- fatal error: draco/draco_features.h: No such file or directory when make? HOT 5
- ERROR: Couldn't write buffer to path '' HOT 1
- Compression Level for Draco
- Segfaults, vertices strewn in random places, missing faces, etc.
- Wrong Tangent and Binormal After Conversion
- the dracoCompression doesn't work in COLLADA2GLTF v2.1.5 using COLLADA2GLTF-v2.1.5-windows-Release-x64.zip
- Converting GLTF to Collada? HOT 2
- Please rename default branch from 'master' to 'main' per Khronos policy HOT 2
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 collada2gltf.