Fix copper traces nearly invisible in 3D viewer
The TransparencyControl function was squaring the gray color value to make dark solder masks more opaque, but this made the default green mask (gray ~0.13) nearly completely opaque, hiding copper traces underneath. The squaring was unnecessary since truly dark colors already produce near-zero transparency from the existing cubic formula. The specular floor, dynamic shininess, and reflection scaling from the same commit already properly handle dark solder mask appearance. Fixes https://gitlab.com/kicad/code/kicad/-/issues/23103
This commit is contained in:
@@ -48,8 +48,8 @@
|
||||
|
||||
/**
|
||||
* Attempt to control the transparency based on the gray value of the color.
|
||||
* This function applies a non-linear transformation that makes darker colors more opaque,
|
||||
* preventing copper show-through on dark solder masks like black.
|
||||
* This function applies a non-linear transformation that reduces transparency
|
||||
* for darker colors while preserving copper visibility through the solder mask.
|
||||
*
|
||||
* @param aGrayColorValue - diffuse gray value (0.0 to 1.0)
|
||||
* @param aTransparency - base transparency value (0.0 opaque to 1.0 transparent)
|
||||
@@ -63,9 +63,7 @@ static float TransparencyControl( float aGrayColorValue, float aTransparency )
|
||||
float ca = 1.0f - aTransparency;
|
||||
ca = 1.00f - 1.05f * ca * ca * ca;
|
||||
|
||||
// Squaring gray value makes darker colors more opaque, which improves appearance
|
||||
// of dark solder masks like black where copper would otherwise show through
|
||||
return glm::clamp( aGrayColorValue * aGrayColorValue * ca + aaa, 0.0f, 1.0f );
|
||||
return glm::clamp( aGrayColorValue * ca + aaa, 0.0f, 1.0f );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,9 +64,7 @@ static float TransparencyControl( float aGrayColorValue, float aTransparency )
|
||||
float ca = 1.0f - aTransparency;
|
||||
ca = 1.00f - 1.05f * ca * ca * ca;
|
||||
|
||||
// Squaring gray value makes darker colors more opaque, which improves appearance
|
||||
// of dark solder masks like black where copper would otherwise show through
|
||||
return glm::max( glm::min( aGrayColorValue * aGrayColorValue * ca + aaa, 1.0f ), 0.0f );
|
||||
return glm::max( glm::min( aGrayColorValue * ca + aaa, 1.0f ), 0.0f );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user