Description
How can Bevy's documentation be improved?
In PBR shading (as described in the Filament docs), IOR and Reflectance refer to the same thing.
In Filament, if you specify one, the other is derived automatically. If you specify both, you get a non-physically-accurate material.
In other software, only one of the two parameters is exposed. For example, in Blender, you only have IOR (in the Principled BSDF shader).
The relationship is governed by the equation: reflectance = pow((1.0 - ior)/(1.0 + ior), 2.0)
. The default value is 4% reflectance == 1.5 IOR. Filament and Bevy specify reflectance in a range of 0.0..=1.0, where 1.0 is 16% and 0.5 is 4%.
In Bevy's StandardMaterial, there are both reflectance
and ior
fields in the struct. However, they are not related as described above. I had to read the shader source code to figure out how they are used. Turns out that the PBR shading model only uses the reflectance
value and the ior
value is only used for transmissive materials. This was very confusing to me, as in other software (Blender, Filament, etc), I can set the IOR of the material (say according to a database like https://physicallybased.info), and the PBR shading uses that. In Bevy, setting the IOR does nothing (for non-transmissive materials). I have to convert it to a reflectance value and set reflectance instead. This is a footgun and not documented anywhere.
Perhaps Bevy should even get rid of the separate fields in the struct?