[x3d-public] X3D 4: Change whether ambientParameter is affected by diffuseTexture?

Michalis Kamburelis michalis.kambi at gmail.com
Tue Mar 16 00:59:21 PDT 2021


Hi,

Thanks to Victor Amat, I became aware that I did break compatibility
in X3D 4 light equations, compared to X3D 3 treatment of Phong
Materials. The fix is very trivial if you agree, read on:

In X3D 4 right now, in "17.2.2.5 Phong lighting model" (
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD3/Part01/components/lighting.html#LightingPhong
) says that ambientParameter is calculated using ambientIntensity,
diffuseColor and ambientTexture.

This means that that Material.diffuseTexture and Appearance.texture
*do not* affect the ambient term. Only diffuseColor does. This is

- unrealistic (a normal "black body", like black velvet, should not
make ambient or diffuse light -- think of what happens if you express
this "black body" using a black diffuse texture)

- incompatible with X3D 3. The lighting equations in X3D 3 (
https://www.web3d.org/documents/specifications/19775-1/V3.3/Part01/components/lighting.html#Lightingequations
) said that ambient_i is affected by O_Drgb which in turn is (citing)
"""diffuse colour, from a node derived from X3DMaterialNode,  a node
derived from X3DColorNode, and/or a texture node""".

The fix is extremely trivial: In
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-WD3/Part01/components/lighting.html#LightingPhong
,

  ambientParameter = ambientIntensity × diffuseColor ×
textureSample(ambientTexture).rgb

shoud change to

  ambientParameter = ambientIntensity × diffuseParameter.rgb ×
textureSample(ambientTexture).rgb

IOW just change "diffuseColor" to "diffuseParameter.rgb". The
"diffuseParameter" is defined above, it is determined by diffuseColor,
diffuseTexture, possible per-vertex colors etc.

What do you think?

Regards,
Michalis



More information about the x3d-public mailing list