着色器 ZanLib/ClutBiliniar 的其中一个 SubProgram:
SubProgram "gles hw_tier00 " {
Keywords { "_TRANSPARENT_OFF" "_DITHERALPHA_OFF" "_VERTEXCOLOR_OFF" "_BLENDFACTOR_OFF" }
"#ifdef VERTEX
#version 100
uniform vec4 hlslcc_mtx4x4unity_ObjectToWorld[4];
uniform vec4 hlslcc_mtx4x4unity_MatrixVP[4];
uniform vec4 _MainTex_ST;
uniform vec4 _MainTex_TexelSize;
attribute highp vec4 in_POSITION0;
attribute highp vec4 in_TEXCOORD0;
varying mediump vec2 vs_TEXCOORD0;
varying mediump vec2 vs_TEXCOORD1;
varying mediump vec2 vs_TEXCOORD2;
varying mediump vec2 vs_TEXCOORD3;
varying highp vec2 vs_TEXCOORD4;
vec4 u_xlat0;
vec4 u_xlat1;
vec2 u_xlat4;
void main()
{
u_xlat0 = in_POSITION0.yyyy * hlslcc_mtx4x4unity_ObjectToWorld[1];
u_xlat0 = hlslcc_mtx4x4unity_ObjectToWorld[0] * in_POSITION0.xxxx + u_xlat0;
u_xlat0 = hlslcc_mtx4x4unity_ObjectToWorld[2] * in_POSITION0.zzzz + u_xlat0;
u_xlat0 = u_xlat0 + hlslcc_mtx4x4unity_ObjectToWorld[3];
u_xlat1 = u_xlat0.yyyy * hlslcc_mtx4x4unity_MatrixVP[1];
u_xlat1 = hlslcc_mtx4x4unity_MatrixVP[0] * u_xlat0.xxxx + u_xlat1;
u_xlat1 = hlslcc_mtx4x4unity_MatrixVP[2] * u_xlat0.zzzz + u_xlat1;
gl_Position = hlslcc_mtx4x4unity_MatrixVP[3] * u_xlat0.wwww + u_xlat1;
u_xlat4.x = 0.0;
u_xlat4.y = _MainTex_TexelSize.y;
u_xlat0.xy = in_TEXCOORD0.xy * _MainTex_ST.xy + _MainTex_ST.zw;
u_xlat0.xy = (-_MainTex_TexelSize.xy) * vec2(0.5, 0.5) + u_xlat0.xy;
vs_TEXCOORD1.xy = u_xlat4.xy + u_xlat0.xy;
vs_TEXCOORD0.xy = u_xlat0.xy;
u_xlat1.x = _MainTex_TexelSize.x;
u_xlat1.y = 0.0;
vs_TEXCOORD2.xy = u_xlat0.xy + u_xlat1.xy;
vs_TEXCOORD3.xy = u_xlat0.xy + _MainTex_TexelSize.xy;
vs_TEXCOORD4.xy = u_xlat0.xy * _MainTex_TexelSize.zw;
return;
}
#endif
#ifdef FRAGMENT
#version 100
#ifdef GL_FRAGMENT_PRECISION_HIGH
precision highp float;
#else
precision mediump float;
#endif
precision highp int;
uniform vec4 _CLUT_TexelSize;
uniform lowp sampler2D _MainTex;
uniform lowp sampler2D _CLUT;
varying mediump vec2 vs_TEXCOORD0;
varying mediump vec2 vs_TEXCOORD1;
varying mediump vec2 vs_TEXCOORD2;
varying mediump vec2 vs_TEXCOORD3;
varying highp vec2 vs_TEXCOORD4;
#define SV_Target0 gl_FragData[0]
vec4 u_xlat0;
lowp float u_xlat10_0;
vec4 u_xlat1;
mediump vec4 u_xlat16_1;
lowp vec4 u_xlat10_1;
vec4 u_xlat2;
mediump vec4 u_xlat16_2;
lowp vec4 u_xlat10_2;
float u_xlat3;
lowp vec4 u_xlat10_3;
vec2 u_xlat8;
vec2 u_xlat10;
void main()
{
u_xlat10_0 = texture2D(_MainTex, vs_TEXCOORD3.xy).w;
u_xlat0.x = u_xlat10_0 * _CLUT_TexelSize.z + (-_CLUT_TexelSize.x);
u_xlat0.x = u_xlat0.x / _CLUT_TexelSize.z;
u_xlat0.y = float(0.0);
u_xlat8.y = float(0.0);
u_xlat10_1 = texture2D(_CLUT, u_xlat0.xy);
u_xlat10_0 = texture2D(_MainTex, vs_TEXCOORD1.xy).w;
u_xlat0.x = u_xlat10_0 * _CLUT_TexelSize.z + (-_CLUT_TexelSize.x);
u_xlat2.x = u_xlat0.x / _CLUT_TexelSize.z;
u_xlat2.y = float(0.0);
u_xlat10.y = float(0.0);
u_xlat10_3 = texture2D(_CLUT, u_xlat2.xy);
u_xlat16_1 = u_xlat10_1 + (-u_xlat10_3);
u_xlat0.xy = fract(vs_TEXCOORD4.xy);
u_xlat1 = u_xlat0.xxxx * u_xlat16_1 + u_xlat10_3;
u_xlat10_2.x = texture2D(_MainTex, vs_TEXCOORD2.xy).w;
u_xlat2.x = u_xlat10_2.x * _CLUT_TexelSize.z + (-_CLUT_TexelSize.x);
u_xlat10.x = u_xlat2.x / _CLUT_TexelSize.z;
u_xlat10_2 = texture2D(_CLUT, u_xlat10.xy);
u_xlat10_3.x = texture2D(_MainTex, vs_TEXCOORD0.xy).w;
u_xlat3 = u_xlat10_3.x * _CLUT_TexelSize.z + (-_CLUT_TexelSize.x);
u_xlat8.x = u_xlat3 / _CLUT_TexelSize.z;
u_xlat10_3 = texture2D(_CLUT, u_xlat8.xy);
u_xlat16_2 = u_xlat10_2 + (-u_xlat10_3);
u_xlat2 = u_xlat0.xxxx * u_xlat16_2 + u_xlat10_3;
u_xlat1 = u_xlat1 + (-u_xlat2);
u_xlat0 = u_xlat0.yyyy * u_xlat1 + u_xlat2;
SV_Target0.w = ceil(u_xlat0.w);
SV_Target0.xyz = u_xlat0.xyz;
return;
}
#endif
"
}
图形学零基础,会写一点 Python 但完全没用过 NumPy ,有 V 友能帮帮忙么?
附上 ChatGPT 的聊天记录:
不知道正确率有多少,但能胡编出这么多看起来相关的内容也挺厉害了
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.