filament icon indicating copy to clipboard operation
filament copied to clipboard

Custom material color is darker in android device

Open zhangbo-0213 opened this issue 1 year ago • 1 comments

Describe the bug we use custom material and set the same color, but in some android device , the color is darker, while iOS is lighter, the iOS color is what we wanted; and if we restart the app, the color is the same with iOS in some android device, sometime we start app , the material color in android device is normal, but sometime it is darker(30%-40% appear), while the color in iOS device is always right.

To Reproduce Steps to reproduce the behavior: use the custom material in android device

Expected behavior the color in android device should always be the same with iOS device

Logs here is the custom material mat:

material {
name : CarPainter,
shadingModel : lit,
blending : opaque,
flipUV:false,
requires : [
uv0
],
parameters : [
{
type : float3,
name : baseColorFactor
},
{
type : sampler2d,
name : gradientMapFactor
},
{
type : float3,
name : gradientColorFactor
},
{
type : sampler2d,
name : baseMapFactor
},
{
type : float3,
name : baseMapColorFactor
},
{
type : float3,
name : subsurfaceColorFactor
},
{
type : float,
name : roughnessFactor
},
{
type : float,
name : metallicFactor
},
{
type : float,
name : reflectance
},
{
type : float3,
name : sheenColorFactor
},
{
type : float,
name : sheenRoughnessFactor
},
{
type : float,
name : clearCoatFactor
},
{
type : float,
name : clearCoatRoughnessFactor
},
{
type : sampler2d,
name : ambientOcclusionMapFactor
}
]
}

fragment {
void material(inout MaterialInputs material) {
    prepareMaterial(material);
    float gradientValue = texture(materialParams_gradientMapFactor, getUV0()).r;
    float baseMapValue = texture(materialParams_baseMapFactor, getUV0()).r;
    material.baseColor.rgb = saturate((materialParams.baseColorFactor * (1.0 - gradientValue) +     materialParams.gradientColorFactor * gradientValue) * (1.0 - baseMapValue) + materialParams.baseMapColorFactor * baseMapValue);

    material.roughness = materialParams.roughnessFactor;
    material.metallic = materialParams.metallicFactor;

    material.sheenColor = materialParams.sheenColorFactor;
    material.sheenRoughness = materialParams.sheenRoughnessFactor;
    material.clearCoat = materialParams.clearCoatFactor;
    material.clearCoatRoughness = materialParams.clearCoatRoughnessFactor;
    material.ambientOcclusion = texture(materialParams_ambientOcclusionMapFactor, getUV0()).r ;
}
}

Smartphone (please complete the following information): Device: iPhone 13 / Redmi Note 11T Pro OS: iOS 17.4.1 / Android 14

Additional context Filament 1.28.0

zhangbo-0213 avatar Sep 19 '24 08:09 zhangbo-0213

Can you attach some screenshot and repro steps? Which app did you use? Do you see the problem on the Android emulator, or on other devices?

This bug report is not actionable, there is nothing we can do or investigate.

pixelflinger avatar Sep 26 '24 18:09 pixelflinger