ฉันต้องการวาดตัวเลขบนวัตถุโดยใช้มัลติเท็กซ์เจอร์ แต่ภาพสุดท้ายจะสว่างกว่า เช่น
เป็นไปได้ไหมที่จะแยกสีขาวออกจากมัลติเท็กซ์เจอร์และทำให้ตัวเลขเข้มขึ้น?
นี่คือตัวแบ่งส่วนของฉัน:
#version 300 es
precision mediump float;
in vec2 v_textureCoord;
out vec4 outColor;
uniform sampler2D base_texture;
uniform sampler2D number_texture;
void main() {
// wall texture
vec4 baseColor = texture(base_texture, v_textureCoord);
// texture with digit
vec4 numberColor = texture(number_texture, v_textureCoord);
// resulting pixel color based on two textures
outColor = baseColor * (numberColor + 0.5);
}
ฉันพยายามทำสิ่งนี้:
GLES30.glEnable(GLES30.GL_BLEND);
GLES30.glBlendFunc(GLES30.GL_SRC_ALPHA, GLES30.GL_ONE);
GLES30.glActiveTexture(GLES30.GL_TEXTURE1);
...
GLES30.glDisable(GLES30.GL_BLEND);
แต่นี่ไม่ได้แก้ปัญหา
ขอบคุณสำหรับคำตอบ / ความคิดเห็น!
วิธีแก้ไข: ตามคำแนะนำของ Rabbid76 ฉันใช้สิ่งนี้:
outColor = baseColor * mix(numberColor, vec4(1.0), 0.5);
ผลลัพธ์: