Qt Quick 3D - 自定义材质范例

void MAIN()
{
    vec2 size = vec2(textureSize(SCREEN_TEXTURE, 0));
    vec2 uv = FRAGCOORD.xy / size;
    vec2 d = vec2(1.0 / size.x, 1.0 / size.y);
    vec4 diff = texture(SCREEN_TEXTURE, uv + d) - texture(SCREEN_TEXTURE, uv - d);
    float c = (diff.x + diff.y + diff.z) + 0.5;
    float alpha = 1.0;
    if (uKeepAlpha)
        alpha = texture(SCREEN_TEXTURE, uv).a;
    BASE_COLOR = vec4(vec3(c), alpha);
}
				

版权所有  © 2014-2025 乐数软件    

工业和信息化部: 粤ICP备14079481号-1