Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom material color is darker in android device #8142

Open
zhangbo-0213 opened this issue Sep 19, 2024 · 0 comments
Open

Custom material color is darker in android device #8142

zhangbo-0213 opened this issue Sep 19, 2024 · 0 comments

Comments

@zhangbo-0213
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant