Material Texture With Color Value No Effect

Yo @Deltakosh or Anyone :slight_smile:

In unity i have a car with a material texture AND and orange

Albedo Color:
#FF4F00

Albedo Texture:

Now when Unity renders that model… it BLENDS or COMBINES the Albedo Color with the Albedo Texture giving it a final brownish color…

I Unity:

But in Babylon… It like the Albedo Color has no effect if that kind of albedo texture is being used:

Anybody know what the deal… Do we not support the same kind of material/texture/color rendering as unity does ???

I would guess that would be some shader code like albedoTexture * albedoColor or something like that

1 Like

Pinging @sebavan

This should work as we multiply albedoColor and Texture in Babylon. Could you share a repro in the playground (on a box it is all good) ?

Yeah … I just check that same Material on a box and it works fine… Dunno what could be the issue with the Car Mesh Setup… Shit :frowning:

I would need the file to be able to check, or just serialize the mesh containing the material

it looks like there are not sphericals in the scene as we only see the specular contribution of the IBL.

Yo @sebavan … Can you please take look at this file
https://www.babylontoolkit.com/files/MeshCarShape.glb

Can you tell why the Albedo Color has no effect on the car…

You can try the raw GLB in sandbox or whatever

I cant tell if i am missing something in the Material Export or something… This is the only Mesh Setup i came across that doesn’t export with the right material setup

The vertex color attribute is full black and use on those body parts.

Now i dump Vertex Colors If they exists on the Mesh… Should i check if vertex color black or not ???

Yep Vertex Colors Was Issue… If i turn them off… looks pretty :slight_smile:

My question is, when exporting HOW do i know if i want to export Vertex Colors or not… In Unity i just check if mesh has any vertex colors and if so serialize them to GLTF… The GLTF Parser must be turning on that option of there are vertex colors present on the mesh.

So how do i determine if i should export vertex colors from Unity in the GLTF mesh ???

Thanks again for all your help :slight_smile:

Maybe @bghgary has the rule for this one ???

Yo @sebavan

I just end up writing a HasNonBlackColors(Color[] colors) function to test the mesh vertex colors… If they are ALL BLACK mean not one R G B channel is > 0.0… Then i ignore all black mesh vertex colors and NOT encode GLTF mesh.colors.

Working so far… I figure if you want the mesh to have some kind a COLORING then AT LEAST ONE pixel should not be ALL BLACK

Thanks for pointing that out to me… That is the second time those vertex colors screwed me up … the first was some vertex colors had ZERO ALPHA…

By the way… how did you tel all the vertex colors was black ???

I checked in the inspector and as the map was correct and the surface black, I checked with spector, and figured VERTEXCOLOR was on try to disabled it and it worked :slight_smile:

Kool … Thanks again :slight_smile:

I’ve ran into this before. IIRC, vertex colors are ignored in Unity when using Unity’s standard materials.

1 Like