1 Shader "Custom/FaceTexture" {
4 _MainTex ("Front", 2D) = "white" {}
5 _Side ("Side", 2D) = "white" {}
13 uniform sampler2D _MainTex;
14 uniform sampler2D _Side;
15 varying vec4 textureCoordinates;
23 textureCoordinates = gl_MultiTexCoord0;
26 gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
35 float yOffset = 0.03f;
37 float frontX = textureCoordinates.x;
38 // float frontY = textureCoordinates.y - 0.06f;
39 float frontY = textureCoordinates.y;
41 float siderX = textureCoordinates.x - 0.3f - 0.25f * textureCoordinates.y;
42 float sidelX = 1.0f - textureCoordinates.x - 0.3f - 0.25f * textureCoordinates.y;
43 // float siderX = textureCoordinates.x - 0.6f * textureCoordinates.y + 0.1f;
46 // float sidelX = 0.8f - textureCoordinates.x - 0.3 * textureCoordinates.y ;// + 0.39f * -textureCoordinates.y - 0.04f;
47 // float siderX = 0.65f + textureCoordinates.x;// - 0.6f * textureCoordinates.y + 0.1f;
49 // float sideY = textureCoordinates.y - 0.062f;
50 float sideY = textureCoordinates.y - yOffset;
53 vec4 f = texture2D(_MainTex, vec2(frontX, frontY));
55 vec4 sl = texture2D(_Side, vec2(sidelX, sideY));
56 vec4 sr = texture2D(_Side, vec2(siderX, sideY));
58 float mixl, mixr, mixf;
60 float gf = (f.r + f.g + f.b) / 3.0f;
62 float Pi = 3.1415926535897932384626433832795f;
65 float x = textureCoordinates.x;
66 float prob = 1.0f / sqrt( 2.0f*Pi*pow(sigma,2.0f) ) * exp( -(pow(x-m,2.0f)/(2.0f*pow(sigma,2.0f) )));
68 float p = 1.0f - prob * 0.2f;
83 vec4 c = sl * mixl + sr * mixr + f * mixf;
86 gl_FragColor = vec4(0.0f,0.0f,0.0f,1.0f);