-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
ModelExperimental
- Default material
#9992
Comments
@ptrgags and I found that gltf-pipeline creates a default material, but we should make sure that for other things loaded as |
I confirmed that However, I think According to the spec, default material should have:
In other words it should be a metallic but rough material, whereas the shader currently defaults to a smooth non-metal. |
@ptrgags From a glance it doesn't seem like the material struct for EDIT: Actually, we can just hard-code the values based on how they would be computed in |
I agree, hardcode the computed values. I think they'll all turn out to be straightforward constants like |
Technically we can use whatever default we want in
|
Hi @ptrgags, I'm looking at this and have a couple questions.
Is there anywhere else I need to check to make sure we always get a default material? Also, in PntsLoader, I see this: const metallicRoughness = new MetallicRoughness();
metallicRoughness.metallicFactor = 0;
metallicRoughness.roughnessFactor = 0.9;
const material = new Material();
material.metallicRoughness = metallicRoughness; Based on the spec, do we need to set This is my first time looking through the code, so let me know if I'm misunderstanding the context here. |
Hi @jjhembd,
At this point I think it's really just As far as the
That's a good question... |
Oh @jjhembd here's A modified Sandcastle example that sets up the default material. Basically I (ab)used a The relevant code is this part // Modified this shader to use the default material
const textureUniformShader = new Cesium.CustomShader({
lightingModel: Cesium.LightingModel.PBR,
mode: Cesium.CustomShaderMode.REPLACE_MATERIAL,
fragmentShaderText: `
void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)
{
}
`,
}); EDIT: Also note that the lighting looks weird for the default material since the normal is set to a constant +z direction. This was mainly because we haven't implemented #6506 |
According to the glTF spec,
The "default material" is described here: https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#default-material
This should be easy to handle, there's a couple things to check:
MaterialPipelineStage
doesn't throw an error ifprimitive.material
is undefined. A no-op is probably okayThe text was updated successfully, but these errors were encountered: