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

Michalis Kamburelis michalis.kambi at gmail.com
Thu Apr 8 14:47:51 PDT 2021


I am bumping this thread. Anyone has any opinion?

I propose in my mail a fix to X3D 4 lighting equations. Due to my mistake:

- Phong lighting is not perfectly backward-compatible to X3D 3 in one
case: when you provided a dark texture for diffuse in X3D 3, and
relied that it will also make ambient term dark.

- It may also be a bit unnatural, as you can have a surface with black
diffuse texture, yet it will have a bright ambient. This is unnatural.

In my mail I propose a simple fix for both these issues: just one
equation needs a very small change, 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". See my first
email in this thread for details. Can we fix it in X3D 4.0, or is this
too late now?

Regards,
Michalis



wt., 16 mar 2021 o 08:59 Michalis Kamburelis
<michalis.kambi at gmail.com> napisał(a):

>
> 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