Permalink
Browse files

more shaders

  • Loading branch information...
1 parent 3c2960f commit 3d22069baceed0162fca31e243659a6d7026ba99 @aras-p committed Dec 13, 2011
@@ -0,0 +1,67 @@
+ps_3_0
+; 49 ALU, 5 TEX
+dcl_2d s0
+dcl_2d s1
+dcl_2d s2
+dcl_2d s3
+dcl_2d s4
+def c5, 0.50000000, 0.41999999, 2.00000000, -1.00000000
+def c6, 1.00000000, 0.00000000, 128.00000000, 0
+dcl_texcoord0 v0
+dcl_texcoord1 v1.xy
+dcl_texcoord2 v2.xyz
+dcl_texcoord3 v3.xyz
+dcl_texcoord4 v4.xyz
+dcl_texcoord5 v5
+dp3_pp r0.x, v2, v2
+rsq_pp r0.z, r0.x
+mul_pp r1.xyz, r0.z, v2
+add r0.x, r1.z, c5.y
+rcp r0.y, r0.x
+mov_pp r0.x, c5
+mul r3.xy, r1, r0.y
+mul_pp r0.x, c3, r0
+texld r0.w, v0.zwzw, s0
+mad_pp r0.w, r0, c3.x, -r0.x
+mad r0.xy, r0.w, r3, v0.zwzw
+texld r1.yw, r0, s3
+mad_pp r0.xy, r1.wyzw, c5.z, c5.w
+mul_pp r1.w, r0.y, r0.y
+mov_pp r1.xyz, v3
+mad_pp r1.w, -r0.x, r0.x, -r1
+mad_pp r1.xyz, r0.z, v2, r1
+add_pp r0.z, r1.w, c6.x
+dp3_pp r1.w, r1, r1
+rsq_pp r1.w, r1.w
+mul_pp r1.xyz, r1.w, r1
+mov_pp r1.w, c4.x
+rsq_pp r0.z, r0.z
+rcp_pp r0.z, r0.z
+dp3_pp r1.x, r0, r1
+dp3_pp r0.x, r0, v3
+max_pp r3.w, r0.x, c6.y
+mov_pp r0.xyz, c0
+mul_pp r0.xyz, c1, r0
+mul_pp r2.y, c6.z, r1.w
+max_pp r2.x, r1, c6.y
+pow r1, r2.x, r2.y
+mov r2.y, r1.x
+mad r1.xy, r0.w, r3, v0
+mad r3.xy, r0.w, r3, v1
+texld r1, r1, s1
+mul r3.z, r1.w, r2.y
+mov_pp r2.x, c0.w
+mul_pp r2.x, c1.w, r2
+mul_pp r1, r1, c2
+mul r2.w, r3.z, r2.x
+mul_pp r2.xyz, r1, c0
+mul_pp r2.xyz, r2, r3.w
+mad r2.xyz, r0, r3.z, r2
+texldp r0.x, v5, s4
+mul_pp r0.y, r0.x, c5.z
+texld r0.w, r3, s2
+mul r3.xyz, r1, r0.w
+mul r2.xyz, r2, r0.y
+mad_pp r1.xyz, r1, v4, r2
+add_pp oC0.xyz, r1, r3
+mad oC0.w, r0.x, r2, r1
@@ -0,0 +1,92 @@
+vs_3_0
+; 79 ALU
+dcl_position o0
+dcl_texcoord0 o1
+dcl_texcoord1 o2
+dcl_texcoord2 o3
+dcl_texcoord3 o4
+dcl_texcoord4 o5
+def c33, 1.00000000, 0.00000000, 0, 0
+dcl_position0 v0
+dcl_tangent0 v1
+dcl_normal0 v2
+dcl_texcoord0 v3
+mul r3.xyz, v2, c12.w
+dp4 r0.x, v0, c5
+add r1, -r0.x, c16
+dp3 r3.w, r3, c5
+dp3 r4.x, r3, c4
+dp3 r3.x, r3, c6
+mul r2, r3.w, r1
+dp4 r0.x, v0, c4
+add r0, -r0.x, c15
+mul r1, r1, r1
+mov r4.z, r3.x
+mad r2, r4.x, r0, r2
+mov r4.w, c33.x
+dp4 r4.y, v0, c6
+mad r1, r0, r0, r1
+add r0, -r4.y, c17
+mad r1, r0, r0, r1
+mad r0, r3.x, r0, r2
+mul r2, r1, c18
+mov r4.y, r3.w
+rsq r1.x, r1.x
+rsq r1.y, r1.y
+rsq r1.w, r1.w
+rsq r1.z, r1.z
+mul r0, r0, r1
+add r1, r2, c33.x
+dp4 r2.z, r4, c25
+dp4 r2.y, r4, c24
+dp4 r2.x, r4, c23
+rcp r1.x, r1.x
+rcp r1.y, r1.y
+rcp r1.w, r1.w
+rcp r1.z, r1.z
+max r0, r0, c33.y
+mul r0, r0, r1
+mul r1.xyz, r0.y, c20
+mad r1.xyz, r0.x, c19, r1
+mad r0.xyz, r0.z, c21, r1
+mad r1.xyz, r0.w, c22, r0
+mul r0, r4.xyzz, r4.yzzx
+mul r1.w, r3, r3
+dp4 r3.z, r0, c28
+dp4 r3.y, r0, c27
+dp4 r3.x, r0, c26
+mad r1.w, r4.x, r4.x, -r1
+mul r0.xyz, r1.w, c29
+add r2.xyz, r2, r3
+add r2.xyz, r2, r0
+add o5.xyz, r2, r1
+mov r0.xyz, v1
+mul r1.xyz, v2.zxyw, r0.yzxw
+mov r0.xyz, v1
+mad r0.xyz, v2.yzxw, r0.zxyw, -r1
+mul r3.xyz, r0, v1.w
+mov r0, c10
+dp4 r4.z, c14, r0
+mov r0, c9
+mov r1.w, c33.x
+mov r1.xyz, c13
+dp4 r4.y, c14, r0
+dp4 r2.z, r1, c10
+dp4 r2.x, r1, c8
+dp4 r2.y, r1, c9
+mad r2.xyz, r2, c12.w, -v0
+mov r1, c8
+dp4 r4.x, c14, r1
+dp3 o3.y, r2, r3
+dp3 o4.y, r3, r4
+dp3 o3.z, v2, r2
+dp3 o3.x, r2, v1
+dp3 o4.z, v2, r4
+dp3 o4.x, v1, r4
+mad o1.zw, v3.xyxy, c31.xyxy, c31
+mad o1.xy, v3, c30, c30.zwzw
+mad o2.xy, v3, c32, c32.zwzw
+dp4 o0.w, v0, c3
+dp4 o0.z, v0, c2
+dp4 o0.y, v0, c1
+dp4 o0.x, v0, c0
@@ -0,0 +1,141 @@
+struct v2f_vertex_lit {
+ vec2 uv;
+ vec4 diff;
+ vec4 spec;
+};
+struct v2f_img {
+ vec4 pos;
+ vec2 uv;
+};
+struct appdata_img {
+ vec4 vertex;
+ vec2 texcoord;
+};
+struct SurfaceOutput {
+ vec3 Albedo;
+ vec3 Normal;
+ vec3 Emission;
+ float Specular;
+ float Gloss;
+ float Alpha;
+};
+struct Input {
+ vec2 uv_MainTex;
+ vec2 uv_BumpMap;
+ vec2 uv_Illum;
+ vec3 viewDir;
+};
+struct v2f_surf {
+ vec4 pos;
+ vec4 pack0;
+ vec2 pack1;
+ vec3 viewDir;
+ vec3 lightDir;
+ vec3 vlight;
+};
+struct appdata_full {
+ vec4 vertex;
+ vec4 tangent;
+ vec3 normal;
+ vec4 texcoord;
+ vec4 texcoord1;
+ vec4 color;
+};
+uniform sampler2D _BumpMap;
+uniform vec4 _Color;
+uniform sampler2D _Illum;
+uniform vec4 _LightColor0;
+uniform sampler2D _MainTex;
+uniform float _Parallax;
+uniform sampler2D _ParallaxMap;
+uniform float _Shininess;
+uniform vec4 _SpecColor;
+vec3 UnpackNormal( in vec4 packednormal );
+vec2 ParallaxOffset( in float h, in float height, in vec3 viewDir );
+void surf( in Input IN, inout SurfaceOutput o );
+vec4 LightingBlinnPhong( in SurfaceOutput s, in vec3 lightDir, in vec3 viewDir, in float atten );
+vec4 frag_surf( in v2f_surf IN );
+vec3 UnpackNormal( in vec4 packednormal ) {
+ vec3 normal;
+ normal.xy = ((packednormal.wy * 2.00000) - 1.00000);
+ normal.z = sqrt( ((1.00000 - (normal.x * normal.x )) - (normal.y * normal.y )) );
+ return normal;
+}
+vec2 ParallaxOffset( in float h, in float height, in vec3 viewDir ) {
+ vec3 v;
+ h = ((h * height) - (height / 2.00000));
+ v = normalize( viewDir );
+ v.z += 0.420000;
+ return (h * (v.xy / v.z ));
+}
+void surf( in Input IN, inout SurfaceOutput o ) {
+ float h;
+ vec2 offset;
+ vec4 tex;
+ vec4 c;
+ h = texture2D( _ParallaxMap, IN.uv_BumpMap).w ;
+ offset = ParallaxOffset( h, _Parallax, IN.viewDir);
+ IN.uv_MainTex += offset;
+ IN.uv_BumpMap += offset;
+ IN.uv_Illum += offset;
+ tex = texture2D( _MainTex, IN.uv_MainTex);
+ c = (tex * _Color);
+ o.Albedo = c.xyz ;
+ o.Gloss = tex.w ;
+ o.Emission = (c.xyz * texture2D( _Illum, IN.uv_Illum).w );
+ o.Specular = _Shininess;
+ o.Alpha = c.w ;
+ o.Normal = UnpackNormal( texture2D( _BumpMap, IN.uv_BumpMap));
+}
+vec4 LightingBlinnPhong( in SurfaceOutput s, in vec3 lightDir, in vec3 viewDir, in float atten ) {
+ vec3 h;
+ float diff;
+ float nh;
+ float spec;
+ vec4 c;
+ h = normalize( (lightDir + viewDir) );
+ diff = max( 0.000000, dot( s.Normal, lightDir));
+ nh = max( 0.000000, dot( s.Normal, h));
+ spec = (pow( nh, (s.Specular * 128.000)) * s.Gloss);
+ c.xyz = ((((s.Albedo * _LightColor0.xyz ) * diff) + ((_LightColor0.xyz * _SpecColor.xyz ) * spec)) * (atten * 2.00000));
+ c.w = (s.Alpha + (((_LightColor0.w * _SpecColor.w ) * spec) * atten));
+ return c;
+}
+vec4 frag_surf( in v2f_surf IN ) {
+ Input surfIN;
+ SurfaceOutput o;
+ float atten = 1.00000;
+ vec4 c;
+ surfIN.uv_MainTex = IN.pack0.xy ;
+ surfIN.uv_BumpMap = IN.pack0.zw ;
+ surfIN.uv_Illum = IN.pack1.xy ;
+ surfIN.viewDir = IN.viewDir;
+ o.Albedo = vec3( 0.000000);
+ o.Emission = vec3( 0.000000);
+ o.Specular = 0.000000;
+ o.Alpha = 0.000000;
+ o.Gloss = 0.000000;
+ surf( surfIN, o);
+ c = vec4( 0.000000);
+ c = LightingBlinnPhong( o, IN.lightDir, normalize( vec3( IN.viewDir) ), atten);
+ c.xyz += (o.Albedo * IN.vlight);
+ c.xyz += o.Emission;
+ return c;
+}
+varying vec4 xlv_TEXCOORD0;
+varying vec2 xlv_TEXCOORD1;
+varying vec3 xlv_TEXCOORD2;
+varying vec3 xlv_TEXCOORD3;
+varying vec3 xlv_TEXCOORD4;
+void main() {
+ vec4 xl_retval;
+ v2f_surf xlt_IN;
+ xlt_IN.pos = vec4(0.0);
+ xlt_IN.pack0 = vec4( xlv_TEXCOORD0);
+ xlt_IN.pack1 = vec2( xlv_TEXCOORD1);
+ xlt_IN.viewDir = vec3( xlv_TEXCOORD2);
+ xlt_IN.lightDir = vec3( xlv_TEXCOORD3);
+ xlt_IN.vlight = vec3( xlv_TEXCOORD4);
+ xl_retval = frag_surf( xlt_IN);
+ gl_FragData[0] = vec4( xl_retval);
+}
Oops, something went wrong. Retry.

0 comments on commit 3d22069

Please sign in to comment.