Skip to content

Slightly ambiguous wording in KHR_materials_clearcoat on the default value of clearcoatFactor #2545

@juj

Description

@juj

The KHR_materials_clearcoat extension states:

The values for clearcoat layer intensity and clearcoat roughness can be defined using factors, textures, or both.
[...]
If both factors and textures are present, the factor value acts as a linear multiplier for the corresponding texture values.

However, there is a slight technical ambiguity here. It is not unreasonable in colloquial English to read the second statement above as meaning

(Only) If both factors and textures are present, the factor value acts as a linear multiplier for the corresponding texture values.

i.e. if the factor is not present, or the texture is not present, then this multiplication should not be performed. (If the multiplication is to be performed in all cases, it would be good to phrase that without using a conditional if)

So, what should happen with the following material?

{
  "name": "example_material",
  "extensions": {
    "KHR_materials_clearcoat": {
      "clearcoatTexture": {
          "index": 18
      }
  }
}

Here, the clearcoat layer intensity is defined using a texture (as allowed by the "defined using factors, textures, or both" part of the spec).

The clearcoatFactor property is not specified, which, the spec states also in the table that it is optional to specify:

Image

If clearcoatTexture were all white, then based on the above wording, one could expect clearcoat to be enabled, and the result to be a full 1.0x clearcoat effect being applied.

But then the spec also states that

If clearcoatFactor (in the extension) is zero, the whole clearcoat layer is disabled.

which is a bit of an ambiguous/contradicting statement to what was previously stated.

In other words, the spec words a "No, default: 0.0" optional field, then proceeds to specify the arithmetic behavior that should happen when the optional field is omitted, but then makes a second point to explicitly disable the whole feature if the said field is not present.

I was scratching my head a bit on this, and then searched through all the models in the sample models database to see that they all avoid this ambiguity by specifying clearcoatFactor: 1 in all used materials.

Would it make more sense to either state a) Required: Yes for clearcoatFactor in the schema, or b) Required: No, default: 1.0 to enable the above material to be well-formed (to use a clearcoatTexture but no clearcoatFactor to modulate it)?

Currently the above example_material has an unexpected behavior of actually not enabling clearcoat on the material, it's just dead JSON characters in a file? So it would be either good to invalidate such JSON in validators, or to make it explicitly work like a casual reader would expect it to behave?

Metadata

Metadata

Assignees

No one assigned

    Labels

    PBRPhysically Based Rendering

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions