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

Don Brutzman brutzman at nps.edu
Sat Apr 10 13:14:52 PDT 2021


Thanks for the close scrutiny and proposed fix.  Seems sensible.

Might you create a simple Mantis issue describing problem and fix?

In a few weeks we will be deciding which active Mantis issues will get sent to ISO prior to the early-May voting deadline for X3D4 Committee Draft.

Appreciate your efforts to ensure we are fully aligned with glTF.


On 4/8/2021 2:47 PM, Michalis Kamburelis wrote:
> 
> 
> 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://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.web3d.org%2Fspecifications%2FX3Dv4Draft%2FISO-IEC19775-1v4-WD3%2FPart01%2Fcomponents%2Flighting.html%23LightingPhong&data=04%7C01%7Cbrutzman%40nps.edu%7Ca66fbb0c66424879413508d8fad82f12%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637535153719230930%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0OYP7t3T%2FiS7tc6acYcCyh92lm%2FXnBT3TFQG1TuyY68%3D&reserved=0
> :
> 
>    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://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.web3d.org%2Fspecifications%2FX3Dv4Draft%2FISO-IEC19775-1v4-WD3%2FPart01%2Fcomponents%2Flighting.html%23LightingPhong&data=04%7C01%7Cbrutzman%40nps.edu%7Ca66fbb0c66424879413508d8fad82f12%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637535153719230930%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0OYP7t3T%2FiS7tc6acYcCyh92lm%2FXnBT3TFQG1TuyY68%3D&reserved=0
>> ) 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://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.web3d.org%2Fdocuments%2Fspecifications%2F19775-1%2FV3.3%2FPart01%2Fcomponents%2Flighting.html%23Lightingequations&data=04%7C01%7Cbrutzman%40nps.edu%7Ca66fbb0c66424879413508d8fad82f12%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637535153719230930%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=05pNX8Cc2i5QLwrhVQ4WKx8yBJGFVYlaFU%2Bz1oqVVzY%3D&reserved=0
>> ) 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://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.web3d.org%2Fspecifications%2FX3Dv4Draft%2FISO-IEC19775-1v4-WD3%2FPart01%2Fcomponents%2Flighting.html%23LightingPhong&data=04%7C01%7Cbrutzman%40nps.edu%7Ca66fbb0c66424879413508d8fad82f12%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637535153719230930%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=0OYP7t3T%2FiS7tc6acYcCyh92lm%2FXnBT3TFQG1TuyY68%3D&reserved=0
>> ,
>>
>>    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
> 
> _______________________________________________
> x3d-public mailing list
> x3d-public at web3d.org
> https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fweb3d.org%2Fmailman%2Flistinfo%2Fx3d-public_web3d.org&data=04%7C01%7Cbrutzman%40nps.edu%7Ca66fbb0c66424879413508d8fad82f12%7C6d936231a51740ea9199f7578963378e%7C0%7C0%7C637535153719240915%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=JMTRAcxSXHPBzA3%2Fd%2Bc5ijKxZ%2FXHFlnEK1bBrxMoYkU%3D&reserved=0
> 

all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list