init
This commit is contained in:
commit
2fe6ca2f65
1473 changed files with 251771 additions and 0 deletions
39
gamedata/shaders/r1/.lua
Normal file
39
gamedata/shaders/r1/.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
function printf(fmt, ...)
|
||||
log(string.format(fmt, unpack(arg)))
|
||||
end
|
||||
|
||||
t_point_att = "internal\\internal_light_attpoint"
|
||||
t_rt = "$user$rendertarget"
|
||||
t_distort = "$user$distort"
|
||||
t_noise = "fx\\fx_noise2"
|
||||
|
||||
function r1_lspot(shader, t_base, vs, aref)
|
||||
shader:begin(vs, "add_spot")
|
||||
:fog(false)
|
||||
:zb(true, false)
|
||||
:blend(true, blend.one, blend.one)
|
||||
:aref(true, aref or 0)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
shader:sampler("s_lmap"):texture("internal\\internal_light_att")
|
||||
:clamp()
|
||||
:f_linear()
|
||||
:project(true)
|
||||
shader:sampler("s_att"):texture("internal\\internal_light_attclip")
|
||||
:clamp()
|
||||
:f_linear()
|
||||
end
|
||||
|
||||
function r1_lpoint(shader, t_base, vs, aref)
|
||||
shader:begin(vs, "add_point")
|
||||
:fog(false)
|
||||
:zb(true, false)
|
||||
:blend(true, blend.one, blend.one)
|
||||
:aref(true, aref or 0)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
shader:sampler("s_lmap"):texture(t_point_att)
|
||||
:clamp()
|
||||
:f_linear()
|
||||
shader:sampler("s_att"):texture(t_point_att)
|
||||
:clamp()
|
||||
:f_linear()
|
||||
end
|
||||
18
gamedata/shaders/r1/add_point.ps.hlsl
Normal file
18
gamedata/shaders/r1/add_point.ps.hlsl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
// Pixel
|
||||
float4 main(vf_point I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_att1 = tex2D(s_lmap, I.tc1); // point-att
|
||||
float4 t_att2 = tex2D(s_att, I.tc2); // point-att
|
||||
float4 t_att = t_att1 * t_att2;
|
||||
|
||||
float4 final_color = t_base * t_att * I.color;
|
||||
final_color.rgb *= t_base.a;
|
||||
float3 final_rgb = (final_color + final_color) * 2.0f;
|
||||
float final_a = final_color.w;
|
||||
|
||||
// out
|
||||
return final_color * 2.0f; // float4 (final_rgb,final_a);
|
||||
}
|
||||
20
gamedata/shaders/r1/add_ppa.ps.hlsl
Normal file
20
gamedata/shaders/r1/add_ppa.ps.hlsl
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // base
|
||||
};
|
||||
|
||||
uniform sampler2D s_base0;
|
||||
uniform sampler2D s_base1;
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_0 = tex2D(s_base0, I.tc0);
|
||||
float4 t_1 = tex2D(s_base1, I.tc1);
|
||||
|
||||
// out
|
||||
return t_0 * t_1 * L_dynamic_color;
|
||||
}
|
||||
17
gamedata/shaders/r1/add_spot.ps.hlsl
Normal file
17
gamedata/shaders/r1/add_spot.ps.hlsl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
// Pixel
|
||||
float4 main(vf_spot I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_lmap = tex2Dproj(s_lmap, I.tc1); // spot-projector
|
||||
float4 t_att = tex2D(s_att, I.tc2); // spot-att
|
||||
|
||||
float4 final_color = t_base * t_lmap * t_att * I.color;
|
||||
final_color.rgb *= t_base.a;
|
||||
float3 final_rgb = (final_color + final_color) * 2.0f;
|
||||
float final_a = final_color.w;
|
||||
|
||||
// out
|
||||
return final_color * 2; // float4 (final_rgb,final_a);
|
||||
}
|
||||
20
gamedata/shaders/r1/avg2.ps.hlsl
Normal file
20
gamedata/shaders/r1/avg2.ps.hlsl
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // base
|
||||
};
|
||||
|
||||
uniform sampler2D s_base0;
|
||||
uniform sampler2D s_base1;
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_0 = tex2D(s_base0, I.tc0);
|
||||
float4 t_1 = tex2D(s_base1, I.tc1);
|
||||
|
||||
// out
|
||||
return (t_0 + t_1) * .5;
|
||||
}
|
||||
26
gamedata/shaders/r1/avg4.ps.hlsl
Normal file
26
gamedata/shaders/r1/avg4.ps.hlsl
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // base
|
||||
float2 tc2 : TEXCOORD2; // base
|
||||
float2 tc3 : TEXCOORD3; // base
|
||||
};
|
||||
|
||||
uniform sampler2D s_base0;
|
||||
uniform sampler2D s_base1;
|
||||
uniform sampler2D s_base2;
|
||||
uniform sampler2D s_base3;
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_0 = tex2D(s_base0, I.tc0);
|
||||
float4 t_1 = tex2D(s_base1, I.tc1);
|
||||
float4 t_2 = tex2D(s_base2, I.tc2);
|
||||
float4 t_3 = tex2D(s_base3, I.tc3);
|
||||
|
||||
// out
|
||||
return ((t_0 + t_1) * .5 + (t_2 + t_3) * .5) * .5;
|
||||
}
|
||||
20
gamedata/shaders/r1/base_laser.ps.hlsl
Normal file
20
gamedata/shaders/r1/base_laser.ps.hlsl
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0: TEXCOORD0; // base
|
||||
float2 tc1: TEXCOORD1; // lmap
|
||||
float4 c0: COLOR0; // sun
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Pixel
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D (s_base,I.tc0);
|
||||
|
||||
// out
|
||||
return float4 (t_base.r,t_base.g,t_base.b,t_base.a * I.c0.a);
|
||||
|
||||
|
||||
}
|
||||
17
gamedata/shaders/r1/base_lplanes.ps.hlsl
Normal file
17
gamedata/shaders/r1/base_lplanes.ps.hlsl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // lmap
|
||||
float4 c0 : COLOR0; // sun
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
|
||||
// out
|
||||
return float4(t_base.r, t_base.g, t_base.b, t_base.a * I.c0.a);
|
||||
}
|
||||
25
gamedata/shaders/r1/base_lplanes.vs.hlsl
Normal file
25
gamedata/shaders/r1/base_lplanes.vs.hlsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float4 c0 : COLOR0; // color
|
||||
};
|
||||
|
||||
vf main(v_vert v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_WVP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv, v.T.w, v.B.w); // copy tc
|
||||
// o.tc0 = unpack_tc_base (v.tc); // copy tc
|
||||
|
||||
// calculate fade
|
||||
float3 dir_v = normalize(mul(m_WV, v.P));
|
||||
float3 norm_v = normalize(mul(m_WV, unpack_normal(v.N)));
|
||||
float fade = abs(dot(dir_v, norm_v));
|
||||
o.c0 = fade;
|
||||
|
||||
return o;
|
||||
}
|
||||
31
gamedata/shaders/r1/base_lplanes_fft.ps.hlsl
Normal file
31
gamedata/shaders/r1/base_lplanes_fft.ps.hlsl
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0: TEXCOORD0; // base
|
||||
float2 tc1: TEXCOORD1; // lmap
|
||||
float4 c0: COLOR0; // sun
|
||||
};
|
||||
|
||||
inline bool isCollimatorActive()
|
||||
{
|
||||
return (m_hud_params.w == 1.0f);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base,I.tc0);
|
||||
|
||||
// out
|
||||
|
||||
if(isCollimatorActive())
|
||||
{
|
||||
return float4(t_base.r,t_base.g,t_base.b,t_base.a * I.c0.a);
|
||||
}
|
||||
else
|
||||
{
|
||||
return float4(t_base.r,t_base.g,t_base.b,t_base.a * 0.0f);
|
||||
}
|
||||
}
|
||||
7
gamedata/shaders/r1/blur2.lua
Normal file
7
gamedata/shaders/r1/blur2.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("null", "avg2")
|
||||
:fog(false)
|
||||
:zb(false, false)
|
||||
shader:sampler("s_base0"):texture(t_base):clamp():f_linear()
|
||||
shader:sampler("s_base1"):texture(t_base):clamp():f_linear()
|
||||
end
|
||||
9
gamedata/shaders/r1/blur4.lua
Normal file
9
gamedata/shaders/r1/blur4.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("null", "avg4")
|
||||
:fog(false)
|
||||
:zb(false, false)
|
||||
shader:sampler("s_base0"):texture(t_base):clamp():f_linear()
|
||||
shader:sampler("s_base1"):texture(t_base):clamp():f_linear()
|
||||
shader:sampler("s_base2"):texture(t_base):clamp():f_linear()
|
||||
shader:sampler("s_base3"):texture(t_base):clamp():f_linear()
|
||||
end
|
||||
10
gamedata/shaders/r1/clouds.lua
Normal file
10
gamedata/shaders/r1/clouds.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("clouds", "clouds")
|
||||
:fog(false)
|
||||
:zb(true, false)
|
||||
:sorting(3, true)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
shader:sampler("s_clouds0"):texture("null"):wrap():f_anisotropic()
|
||||
shader:sampler("s_clouds1"):texture("null"):wrap():f_anisotropic()
|
||||
shader:sampler("s_tonemap"):texture("$user$tonemap")
|
||||
end
|
||||
21
gamedata/shaders/r1/clouds.ps.hlsl
Normal file
21
gamedata/shaders/r1/clouds.ps.hlsl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 color : COLOR0; // rgb. intensity
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
};
|
||||
|
||||
uniform sampler2D s_clouds0 : register(s0);
|
||||
uniform sampler2D s_clouds1 : register(s1);
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 s0 = tex2D(s_clouds0, I.tc0);
|
||||
float4 s1 = tex2D(s_clouds1, I.tc1);
|
||||
float4 mix = I.color * (s0 + s1);
|
||||
|
||||
return float4(mix.rgb, mix.a);
|
||||
}
|
||||
37
gamedata/shaders/r1/clouds.vs.hlsl
Normal file
37
gamedata/shaders/r1/clouds.vs.hlsl
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include "common.hlsli"
|
||||
#include "shared\cloudconfig.hlsli"
|
||||
|
||||
struct vi
|
||||
{
|
||||
float4 p : POSITION;
|
||||
float4 dir : COLOR0; // dir0,dir1(w<->z)
|
||||
float4 color : COLOR1; // rgb. intensity
|
||||
};
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 color : COLOR0; // rgb. intensity
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
};
|
||||
|
||||
vf main(vi v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_WVP, v.p); // xform, input in world coords
|
||||
o.color = v.color; // copy color
|
||||
|
||||
o.color.w *= pow(v.p.y, 25);
|
||||
|
||||
// if (length(float3(v.p.x,0,v.p.z))>CLOUD_FADE) o.color.w = 0 ;
|
||||
|
||||
// generate tcs
|
||||
float2 d0 = v.dir.xy * 2 - 1;
|
||||
float2 d1 = v.dir.wz * 2 - 1;
|
||||
o.tc0 = v.p.xz * CLOUD_TILE0 + d0 * timers.z * CLOUD_SPEED0;
|
||||
o.tc1 = v.p.xz * CLOUD_TILE1 + d1 * timers.z * CLOUD_SPEED1;
|
||||
|
||||
return o;
|
||||
}
|
||||
160
gamedata/shaders/r1/common.hlsli
Normal file
160
gamedata/shaders/r1/common.hlsli
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
#ifndef COMMON_H
|
||||
#define COMMON_H
|
||||
|
||||
#include "shared\common.hlsli"
|
||||
|
||||
uniform float4 L_dynamic_props; // per object, xyz=sun,w=hemi
|
||||
uniform float4 L_dynamic_color; // dynamic light color (rgb1) - spot/point
|
||||
uniform float4 L_dynamic_pos; // dynamic light pos+1/range(w) - spot/point
|
||||
uniform float4x4 L_dynamic_xform;
|
||||
|
||||
uniform float4x4 m_plmap_xform;
|
||||
uniform float4 m_plmap_clamp[2]; // 0.w = factor
|
||||
|
||||
float calc_fogging(float4 w_pos)
|
||||
{
|
||||
return saturate(dot(w_pos, fog_plane));
|
||||
}
|
||||
float2 calc_detail(float3 w_pos)
|
||||
{
|
||||
float dtl = distance(w_pos, eye_position) * dt_params.w;
|
||||
dtl = min(dtl * dtl, 1.0f);
|
||||
float dt_mul = 1.0f - dtl; // dt* [1 .. 0 ]
|
||||
float dt_add = 0.5f * dtl; // dt+ [0 .. 0.5]
|
||||
return float2(dt_mul, dt_add);
|
||||
}
|
||||
float3 calc_reflection(float3 pos_w, float3 norm_w)
|
||||
{
|
||||
return reflect(normalize(pos_w - eye_position), norm_w);
|
||||
}
|
||||
float4 calc_spot(out float4 tc_lmap, out float2 tc_att, float4 w_pos, float3 w_norm)
|
||||
{
|
||||
float4 s_pos = mul(L_dynamic_xform, w_pos);
|
||||
tc_lmap = s_pos.xyww; // projected in ps/ttf
|
||||
tc_att = s_pos.z; // z=distance * (1/range)
|
||||
float3 L_dir_n = normalize(w_pos - L_dynamic_pos.xyz);
|
||||
float L_scale = dot(w_norm, -L_dir_n);
|
||||
return L_dynamic_color * L_scale * saturate(calc_fogging(w_pos));
|
||||
}
|
||||
float4 calc_point(out float2 tc_att0, out float2 tc_att1, float4 w_pos, float3 w_norm)
|
||||
{
|
||||
float3 L_dir_n = normalize(w_pos - L_dynamic_pos.xyz);
|
||||
float L_scale = dot(w_norm, -L_dir_n);
|
||||
float3 L_tc = (w_pos - L_dynamic_pos.xyz) * L_dynamic_pos.w + .5f; // tc coords
|
||||
tc_att0 = L_tc.xz;
|
||||
tc_att1 = L_tc.xy;
|
||||
return L_dynamic_color * L_scale * saturate(calc_fogging(w_pos));
|
||||
}
|
||||
float3 calc_sun(float3 norm_w)
|
||||
{
|
||||
return L_sun_color * max(dot((norm_w), -L_sun_dir_w), 0);
|
||||
}
|
||||
float3 calc_model_hemi(float3 norm_w)
|
||||
{
|
||||
return (norm_w.y * 0.5 + 0.5) * L_dynamic_props.w * L_hemi_color;
|
||||
}
|
||||
float3 calc_model_lq_lighting(float3 norm_w)
|
||||
{
|
||||
return calc_model_hemi(norm_w) + L_ambient + L_dynamic_props.xyz * calc_sun(norm_w);
|
||||
}
|
||||
float3 _calc_model_hemi(float3 norm_w)
|
||||
{
|
||||
return max(0, norm_w.y) * .2 * L_hemi_color;
|
||||
}
|
||||
float3 _calc_model_lq_lighting(float3 norm_w)
|
||||
{
|
||||
return calc_model_hemi(norm_w) + L_ambient + .5 * calc_sun(norm_w);
|
||||
}
|
||||
float4 calc_model_lmap(float3 pos_w)
|
||||
{
|
||||
float3 pos_wc = clamp(pos_w, m_plmap_clamp[0], m_plmap_clamp[1]); // clamp to BBox
|
||||
float4 pos_w4c = float4(pos_wc, 1);
|
||||
float4 plmap = mul(m_plmap_xform, pos_w4c); // calc plmap tc
|
||||
return plmap.xyww;
|
||||
}
|
||||
|
||||
struct v_lmap
|
||||
{
|
||||
float4 P : POSITION; // (float,float,float,1)
|
||||
float4 N : NORMAL; // (nx,ny,nz,hemi occlusion)
|
||||
float4 T : TANGENT;
|
||||
float4 B : BINORMAL;
|
||||
float2 uv0 : TEXCOORD0; // (base)
|
||||
float2 uv1 : TEXCOORD1; // (lmap/compressed)
|
||||
};
|
||||
struct v_vert
|
||||
{
|
||||
float4 P : POSITION; // (float,float,float,1)
|
||||
float4 N : NORMAL; // (nx,ny,nz,hemi occlusion)
|
||||
float4 T : TANGENT;
|
||||
float4 B : BINORMAL;
|
||||
float4 color : COLOR0; // (r,g,b,dir-occlusion)
|
||||
float2 uv : TEXCOORD0; // (u0,v0)
|
||||
};
|
||||
struct v_model
|
||||
{
|
||||
float4 pos : POSITION; // (float,float,float,1)
|
||||
float3 norm : NORMAL; // (nx,ny,nz)
|
||||
float3 T : TANGENT; // (nx,ny,nz)
|
||||
float3 B : BINORMAL; // (nx,ny,nz)
|
||||
float2 tc : TEXCOORD0; // (u,v)
|
||||
#ifdef SKIN_COLOR
|
||||
float3 rgb_tint;
|
||||
#endif
|
||||
};
|
||||
struct v_detail
|
||||
{
|
||||
float4 pos : POSITION; // (float,float,float,1)
|
||||
int4 misc : TEXCOORD0; // (u(Q),v(Q),frac,matrix-id)
|
||||
};
|
||||
struct vf_spot
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float4 tc1 : TEXCOORD1; // lmap, projected
|
||||
float2 tc2 : TEXCOORD2; // att + clipper
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
struct vf_point
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // att1 + clipper
|
||||
float2 tc2 : TEXCOORD2; // att2 + clipper
|
||||
float4 color : COLOR0;
|
||||
};
|
||||
|
||||
uniform sampler2D s_base;
|
||||
uniform samplerCUBE s_env;
|
||||
uniform sampler2D s_lmap;
|
||||
uniform sampler2D s_hemi;
|
||||
uniform sampler2D s_att;
|
||||
uniform sampler2D s_detail;
|
||||
|
||||
#define def_distort float(0.05f) // we get -0.5 .. 0.5 range, this is -512 .. 512 for 1024, so scale it
|
||||
|
||||
float3 v_hemi(float3 n)
|
||||
{
|
||||
return L_hemi_color /* *(.5f + .5f*n.y) */;
|
||||
}
|
||||
float3 v_hemi_wrap(float3 n, float w)
|
||||
{
|
||||
return L_hemi_color /* *(w + (1-w)*n.y) */;
|
||||
}
|
||||
float3 v_sun(float3 n)
|
||||
{
|
||||
return L_sun_color * max(0, dot(n, -L_sun_dir_w));
|
||||
}
|
||||
float3 v_sun_wrap(float3 n, float w)
|
||||
{
|
||||
return L_sun_color * (w + (1 - w) * dot(n, -L_sun_dir_w));
|
||||
}
|
||||
float3 p_hemi(float2 tc)
|
||||
{
|
||||
// float3 t_lmh = tex2D (s_hemi, tc);
|
||||
// return dot (t_lmh,1.h/3.h);
|
||||
float4 t_lmh = tex2D(s_hemi, tc);
|
||||
return t_lmh.a;
|
||||
}
|
||||
|
||||
#endif // COMMON_H
|
||||
19
gamedata/shaders/r1/detail.ps.hlsl
Normal file
19
gamedata/shaders/r1/detail.ps.hlsl
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float3 c0 : COLOR0;
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float3 final = t_base * I.c0 * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
|
||||
// out
|
||||
return float4(final, t_base.a);
|
||||
}
|
||||
68
gamedata/shaders/r1/detail_still.vs.hlsl
Normal file
68
gamedata/shaders/r1/detail_still.vs.hlsl
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 C : COLOR0;
|
||||
float2 tc : TEXCOORD0;
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
uniform float4 consts; // {1/quant,1/quant,diffusescale,ambient}
|
||||
|
||||
uniform float2x4 array[50] : register(c10);
|
||||
|
||||
float3x3 setMatrix (float3 hpb)
|
||||
{
|
||||
|
||||
float _ch, _cp, _cb, _sh, _sp, _sb, _cc, _cs, _sc, _ss;
|
||||
|
||||
sincos(hpb.x, _sh, _ch);
|
||||
sincos(hpb.y, _sp, _cp);
|
||||
sincos(hpb.z, _sb, _cb);
|
||||
|
||||
_cc = _ch*_cb; _cs = _ch*_sb; _sc = _sh*_cb; _ss = _sh*_sb;
|
||||
|
||||
return float3x3(_cc-_sp*_ss, _sp*_sc+_cs, -_cp*_sh,
|
||||
-_cp*_sb, _cp*_cb, _sp,
|
||||
_sp*_cs+_sc, _ss-_sp*_cc, _cp*_ch);
|
||||
};
|
||||
|
||||
vf main(v_detail v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
// index
|
||||
int i = v.misc.w;
|
||||
float2x4 mm = array[i];
|
||||
|
||||
float3x3 mmhpb = setMatrix(mm[0].xyz);
|
||||
float3 posi = float3(mm[1].xyz);
|
||||
|
||||
float scale = mm[0].w;
|
||||
|
||||
float hemi = abs(mm[1].w);
|
||||
float sun = sign(mm[1].w)*0.25f+0.25f;
|
||||
|
||||
float4 m0 = float4(mmhpb[0]*scale, posi.x);
|
||||
float4 m1 = float4(mmhpb[1]*scale, posi.y);
|
||||
float4 m2 = float4(mmhpb[2]*scale, posi.z);
|
||||
float4 c0 = float4(L_ambient.rgb+L_hemi_color.rgb*hemi+L_sun_color.rgb*sun, 1.0f);
|
||||
|
||||
// Transform to world coords
|
||||
float4 pos;
|
||||
pos.x = dot(m0, v.pos);
|
||||
pos.y = dot(m1, v.pos);
|
||||
pos.z = dot(m2, v.pos);
|
||||
pos.w = 1;
|
||||
|
||||
// Calc fog
|
||||
o.fog = calc_fogging(pos);
|
||||
|
||||
// Final out
|
||||
o.hpos = mul(m_WVP, pos);
|
||||
o.C = c0;
|
||||
o.tc.xy = (v.misc * consts).xy;
|
||||
|
||||
return o;
|
||||
}
|
||||
82
gamedata/shaders/r1/detail_wave.vs.hlsl
Normal file
82
gamedata/shaders/r1/detail_wave.vs.hlsl
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 C : COLOR0;
|
||||
float2 tc : TEXCOORD0;
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
uniform float4 consts; // {1/quant,1/quant,diffusescale,ambient}
|
||||
uniform float4 wave; // cx,cy,cz,tm
|
||||
uniform float4 dir2D;
|
||||
|
||||
uniform float2x4 array[50] : register(c10);
|
||||
|
||||
float3x3 setMatrix (float3 hpb)
|
||||
{
|
||||
|
||||
float _ch, _cp, _cb, _sh, _sp, _sb, _cc, _cs, _sc, _ss;
|
||||
|
||||
sincos(hpb.x, _sh, _ch);
|
||||
sincos(hpb.y, _sp, _cp);
|
||||
sincos(hpb.z, _sb, _cb);
|
||||
|
||||
_cc = _ch*_cb; _cs = _ch*_sb; _sc = _sh*_cb; _ss = _sh*_sb;
|
||||
|
||||
return float3x3(_cc-_sp*_ss, _sp*_sc+_cs, -_cp*_sh,
|
||||
-_cp*_sb, _cp*_cb, _sp,
|
||||
_sp*_cs+_sc, _ss-_sp*_cc, _cp*_ch);
|
||||
};
|
||||
|
||||
vf main(v_detail v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
// index
|
||||
int i = v.misc.w;
|
||||
float2x4 mm = array[i];
|
||||
|
||||
float3x3 mmhpb = setMatrix(mm[0].xyz);
|
||||
float3 posi = float3(mm[1].xyz);
|
||||
|
||||
float scale = mm[0].w;
|
||||
|
||||
float hemi = abs(mm[1].w);
|
||||
float sun = sign(mm[1].w)*0.25f+0.25f;
|
||||
|
||||
float4 m0 = float4(mmhpb[0]*scale, posi.x);
|
||||
float4 m1 = float4(mmhpb[1]*scale, posi.y);
|
||||
float4 m2 = float4(mmhpb[2]*scale, posi.z);
|
||||
float4 c0 = float4(L_ambient.rgb+L_hemi_color.rgb*hemi+L_sun_color.rgb*sun, 1.0f);
|
||||
|
||||
// Transform to world coords
|
||||
float4 pos;
|
||||
pos.x = dot(m0, v.pos);
|
||||
pos.y = dot(m1, v.pos);
|
||||
pos.z = dot(m2, v.pos);
|
||||
pos.w = 1;
|
||||
|
||||
//
|
||||
float base = m1.w;
|
||||
float dp = calc_cyclic(dot(pos, wave));
|
||||
float H = v.pos.y * length(m1.xyz);
|
||||
float fractional = v.misc.z * consts.x; // fractional
|
||||
float inten = H * dp;
|
||||
float2 result = calc_xz_wave(dir2D.xz * inten, fractional);
|
||||
pos = float4(pos.x + result.x, pos.y, pos.z + result.y, 1);
|
||||
o.hpos = mul(m_WVP, pos);
|
||||
|
||||
// Calc fog
|
||||
o.fog = calc_fogging(pos);
|
||||
|
||||
// Fake lighting
|
||||
float dpc = max(0.f, dp);
|
||||
o.C = c0 * (consts.w + consts.z * dpc * fractional);
|
||||
|
||||
// final xform, color, tc
|
||||
o.tc.xy = (v.misc * consts).xy;
|
||||
|
||||
return o;
|
||||
}
|
||||
23
gamedata/shaders/r1/details_lod.lua
Normal file
23
gamedata/shaders/r1/details_lod.lua
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
function l_special(shader, t_base, t_second, t_detail)
|
||||
shader:begin("lod", "lod")
|
||||
:blend(false, blend.one, blend.zero)
|
||||
:aref(true, 200)
|
||||
:zb(true, true)
|
||||
:fog(true)
|
||||
shader:sampler("s_base0"):texture(t_base)
|
||||
shader:sampler("s_base1"):texture(t_base)
|
||||
shader:sampler("s_hemi0"):texture(t_base .. "_nm")
|
||||
shader:sampler("s_hemi1"):texture(t_base .. "_nm")
|
||||
end
|
||||
|
||||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("lod", "lod")
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
:aref(true, 8)
|
||||
:zb(true, false)
|
||||
:fog(true)
|
||||
shader:sampler("s_base0"):texture(t_base)
|
||||
shader:sampler("s_base1"):texture(t_base)
|
||||
shader:sampler("s_hemi0"):texture(t_base .. "_nm")
|
||||
shader:sampler("s_hemi1"):texture(t_base .. "_nm")
|
||||
end
|
||||
19
gamedata/shaders/r1/editor.vs.hlsl
Normal file
19
gamedata/shaders/r1/editor.vs.hlsl
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 P : POSITION;
|
||||
float4 C : COLOR0;
|
||||
};
|
||||
|
||||
uniform float4 tfactor;
|
||||
|
||||
vf main(vf i)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.P = mul(m_WVP, i.P); // xform, input in world coords
|
||||
o.C = tfactor * i.C;
|
||||
|
||||
return o;
|
||||
}
|
||||
9
gamedata/shaders/r1/effects_lightplanes.lua
Normal file
9
gamedata/shaders/r1/effects_lightplanes.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("base_lplanes", "base_lplanes")
|
||||
:fog(false)
|
||||
:zb(true, false)
|
||||
:blend(true, blend.srcalpha, blend.one)
|
||||
:aref(true, 0)
|
||||
:sorting(2, false)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
end
|
||||
19
gamedata/shaders/r1/effects_wallmarkblend.lua
Normal file
19
gamedata/shaders/r1/effects_wallmarkblend.lua
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("wmark", "wmark")
|
||||
:sorting(2, false)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
:aref(true, 0)
|
||||
:zb(true, false)
|
||||
:fog(true)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
end
|
||||
|
||||
function l_spot(shader, t_base, t_second, t_detail)
|
||||
r1_lspot(shader, t_base, "wmark_spot")
|
||||
shader:sorting(2, false)
|
||||
end
|
||||
|
||||
function l_point(shader, t_base, t_second, t_detail)
|
||||
r1_lpoint(shader, t_base, "wmark_point")
|
||||
shader:sorting(2, false)
|
||||
end
|
||||
18
gamedata/shaders/r1/effects_wallmarkmult.lua
Normal file
18
gamedata/shaders/r1/effects_wallmarkmult.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("wmark", "wmarkmult")
|
||||
:sorting(2, false)
|
||||
:blend(true, blend.destcolor, blend.srccolor)
|
||||
:aref(false, 0)
|
||||
:zb(true, true)
|
||||
:fog(true)
|
||||
:wmark(true)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
end
|
||||
|
||||
function l_spot(shader, t_base, t_second, t_detail)
|
||||
r1_lspot(shader, t_base, "wmark_spot")
|
||||
end
|
||||
|
||||
function l_point(shader, t_base, t_second, t_detail)
|
||||
r1_lpoint(shader, t_base, "wmark_point")
|
||||
end
|
||||
16
gamedata/shaders/r1/effects_wallmarkset.lua
Normal file
16
gamedata/shaders/r1/effects_wallmarkset.lua
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("wmark", "wmark")
|
||||
:sorting(1, false)
|
||||
:aref(false, 0)
|
||||
:zb(true, true)
|
||||
:fog(true)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
end
|
||||
|
||||
function l_spot(shader, t_base, t_second, t_detail)
|
||||
r1_lspot(shader, t_base, "wmark_spot")
|
||||
end
|
||||
|
||||
function l_point(shader, t_base, t_second, t_detail)
|
||||
r1_lpoint(shader, t_base, "wmark_point")
|
||||
end
|
||||
27
gamedata/shaders/r1/effects_water.lua
Normal file
27
gamedata/shaders/r1/effects_water.lua
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
local tex_base = "water\\water_water"
|
||||
local tex_nmap = "water\\water_normal"
|
||||
local tex_dist = "water\\water_dudv"
|
||||
|
||||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("water", "water")
|
||||
:sorting(2, false)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
:zb(true, false)
|
||||
:distort(true)
|
||||
:fog(false)
|
||||
shader:sampler("s_base"):texture(tex_base)
|
||||
shader:sampler("s_nmap"):texture(tex_nmap)
|
||||
shader:sampler("s_env0"):texture("$user$sky0"):clamp()
|
||||
shader:sampler("s_env1"):texture("$user$sky1"):clamp()
|
||||
end
|
||||
|
||||
--function l_special(shader, t_base, t_second, t_detail)
|
||||
-- shader:begin ("waterd","waterd")
|
||||
-- : sorting (2, true)
|
||||
-- : blend (true,blend.srcalpha,blend.invsrcalpha)
|
||||
-- : zb (true,false)
|
||||
-- : fog (false)
|
||||
-- : distort (true)
|
||||
-- shader:sampler ("s_base") :texture (tex_base)
|
||||
-- shader:sampler ("s_distort") :texture (tex_dist)
|
||||
--end
|
||||
28
gamedata/shaders/r1/effects_waterryaska.lua
Normal file
28
gamedata/shaders/r1/effects_waterryaska.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
local tex_base = "water\\water_ryaska1"
|
||||
local tex_env = "sky\\sky_5_cube"
|
||||
local tex_dist = "water\\water_dudv"
|
||||
local tex_dist2 = "water\\water_dudv"
|
||||
|
||||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("water", "water")
|
||||
:sorting(2, true)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
:aref(true, 0)
|
||||
:zb(true, false)
|
||||
:distort(true)
|
||||
:fog(true)
|
||||
shader:sampler("s_base"):texture(tex_base)
|
||||
shader:sampler("s_env"):texture(tex_env):clamp()
|
||||
end
|
||||
|
||||
function l_special(shader, t_base, t_second, t_detail)
|
||||
shader:begin("waterd", "waterd")
|
||||
:sorting(2, true)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
:zb(true, false)
|
||||
:fog(false)
|
||||
:distort(true)
|
||||
shader:sampler("s_base"):texture(tex_base)
|
||||
shader:sampler("s_distort0"):texture(tex_dist)
|
||||
shader:sampler("s_distort1"):texture(tex_dist2)
|
||||
end
|
||||
28
gamedata/shaders/r1/effects_waterstuden.lua
Normal file
28
gamedata/shaders/r1/effects_waterstuden.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
local tex_base = "water\\water_studen"
|
||||
local tex_env = "sky\\sky_5_cube"
|
||||
local tex_dist = "water\\water_dudv"
|
||||
local tex_dist2 = "water\\water_dudv"
|
||||
|
||||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("water", "water")
|
||||
:sorting(2, true)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
:aref(true, 0)
|
||||
:zb(true, false)
|
||||
:distort(true)
|
||||
:fog(true)
|
||||
shader:sampler("s_base"):texture(tex_base)
|
||||
shader:sampler("s_env"):texture(tex_env):clamp()
|
||||
end
|
||||
|
||||
function l_special(shader, t_base, t_second, t_detail)
|
||||
shader:begin("waterd", "waterd")
|
||||
:sorting(2, true)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
:zb(true, false)
|
||||
:fog(false)
|
||||
:distort(true)
|
||||
shader:sampler("s_base"):texture(tex_base)
|
||||
shader:sampler("s_distort0"):texture(tex_dist)
|
||||
shader:sampler("s_distort1"):texture(tex_dist2)
|
||||
end
|
||||
18
gamedata/shaders/r1/font2.ps.hlsl
Normal file
18
gamedata/shaders/r1/font2.ps.hlsl
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 r = tex2D(s_base, I.tc0);
|
||||
// r.x = 1 - r.x;
|
||||
// r.y = 1 - r.y;
|
||||
// r.z = 1 - r.z;
|
||||
r.w = 1 - r.w;
|
||||
return r;
|
||||
// return /*(float4(1,1,1,1) - */ tex2D (s_base,I.tc0);
|
||||
}
|
||||
1309
gamedata/shaders/r1/fxaa.hlsli
Normal file
1309
gamedata/shaders/r1/fxaa.hlsli
Normal file
File diff suppressed because it is too large
Load diff
17
gamedata/shaders/r1/fxaa_luma.ps.hlsl
Normal file
17
gamedata/shaders/r1/fxaa_luma.ps.hlsl
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
#define LUMINANCE_VECTOR float3(0.3f, 0.38f, 0.22f)
|
||||
|
||||
uniform sampler2D s_image;
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float4 HPos : POSITION;
|
||||
};
|
||||
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float3 image = tex2D(s_image, I.tc0);
|
||||
return float4(image, dot(image, LUMINANCE_VECTOR));
|
||||
}
|
||||
34
gamedata/shaders/r1/fxaa_main.ps.hlsl
Normal file
34
gamedata/shaders/r1/fxaa_main.ps.hlsl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "common.hlsli"
|
||||
#include "fxaa.hlsli"
|
||||
|
||||
uniform float4 screen_res;
|
||||
uniform sampler2D s_image;
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float4 HPos : POSITION;
|
||||
};
|
||||
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float2 rcpFrame = screen_res.zw;
|
||||
|
||||
return FxaaPixelShader(I.tc0,
|
||||
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f), // FxaaFloat4 fxaaConsolePosPos,
|
||||
s_image, // FxaaTex tex,
|
||||
s_image, // FxaaTex fxaaConsole360TexExpBiasNegOne,
|
||||
s_image, // FxaaTex fxaaConsole360TexExpBiasNegTwo,
|
||||
rcpFrame, // FxaaFloat2 fxaaQualityRcpFrame,
|
||||
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f), // FxaaFloat4 fxaaConsoleRcpFrameOpt,
|
||||
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f), // FxaaFloat4 fxaaConsoleRcpFrameOpt2,
|
||||
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f), // FxaaFloat4 fxaaConsole360RcpFrameOpt2,
|
||||
0.35f, // FxaaFloat fxaaQualitySubpix,
|
||||
0.125f, // FxaaFloat fxaaQualityEdgeThreshold,
|
||||
0.0f, // 0.0625f, // FxaaFloat fxaaQualityEdgeThresholdMin,
|
||||
0.0f, // FxaaFloat fxaaConsoleEdgeSharpness,
|
||||
0.0f, // FxaaFloat fxaaConsoleEdgeThreshold,
|
||||
0.0f, // FxaaFloat fxaaConsoleEdgeThresholdMin,
|
||||
FxaaFloat4(0.0f, 0.0f, 0.0f, 0.0f) // FxaaFloat fxaaConsole360ConstDir,
|
||||
);
|
||||
}
|
||||
25
gamedata/shaders/r1/fxaa_main.vs.hlsl
Normal file
25
gamedata/shaders/r1/fxaa_main.vs.hlsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
uniform float4 screen_res; // Screen resolution (x-Width,y-Height, zw - 1/resolution)
|
||||
|
||||
struct v
|
||||
{
|
||||
float3 P : POSITION;
|
||||
float2 tc0 : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float4 HPos : POSITION;
|
||||
};
|
||||
|
||||
// Vertex
|
||||
v2p main(v I)
|
||||
{
|
||||
v2p O;
|
||||
O.HPos = float4(I.P.x * screen_res.z * 2 - 1, (I.P.y * screen_res.w * 2 - 1) * -1, 0, 1);
|
||||
O.tc0 = I.tc0;
|
||||
|
||||
return O;
|
||||
}
|
||||
13
gamedata/shaders/r1/hud3d.ps.hlsl
Normal file
13
gamedata/shaders/r1/hud3d.ps.hlsl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct ui_vert_out
|
||||
{
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float4 P : POSITION;
|
||||
};
|
||||
|
||||
float4 main(ui_vert_out I) : COLOR
|
||||
{
|
||||
float4 r = tex2D(s_base, I.tc0);
|
||||
return r;
|
||||
}
|
||||
25
gamedata/shaders/r1/hud3d.vs.hlsl
Normal file
25
gamedata/shaders/r1/hud3d.vs.hlsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct ui_vert_in
|
||||
{
|
||||
float4 P : POSITION;
|
||||
float4 color : COLOR0;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct ui_vert_out
|
||||
{
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float4 P : POSITION;
|
||||
};
|
||||
|
||||
ui_vert_out main(ui_vert_in v)
|
||||
{
|
||||
ui_vert_out O;
|
||||
|
||||
O.tc0 = v.uv;
|
||||
O.P = v.P;
|
||||
O.P.w = 1;
|
||||
O.P = mul(m_WVP, O.P);
|
||||
return O;
|
||||
}
|
||||
6
gamedata/shaders/r1/hud_crosshair.lua
Normal file
6
gamedata/shaders/r1/hud_crosshair.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("null", "simple_color")
|
||||
:fog(false)
|
||||
:zb(false, false)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
end
|
||||
7
gamedata/shaders/r1/hud_font.lua
Normal file
7
gamedata/shaders/r1/hud_font.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("null", "hud_font")
|
||||
:fog(false)
|
||||
:zb(false, false)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
end
|
||||
15
gamedata/shaders/r1/hud_font.ps.hlsl
Normal file
15
gamedata/shaders/r1/hud_font.ps.hlsl
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float4 c0 : COLOR0;
|
||||
};
|
||||
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 r = tex2D(s_base, I.tc0);
|
||||
r.rgb = I.c0.rgb;
|
||||
r.a *= I.c0.a;
|
||||
return r;
|
||||
}
|
||||
7
gamedata/shaders/r1/hud_font2.lua
Normal file
7
gamedata/shaders/r1/hud_font2.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("null", "font2")
|
||||
:fog(false)
|
||||
:zb(false, false)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
end
|
||||
7
gamedata/shaders/r1/hud_movie.lua
Normal file
7
gamedata/shaders/r1/hud_movie.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("null", "yuv2rgb")
|
||||
:fog(false)
|
||||
:zb(false, false)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
end
|
||||
7
gamedata/shaders/r1/hud_p3d.lua
Normal file
7
gamedata/shaders/r1/hud_p3d.lua
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
function normal(shader, t_base, t_second, t_detail)
|
||||
shader:begin("hud3d", "hud3d")
|
||||
:fog(false)
|
||||
:zb(true, true)
|
||||
:blend(true, blend.srcalpha, blend.invsrcalpha)
|
||||
shader:sampler("s_base"):texture(t_base)
|
||||
end
|
||||
29
gamedata/shaders/r1/impl.ps.hlsl
Normal file
29
gamedata/shaders/r1/impl.ps.hlsl
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // lmap
|
||||
float3 c0 : COLOR0; // hemi
|
||||
float3 c1 : COLOR1; // sun
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_lmap = tex2D(s_lmap, I.tc1);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map
|
||||
float3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
|
||||
float3 l_sun = I.c1 * t_lmap.a; // sun color
|
||||
float3 light = L_ambient + l_base + l_sun + l_hemi;
|
||||
|
||||
// final-color
|
||||
float3 final = light * t_base * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
// out
|
||||
return float4(final.rgb, 1.0f);
|
||||
}
|
||||
26
gamedata/shaders/r1/impl.vs.hlsl
Normal file
26
gamedata/shaders/r1/impl.vs.hlsl
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
float3 c0 : COLOR0; // c0=hemi, c0.a = dt*
|
||||
float3 c1 : COLOR1; // c1=sun, c1.a = dt+
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf main(v_lmap v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float3 N = unpack_normal(v.N);
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
o.tc1 = o.tc0; // copy tc
|
||||
o.c0 = v_hemi(N); // hemi
|
||||
o.c1 = v_sun(N); // sun
|
||||
o.fog = calc_fogging(v.P); // fog, input in world coords
|
||||
|
||||
return o;
|
||||
}
|
||||
34
gamedata/shaders/r1/impl_dt.ps.hlsl
Normal file
34
gamedata/shaders/r1/impl_dt.ps.hlsl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // lmap
|
||||
float2 tc2 : TEXCOORD2; // detail
|
||||
float4 c0 : COLOR0; // hemi, c0.a *
|
||||
float4 c1 : COLOR1; // sun, c1.a +
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_lmap = tex2D(s_lmap, I.tc1);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map
|
||||
float3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
|
||||
float3 l_sun = I.c1 * t_lmap.a; // sun color
|
||||
float3 light = L_ambient + l_base + l_sun + l_hemi;
|
||||
|
||||
// calc D-texture
|
||||
float3 detail = tex2D(s_detail, I.tc2);
|
||||
|
||||
// final-color
|
||||
float3 final = (light * t_base.rgb * 2.0f) * detail * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
// out
|
||||
return float4(final.rgb, 1.0f);
|
||||
// return float4 (light*detail*2,1);
|
||||
}
|
||||
29
gamedata/shaders/r1/impl_dt.vs.hlsl
Normal file
29
gamedata/shaders/r1/impl_dt.vs.hlsl
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
float2 tc2 : TEXCOORD2;
|
||||
float4 c0 : COLOR0; // c0=hemi+v-lights, c0.a = dt*
|
||||
float4 c1 : COLOR1; // c1=sun, c1.a = dt+
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf main(v_lmap v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float2 dt = calc_detail(v.P);
|
||||
float3 N = unpack_normal(v.N);
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
o.tc1 = o.tc0; // copy tc
|
||||
o.tc2 = o.tc0 * dt_params; // dt tc
|
||||
o.c0 = float4(v_hemi(N), dt.x); // c0=v-lights, c0.a = dt*
|
||||
o.c1 = float4(v_sun(N), dt.y); // c1=sun, c1.a = dt+
|
||||
o.fog = calc_fogging(v.P); // fog, input in world coords
|
||||
|
||||
return o;
|
||||
}
|
||||
48
gamedata/shaders/r1/impl_dt_hq.ps.hlsl
Normal file
48
gamedata/shaders/r1/impl_dt_hq.ps.hlsl
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // lmap
|
||||
float2 tc2 : TEXCOORD2; // detail
|
||||
float4 c0 : COLOR0; // hemi, c0.a *
|
||||
float4 c1 : COLOR1; // sun, c1.a +
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
uniform sampler2D s_dt_r;
|
||||
uniform sampler2D s_dt_g;
|
||||
uniform sampler2D s_dt_b;
|
||||
uniform sampler2D s_dt_a;
|
||||
|
||||
uniform sampler2D s_mask;
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_mask = tex2D(s_mask, I.tc0);
|
||||
|
||||
t_mask = t_mask / dot(t_mask, 1.0);
|
||||
|
||||
float4 t_lmap = tex2D(s_lmap, I.tc1);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map
|
||||
float3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
|
||||
float3 l_sun = I.c1 * t_lmap.a; // sun color
|
||||
float3 light = L_ambient + l_base + l_sun + l_hemi;
|
||||
|
||||
// calc D-texture
|
||||
float3 t_dt_r = tex2D(s_dt_r, I.tc2) * t_mask.r;
|
||||
float3 t_dt_g = tex2D(s_dt_g, I.tc2) * t_mask.g;
|
||||
float3 t_dt_b = tex2D(s_dt_b, I.tc2) * t_mask.b;
|
||||
float3 t_dt_a = tex2D(s_dt_a, I.tc2) * t_mask.a;
|
||||
float3 detail = t_dt_a + t_dt_b + t_dt_g + t_dt_r;
|
||||
|
||||
// final-color
|
||||
float3 final = (light * t_base.rgb * 2.0f) * detail * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
// out
|
||||
return float4(final.rgb, 1.0f);
|
||||
}
|
||||
22
gamedata/shaders/r1/impl_l.ps.hlsl
Normal file
22
gamedata/shaders/r1/impl_l.ps.hlsl
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // lmap
|
||||
float2 tc1 : TEXCOORD1; // lmap
|
||||
float3 c0 : COLOR0; // hemi
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_lmap = tex2D(s_lmap, I.tc1);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map
|
||||
float3 l_hemi = I.c0 * t_base.a; // hemi is implicitly inside texture
|
||||
float l_sun = t_lmap.a; // sun color
|
||||
float3 light = L_ambient + l_base + l_hemi;
|
||||
return float4(light, l_sun);
|
||||
}
|
||||
21
gamedata/shaders/r1/impl_l.vs.hlsl
Normal file
21
gamedata/shaders/r1/impl_l.vs.hlsl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
float3 c0 : COLOR0;
|
||||
};
|
||||
|
||||
vf main(v_lmap v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
o.tc1 = o.tc0; // copy tc
|
||||
o.c0 = v_hemi(unpack_normal(v.N)); // just ambient
|
||||
|
||||
return o;
|
||||
}
|
||||
13
gamedata/shaders/r1/impl_point.vs.hlsl
Normal file
13
gamedata/shaders/r1/impl_point.vs.hlsl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
vf_point main(v_lmap v)
|
||||
{
|
||||
vf_point o;
|
||||
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
// o.tc0 = unpack_tc_base(v.tc0); // copy tc
|
||||
o.color = calc_point(o.tc1, o.tc2, v.P, unpack_normal(v.N)); // just hemisphere
|
||||
|
||||
return o;
|
||||
}
|
||||
13
gamedata/shaders/r1/impl_spot.vs.hlsl
Normal file
13
gamedata/shaders/r1/impl_spot.vs.hlsl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
vf_spot main(v_lmap v)
|
||||
{
|
||||
vf_spot o;
|
||||
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
// o.tc0 = unpack_tc_base(v.tc0); // copy tc
|
||||
o.color = calc_spot(o.tc1, o.tc2, v.P, unpack_normal(v.N)); // just hemisphere
|
||||
|
||||
return o;
|
||||
}
|
||||
31
gamedata/shaders/r1/lmap.ps.hlsl
Normal file
31
gamedata/shaders/r1/lmap.ps.hlsl
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // lmap
|
||||
float2 tc2 : TEXCOORD2; // lmap-hemi
|
||||
float3 c0 : COLOR0; // hemi
|
||||
float3 c1 : COLOR1; // sun
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_lmap = tex2D(s_lmap, I.tc1);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map
|
||||
float3 l_hemi = I.c0 * p_hemi(I.tc2); // hemi
|
||||
float3 l_sun = I.c1 * t_lmap.a; // sun color
|
||||
float3 light = L_ambient + l_base + l_sun + l_hemi;
|
||||
|
||||
// final-color
|
||||
float3 final = light * t_base * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
|
||||
// out
|
||||
return float4(final, t_base.a);
|
||||
}
|
||||
29
gamedata/shaders/r1/lmap.vs.hlsl
Normal file
29
gamedata/shaders/r1/lmap.vs.hlsl
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
float2 tch : TEXCOORD2;
|
||||
float3 c0 : COLOR0; // c0=hemi+v-lights, c0.a = dt*
|
||||
float3 c1 : COLOR1; // c1=sun, c1.a = dt+
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf main(v_lmap v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float3 N = unpack_normal(v.N);
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
// o.tc0 = unpack_tc_base (v.tc0); // copy tc
|
||||
o.tc1 = unpack_tc_lmap(v.uv1); // copy tc
|
||||
o.tch = o.tc1;
|
||||
o.c0 = v_hemi(N); // just hemisphere
|
||||
o.c1 = v_sun(N); // sun
|
||||
o.fog = calc_fogging(v.P); // fog, input in world coords
|
||||
|
||||
return o;
|
||||
}
|
||||
36
gamedata/shaders/r1/lmap_dt.ps.hlsl
Normal file
36
gamedata/shaders/r1/lmap_dt.ps.hlsl
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // lmap
|
||||
float2 tc2 : TEXCOORD2; // hemi
|
||||
float2 tc3 : TEXCOORD3; // detail
|
||||
float4 c0 : COLOR0; // c0.a *
|
||||
float4 c1 : COLOR1; // c1.a +
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_lmap = tex2D(s_lmap, I.tc1);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map
|
||||
float3 l_hemi = I.c0 * p_hemi(I.tc2); // hemi
|
||||
float3 l_sun = I.c1 * t_lmap.a; // sun color
|
||||
float3 light = L_ambient + l_base + l_sun + l_hemi;
|
||||
|
||||
// calc D-texture
|
||||
float4 t_dt = tex2D(s_detail, I.tc3);
|
||||
float3 detail = t_dt * I.c0.a + I.c1.a;
|
||||
|
||||
// final-color
|
||||
float3 final = (light * t_base * 2.0f) * detail * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
|
||||
// out
|
||||
return float4(final, t_base.a);
|
||||
}
|
||||
33
gamedata/shaders/r1/lmap_dt.vs.hlsl
Normal file
33
gamedata/shaders/r1/lmap_dt.vs.hlsl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
float2 tch : TEXCOORD2;
|
||||
float2 tc2 : TEXCOORD3;
|
||||
float4 c0 : COLOR0; // c0=hemi+v-lights, c0.a = dt*
|
||||
float4 c1 : COLOR1; // c1=sun, c1.a = dt+
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf main(v_lmap v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float2 dt = calc_detail(v.P);
|
||||
float3 N = unpack_normal(v.N);
|
||||
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
// o.tc0 = unpack_tc_base (v.tc0); // copy tc
|
||||
o.tc1 = unpack_tc_lmap(v.uv1); // copy tc
|
||||
o.tch = o.tc1;
|
||||
o.tc2 = o.tc0 * dt_params; // dt tc
|
||||
o.c0 = float4(v_hemi(N), dt.x); // c0=hemi+v-lights, c0.a = dt*
|
||||
o.c1 = float4(v_sun(N), dt.y); // c1=sun, c1.a = dt+
|
||||
o.fog = calc_fogging(v.P); // fog, input in world coords
|
||||
|
||||
return o;
|
||||
}
|
||||
24
gamedata/shaders/r1/lmap_l.ps.hlsl
Normal file
24
gamedata/shaders/r1/lmap_l.ps.hlsl
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // lmap
|
||||
float2 tc1 : TEXCOORD1; // hemi
|
||||
float3 c0 : COLOR0;
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_lmap = tex2D(s_lmap, I.tc0);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map
|
||||
float3 l_hemi = I.c0 * p_hemi(I.tc1); // hemi
|
||||
float l_sun = t_lmap.a; // sun color
|
||||
float3 light = L_ambient + l_base + l_hemi;
|
||||
light = lerp(fog_color.xyz, light, I.fog);
|
||||
|
||||
return float4(light, l_sun);
|
||||
}
|
||||
23
gamedata/shaders/r1/lmap_l.vs.hlsl
Normal file
23
gamedata/shaders/r1/lmap_l.vs.hlsl
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
float3 c0 : COLOR0;
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf main(v_lmap v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_lmap(v.uv1); // copy tc
|
||||
o.tc1 = o.tc0;
|
||||
o.c0 = v_hemi(unpack_normal(v.N)); // just hemisphere + ambient
|
||||
o.fog = calc_fogging(v.P); // fog, input in world coords
|
||||
|
||||
return o;
|
||||
}
|
||||
13
gamedata/shaders/r1/lmap_point.vs.hlsl
Normal file
13
gamedata/shaders/r1/lmap_point.vs.hlsl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
vf_point main(v_lmap v)
|
||||
{
|
||||
vf_point o;
|
||||
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
// o.tc0 = unpack_tc_base(v.tc0); // copy tc
|
||||
o.color = calc_point(o.tc1, o.tc2, v.P, unpack_normal(v.N)); // just hemisphere
|
||||
|
||||
return o;
|
||||
}
|
||||
13
gamedata/shaders/r1/lmap_spot.vs.hlsl
Normal file
13
gamedata/shaders/r1/lmap_spot.vs.hlsl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
vf_spot main(v_lmap v)
|
||||
{
|
||||
vf_spot o;
|
||||
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
// o.tc0 = unpack_tc_base(v.tc0); // copy tc
|
||||
o.color = calc_spot(o.tc1, o.tc2, v.P, unpack_normal(v.N)); // just hemisphere
|
||||
|
||||
return o;
|
||||
}
|
||||
33
gamedata/shaders/r1/lmape.ps.hlsl
Normal file
33
gamedata/shaders/r1/lmape.ps.hlsl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // lmap
|
||||
float2 tc2 : TEXCOORD2; // hemi
|
||||
float3 tc3 : TEXCOORD3; // env
|
||||
float3 c0 : COLOR0;
|
||||
float3 c1 : COLOR1;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_lmap = tex2D(s_lmap, I.tc1);
|
||||
float4 t_env = texCUBE(s_env, I.tc3);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map
|
||||
float3 l_hemi = I.c0 * p_hemi(I.tc2); // hemi
|
||||
float3 l_sun = I.c1 * t_lmap.a; // sun color
|
||||
float3 light = L_ambient + l_base + l_sun + l_hemi;
|
||||
|
||||
// final-color
|
||||
float3 base = lerp(t_env, t_base, t_base.a);
|
||||
float3 final = light * base * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
|
||||
// out
|
||||
return float4(final, t_base.a);
|
||||
}
|
||||
33
gamedata/shaders/r1/lmape.vs.hlsl
Normal file
33
gamedata/shaders/r1/lmape.vs.hlsl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
float2 tch : TEXCOORD2;
|
||||
float3 tc2 : TEXCOORD3;
|
||||
float3 c0 : COLOR0; // c0=hemi+v-lights, c0.a = dt*
|
||||
float3 c1 : COLOR1; // c1=sun, c1.a = dt+
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf main(v_lmap v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float3 pos_w = v.P;
|
||||
float3 norm_w = normalize(unpack_normal(v.N));
|
||||
|
||||
o.hpos = mul(m_VP, v.P); // xform, input in world coords
|
||||
o.tc0 = unpack_tc_base(v.uv0, v.T.w, v.B.w); // copy tc
|
||||
// o.tc0 = unpack_tc_base (v.tc0); // copy tc
|
||||
o.tc1 = unpack_tc_lmap(v.uv1); // copy tc
|
||||
o.tch = o.tc1;
|
||||
o.tc2 = calc_reflection(pos_w, norm_w);
|
||||
o.c0 = v_hemi(norm_w); // just hemisphere
|
||||
o.c1 = v_sun(norm_w); // sun
|
||||
o.fog = calc_fogging(v.P); // fog, input in world coords
|
||||
|
||||
return o;
|
||||
}
|
||||
34
gamedata/shaders/r1/lod.ps.hlsl
Normal file
34
gamedata/shaders/r1/lod.ps.hlsl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base0
|
||||
float2 tc1 : TEXCOORD1; // base1
|
||||
float2 tc2 : TEXCOORD2; // hemi0
|
||||
float2 tc3 : TEXCOORD3; // hemi1
|
||||
float4 c : COLOR0; // color
|
||||
float4 f : COLOR1; // color
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
uniform sampler2D s_base0;
|
||||
uniform sampler2D s_base1;
|
||||
uniform sampler2D s_hemi0;
|
||||
uniform sampler2D s_hemi1;
|
||||
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 base0 = tex2D(s_base0, I.tc0);
|
||||
float4 base1 = tex2D(s_base1, I.tc1);
|
||||
float4 hemi0 = tex2D(s_hemi0, I.tc2);
|
||||
float4 hemi1 = tex2D(s_hemi1, I.tc3);
|
||||
|
||||
float4 base = lerp(base0, base1, I.f.w) * I.c;
|
||||
float hemi = lerp(hemi0, hemi1, I.f.w).w;
|
||||
|
||||
float3 color = base * 2.0f * (0.5f + 0.5f * hemi);
|
||||
color = lerp(fog_color.xyz, color, I.fog);
|
||||
|
||||
return float4(color, base.a);
|
||||
}
|
||||
64
gamedata/shaders/r1/lod.vs.hlsl
Normal file
64
gamedata/shaders/r1/lod.vs.hlsl
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct vv
|
||||
{
|
||||
float3 pos0 : POSITION0;
|
||||
float3 pos1 : POSITION1;
|
||||
float3 n0 : NORMAL0;
|
||||
float3 n1 : NORMAL1;
|
||||
float2 tc0 : TEXCOORD0;
|
||||
float2 tc1 : TEXCOORD1;
|
||||
float4 rgbh0 : TEXCOORD2; // rgb.h
|
||||
float4 rgbh1 : TEXCOORD3; // rgb.h
|
||||
float4 sun_af : COLOR0; // x=sun_0, y=sun_1, z=alpha, w=factor
|
||||
};
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base0
|
||||
float2 tc1 : TEXCOORD1; // base1
|
||||
float2 tc2 : TEXCOORD2; // hemi0
|
||||
float2 tc3 : TEXCOORD3; // hemi1
|
||||
float4 c : COLOR0; // color.alpha
|
||||
float4 f : COLOR1; // factor
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
#define L_SCALE (1.55)
|
||||
#define L_SUN_HACK (.7)
|
||||
|
||||
vf main(vv v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
// lerp pos
|
||||
float factor = v.sun_af.w;
|
||||
float4 pos = float4(lerp(v.pos0, v.pos1, factor), 1);
|
||||
o.hpos = mul(m_VP, pos); // xform, input in world coords
|
||||
|
||||
// replicate TCs
|
||||
o.tc0 = v.tc0;
|
||||
o.tc1 = v.tc1;
|
||||
o.tc2 = v.tc0;
|
||||
o.tc3 = v.tc1;
|
||||
|
||||
// calc normal & lighting
|
||||
float3 normal = normalize(lerp(v.n0, v.n1, factor));
|
||||
normal.y += 1;
|
||||
normal = normalize(normal);
|
||||
float4 rgbh = lerp(v.rgbh0, v.rgbh1, factor) * L_SCALE;
|
||||
float sun = lerp(v.sun_af.x, v.sun_af.y, factor) * L_SCALE;
|
||||
float sun_c = 1 + L_SUN_HACK * dot(normal, L_sun_dir_w); // [1+-delta], normal already inverted
|
||||
|
||||
float3 L_rgb = rgbh.rgb; // precalculated RGB lighting
|
||||
float3 L_hemi = L_hemi_color * rgbh.w; // hemisphere
|
||||
float3 L_sun = L_sun_color * sun * sun_c; // sun
|
||||
float3 L_final = L_rgb + L_hemi + L_sun + L_ambient;
|
||||
|
||||
o.c = float4(L_final, v.sun_af.z);
|
||||
o.f = factor;
|
||||
o.fog = calc_fogging(pos); // fog, input in world coords
|
||||
|
||||
return o;
|
||||
}
|
||||
39
gamedata/shaders/r1/model_clockarrow_h.ps.hlsl
Normal file
39
gamedata/shaders/r1/model_clockarrow_h.ps.hlsl
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float2 coords = I.tc0;
|
||||
float2 coords_new;
|
||||
|
||||
|
||||
|
||||
// Rotate texture
|
||||
float sin_a = m_timearrow.x;
|
||||
float cos_a = m_timearrow.y;
|
||||
coords.x = coords.x-0.5;
|
||||
coords.y = coords.y-0.5;
|
||||
|
||||
coords_new.x = coords.x * cos_a + coords.y * sin_a;
|
||||
coords_new.y = -coords.x * sin_a + coords.y * cos_a;
|
||||
|
||||
coords_new.x = coords_new.x+0.5;
|
||||
coords_new.y = coords_new.y+0.5;
|
||||
|
||||
|
||||
float4 t_base = tex2D (s_base,coords_new);
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb;
|
||||
|
||||
return t_base;
|
||||
}
|
||||
39
gamedata/shaders/r1/model_clockarrow_m.ps.hlsl
Normal file
39
gamedata/shaders/r1/model_clockarrow_m.ps.hlsl
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float2 coords = I.tc0;
|
||||
float2 coords_new;
|
||||
|
||||
|
||||
|
||||
// Rotate texture
|
||||
float sin_a = m_timearrow.z;
|
||||
float cos_a = m_timearrow.a;
|
||||
coords.x = coords.x-0.5;
|
||||
coords.y = coords.y-0.5;
|
||||
|
||||
coords_new.x = coords.x * cos_a + coords.y * sin_a;
|
||||
coords_new.y = -coords.x * sin_a + coords.y * cos_a;
|
||||
|
||||
coords_new.x = coords_new.x+0.5;
|
||||
coords_new.y = coords_new.y+0.5;
|
||||
|
||||
|
||||
float4 t_base = tex2D (s_base,coords_new);
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb;
|
||||
|
||||
return t_base;
|
||||
}
|
||||
39
gamedata/shaders/r1/model_clockarrow_s.ps.hlsl
Normal file
39
gamedata/shaders/r1/model_clockarrow_s.ps.hlsl
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float2 coords = I.tc0;
|
||||
float2 coords_new;
|
||||
|
||||
|
||||
|
||||
// Rotate texture
|
||||
float sin_a = m_timearrow2.x;
|
||||
float cos_a = m_timearrow2.y;
|
||||
coords.x = coords.x-0.5;
|
||||
coords.y = coords.y-0.5;
|
||||
|
||||
coords_new.x = coords.x * cos_a + coords.y * sin_a;
|
||||
coords_new.y = -coords.x * sin_a + coords.y * cos_a;
|
||||
|
||||
coords_new.x = coords_new.x+0.5;
|
||||
coords_new.y = coords_new.y+0.5;
|
||||
|
||||
|
||||
float4 t_base = tex2D (s_base,coords_new);
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb;
|
||||
|
||||
return t_base;
|
||||
}
|
||||
39
gamedata/shaders/r1/model_compassarrow.ps.hlsl
Normal file
39
gamedata/shaders/r1/model_compassarrow.ps.hlsl
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float2 coords = I.tc0;
|
||||
float2 coords_new;
|
||||
|
||||
|
||||
|
||||
// Rotate texture
|
||||
float sin_a = m_timearrow2.z;
|
||||
float cos_a = m_timearrow2.a;
|
||||
coords.x = coords.x-0.5;
|
||||
coords.y = coords.y-0.5;
|
||||
|
||||
coords_new.x = coords.x * cos_a + coords.y * sin_a;
|
||||
coords_new.y = -coords.x * sin_a + coords.y * cos_a;
|
||||
|
||||
coords_new.x = coords_new.x+0.5;
|
||||
coords_new.y = coords_new.y+0.5;
|
||||
|
||||
|
||||
float4 t_base = tex2D (s_base,coords_new);
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb;
|
||||
|
||||
return t_base;
|
||||
}
|
||||
20
gamedata/shaders/r1/model_compscreen.ps.hlsl
Normal file
20
gamedata/shaders/r1/model_compscreen.ps.hlsl
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0: TEXCOORD0; // base
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Pixel
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
// ïîëó÷àåì êîîðäèíàòó íîðìàëüíîé òåêñòóðû
|
||||
float4 t_base = tex2D (s_base, I.tc0);
|
||||
|
||||
//ïîëó÷àåì ïèêñåëü øóìà è ìàñøòàáèðóåì åãî â ñîîòâåòñòâèè ñ òåêóùèì óðîâíåì ïðîáëåì
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb+0.1;
|
||||
|
||||
return t_base;
|
||||
}
|
||||
29
gamedata/shaders/r1/model_def_hq.ps.hlsl
Normal file
29
gamedata/shaders/r1/model_def_hq.ps.hlsl
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float4 tc1 : TEXCOORD1; // lmap
|
||||
float3 c0 : COLOR0; // sun
|
||||
float4 c1 : COLOR1; // lq-color + factor
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_lmap = tex2Dproj(s_lmap, I.tc1);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map (lmap color, ambient, hemi, etc - inside)
|
||||
float3 l_sun = I.c0 * t_lmap.a; // sun color
|
||||
float3 light = lerp(l_base + l_sun, I.c1, I.c1.w);
|
||||
|
||||
// final-color
|
||||
float3 final = light * t_base * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
|
||||
// out
|
||||
return float4(final.r, final.g, final.b, t_base.a);
|
||||
}
|
||||
41
gamedata/shaders/r1/model_def_hq.vs.hlsl
Normal file
41
gamedata/shaders/r1/model_def_hq.vs.hlsl
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
// #define SKIN_2
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float4 tc1 : TEXCOORD1; // projected lmap
|
||||
float3 c0 : COLOR0; // sun-color
|
||||
float4 c1 : COLOR1; // lq-color + factor
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float4 pos = v.pos;
|
||||
float3 pos_w = mul(m_W, pos);
|
||||
float4 pos_w4 = float4(pos_w, 1);
|
||||
float3 norm_w = normalize(mul(m_W, v.norm));
|
||||
|
||||
o.hpos = mul(m_WVP, pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
o.tc1 = calc_model_lmap(pos_w); //
|
||||
o.c0 = calc_sun(norm_w); // sun
|
||||
o.c1 = float4(calc_model_lq_lighting(norm_w), m_plmap_clamp[0].w);
|
||||
o.fog = calc_fogging(pos_w4); // fog, input in world coords
|
||||
|
||||
#ifdef SKIN_COLOR
|
||||
o.c1.rgb *= v.rgb_tint;
|
||||
o.c1.w = 1;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
28
gamedata/shaders/r1/model_def_lplanes.vs.hlsl
Normal file
28
gamedata/shaders/r1/model_def_lplanes.vs.hlsl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float4 c0 : COLOR0; // color
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_WVP, v.pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
|
||||
// calculate fade
|
||||
float3 dir_v = normalize(mul(m_WV, v.pos));
|
||||
float3 norm_v = normalize(mul(m_WV, v.norm));
|
||||
float fade = abs(dot(dir_v, norm_v));
|
||||
o.c0 = fade;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
22
gamedata/shaders/r1/model_def_lq.ps.hlsl
Normal file
22
gamedata/shaders/r1/model_def_lq.ps.hlsl
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // lmap
|
||||
float3 c0 : COLOR0; // sun
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
|
||||
float3 light = I.c0;
|
||||
float3 final = light * t_base * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
|
||||
// out
|
||||
return float4(final.r, final.g, final.b, t_base.a);
|
||||
}
|
||||
34
gamedata/shaders/r1/model_def_lq.vs.hlsl
Normal file
34
gamedata/shaders/r1/model_def_lq.vs.hlsl
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float3 c0 : COLOR0; // color
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float4 pos = v.pos;
|
||||
float3 pos_w = mul(m_W, pos);
|
||||
float3 norm_w = normalize(mul(m_W, v.norm));
|
||||
|
||||
o.hpos = mul(m_WVP, pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
o.c0 = calc_model_lq_lighting(norm_w);
|
||||
o.fog = calc_fogging(float4(pos_w, 1)); // fog, input in world coords
|
||||
|
||||
#ifdef SKIN_COLOR
|
||||
o.c0.rgb *= v.rgb_tint;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_LQ
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
33
gamedata/shaders/r1/model_def_lqs.vs.hlsl
Normal file
33
gamedata/shaders/r1/model_def_lqs.vs.hlsl
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float3 c0 : COLOR0; // color
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float4 pos = v.pos;
|
||||
float3 pos_w = mul(m_W, pos);
|
||||
float3 norm_w = normalize(mul(m_W, v.norm));
|
||||
|
||||
o.hpos = mul(m_WVP, pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
o.c0 = calc_model_lq_lighting(norm_w);
|
||||
o.fog = calc_fogging(float4(pos_w, 1)); // fog, input in world coords
|
||||
|
||||
#ifdef SKIN_COLOR
|
||||
o.c0.rgb *= v.rgb_tint;
|
||||
#endif
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
21
gamedata/shaders/r1/model_def_point.vs.hlsl
Normal file
21
gamedata/shaders/r1/model_def_point.vs.hlsl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
vf_point _main(v_model v)
|
||||
{
|
||||
vf_point o;
|
||||
|
||||
float4 pos = v.pos;
|
||||
float3 pos_w = mul(m_W, pos);
|
||||
float4 pos_w4 = float4(pos_w, 1);
|
||||
float3 norm_w = normalize(mul(m_W, v.norm));
|
||||
|
||||
o.hpos = mul(m_WVP, pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
o.color = calc_point(o.tc1, o.tc2, pos_w4, norm_w); // just hemisphere
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf_point
|
||||
#include "skin_main.hlsli"
|
||||
21
gamedata/shaders/r1/model_def_shadow.vs.hlsl
Normal file
21
gamedata/shaders/r1/model_def_shadow.vs.hlsl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float4 c0 : COLOR0; // color
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_WVP, v.pos); // xform, input in world coords
|
||||
o.c0 = 0;
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_LQ
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
21
gamedata/shaders/r1/model_def_spot.vs.hlsl
Normal file
21
gamedata/shaders/r1/model_def_spot.vs.hlsl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
vf_spot _main(v_model v)
|
||||
{
|
||||
vf_spot o;
|
||||
|
||||
float4 pos = v.pos;
|
||||
float3 pos_w = mul(m_W, pos);
|
||||
float4 pos_w4 = float4(pos_w, 1);
|
||||
float3 norm_w = normalize(mul(m_W, v.norm));
|
||||
|
||||
o.hpos = mul(m_WVP, pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
o.color = calc_spot(o.tc1, o.tc2, pos_w4, norm_w); // just hemisphere
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf_spot
|
||||
#include "skin_main.hlsli"
|
||||
25
gamedata/shaders/r1/model_digiclock_hh.ps.hlsl
Normal file
25
gamedata/shaders/r1/model_digiclock_hh.ps.hlsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float digit = m_digiclock.x;
|
||||
|
||||
float2 coords = I.tc0;
|
||||
coords.x = digit + (coords.x * 0.1);
|
||||
float4 t_base = tex2D (s_base,coords);
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb+0.1;
|
||||
|
||||
return t_base;
|
||||
}
|
||||
25
gamedata/shaders/r1/model_digiclock_hl.ps.hlsl
Normal file
25
gamedata/shaders/r1/model_digiclock_hl.ps.hlsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float digit = m_digiclock.y;
|
||||
|
||||
float2 coords = I.tc0;
|
||||
coords.x = digit + (coords.x * 0.1);
|
||||
float4 t_base = tex2D (s_base,coords);
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb+0.1;
|
||||
|
||||
return t_base;
|
||||
}
|
||||
25
gamedata/shaders/r1/model_digiclock_mh.ps.hlsl
Normal file
25
gamedata/shaders/r1/model_digiclock_mh.ps.hlsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float digit = m_digiclock.z;
|
||||
|
||||
float2 coords = I.tc0;
|
||||
coords.x = digit + (coords.x * 0.1);
|
||||
float4 t_base = tex2D (s_base,coords);
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb+0.1;
|
||||
|
||||
return t_base;
|
||||
}
|
||||
25
gamedata/shaders/r1/model_digiclock_ml.ps.hlsl
Normal file
25
gamedata/shaders/r1/model_digiclock_ml.ps.hlsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float digit = m_digiclock.a;
|
||||
|
||||
float2 coords = I.tc0;
|
||||
coords.x = digit + (coords.x * 0.1);
|
||||
float4 t_base = tex2D (s_base,coords);
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb+0.1;
|
||||
|
||||
return t_base;
|
||||
}
|
||||
28
gamedata/shaders/r1/model_distort.vs.hlsl
Normal file
28
gamedata/shaders/r1/model_distort.vs.hlsl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float4 c0 : COLOR0; // color
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_WVP, v.pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
|
||||
// calculate fade
|
||||
float3 dir_v = normalize(mul(m_WV, v.pos));
|
||||
float3 norm_v = normalize(mul(m_WV, v.norm));
|
||||
float fade = 1 - abs(dot(dir_v, norm_v));
|
||||
o.c0 = fade;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
30
gamedata/shaders/r1/model_distort2t.vs.hlsl
Normal file
30
gamedata/shaders/r1/model_distort2t.vs.hlsl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float2 tc1 : TEXCOORD1; // another
|
||||
float4 c0 : COLOR0; // color
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_WVP, v.pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
|
||||
// calculate fade
|
||||
float3 dir_v = normalize(mul(m_WV, v.pos));
|
||||
float3 norm_v = normalize(mul(m_WV, v.norm));
|
||||
float fade = abs(dot(dir_v, norm_v));
|
||||
o.c0 = fade;
|
||||
o.tc1 = fade;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
28
gamedata/shaders/r1/model_distort4ghost.vs.hlsl
Normal file
28
gamedata/shaders/r1/model_distort4ghost.vs.hlsl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float4 c0 : COLOR0; // color
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_WVP, v.pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
|
||||
// calculate fade
|
||||
float3 dir_v = normalize(mul(m_WV, v.pos));
|
||||
float3 norm_v = normalize(mul(m_WV, v.norm));
|
||||
float fade = 0.9 * abs(dot(dir_v, norm_v));
|
||||
o.c0 = fade;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
28
gamedata/shaders/r1/model_distort4glass.vs.hlsl
Normal file
28
gamedata/shaders/r1/model_distort4glass.vs.hlsl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float4 c0 : COLOR0; // color
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_WVP, v.pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
|
||||
// calculate fade
|
||||
float3 dir_v = normalize(mul(m_WV, v.pos));
|
||||
float3 norm_v = normalize(mul(m_WV, v.norm));
|
||||
float fade = 0.9 * abs(dot(dir_v, norm_v));
|
||||
o.c0 = fade;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
28
gamedata/shaders/r1/model_distort_inv.vs.hlsl
Normal file
28
gamedata/shaders/r1/model_distort_inv.vs.hlsl
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float4 c0 : COLOR0; // color
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
o.hpos = mul(m_WVP, v.pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
|
||||
// calculate fade
|
||||
float3 dir_v = normalize(mul(m_WV, v.pos));
|
||||
float3 norm_v = normalize(mul(m_WV, v.norm));
|
||||
float fade = abs(dot(dir_v, norm_v));
|
||||
o.c0 = fade;
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
21
gamedata/shaders/r1/model_env.ps.hlsl
Normal file
21
gamedata/shaders/r1/model_env.ps.hlsl
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 diffuse : COLOR0;
|
||||
float4 tc0 : TEXCOORD0; // projector
|
||||
float4 tc1 : TEXCOORD1; // env
|
||||
float4 tc2 : TEXCOORD2; // base
|
||||
};
|
||||
|
||||
uniform sampler2D s_projector;
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 light = I.diffuse + tex2D(s_projector, I.tc0);
|
||||
float4 t_env = texCUBE(s_env, I.tc1);
|
||||
float4 t_base = tex2D(s_base, I.tc2);
|
||||
float4 base = lerp(t_env, t_base, t_base.a);
|
||||
return light * base * 2;
|
||||
}
|
||||
32
gamedata/shaders/r1/model_env_hq.ps.hlsl
Normal file
32
gamedata/shaders/r1/model_env_hq.ps.hlsl
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float3 tc1 : TEXCOORD1; // environment
|
||||
float4 tc2 : TEXCOORD2; // lmap
|
||||
float3 c0 : COLOR0; // sun
|
||||
float4 c1 : COLOR1; // lq-color + factor
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_env = texCUBE(s_env, I.tc1);
|
||||
float4 t_lmap = tex2Dproj(s_lmap, I.tc2);
|
||||
|
||||
// lighting
|
||||
float3 l_base = t_lmap.rgb; // base light-map (lmap color, ambient, hemi, etc - inside)
|
||||
float3 l_sun = I.c0 * t_lmap.a; // sun color
|
||||
float3 light = lerp(l_base + l_sun, I.c1, I.c1.w);
|
||||
|
||||
// final-color
|
||||
float3 base = lerp(t_env, t_base, t_base.a);
|
||||
float3 final = light * base * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
|
||||
// out
|
||||
return float4(final.r, final.g, final.b, t_base.a);
|
||||
}
|
||||
41
gamedata/shaders/r1/model_env_hq.vs.hlsl
Normal file
41
gamedata/shaders/r1/model_env_hq.vs.hlsl
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
// #define SKIN_2
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float3 tc1 : TEXCOORD1; // environment
|
||||
float4 tc2 : TEXCOORD2; // projected lmap
|
||||
float3 c0 : COLOR0; // sun-color
|
||||
float4 c1 : COLOR1; // lq-color + factor
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float4 pos = v.pos;
|
||||
float3 pos_w = mul(m_W, pos);
|
||||
float4 pos_w4 = float4(pos_w, 1);
|
||||
float3 norm_w = normalize(mul(m_W, v.norm));
|
||||
|
||||
o.hpos = mul(m_WVP, pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
o.tc1 = calc_reflection(pos_w, norm_w);
|
||||
o.tc2 = calc_model_lmap(pos_w); //
|
||||
o.c0 = calc_sun(norm_w); // sun
|
||||
o.c1 = float4(calc_model_lq_lighting(norm_w), m_plmap_clamp[0].w);
|
||||
o.fog = calc_fogging(pos_w4); // fog, input in world coords
|
||||
#ifdef SKIN_COLOR
|
||||
o.c1.rgb *= v.rgb_tint;
|
||||
o.c1.w = 1;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
24
gamedata/shaders/r1/model_env_lq.ps.hlsl
Normal file
24
gamedata/shaders/r1/model_env_lq.ps.hlsl
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float3 tc1 : TEXCOORD1; // environment
|
||||
float3 c0 : COLOR0; // sun
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_env = texCUBE(s_env, I.tc1);
|
||||
|
||||
float3 base = lerp(t_env, t_base, t_base.a);
|
||||
float3 light = I.c0;
|
||||
float3 final = light * base * 2.0f;
|
||||
final = lerp(fog_color.xyz, final, I.fog);
|
||||
|
||||
// out
|
||||
return float4(final.r, final.g, final.b, t_base.a);
|
||||
}
|
||||
35
gamedata/shaders/r1/model_env_lq.vs.hlsl
Normal file
35
gamedata/shaders/r1/model_env_lq.vs.hlsl
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#include "common.hlsli"
|
||||
#include "skin.hlsli"
|
||||
|
||||
struct vf
|
||||
{
|
||||
float4 hpos : POSITION;
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float3 tc1 : TEXCOORD1; // environment
|
||||
float3 c0 : COLOR0; // color
|
||||
float fog : FOG;
|
||||
};
|
||||
|
||||
vf _main(v_model v)
|
||||
{
|
||||
vf o;
|
||||
|
||||
float4 pos = v.pos;
|
||||
float3 pos_w = mul(m_W, pos);
|
||||
float3 norm_w = normalize(mul(m_W, v.norm));
|
||||
|
||||
o.hpos = mul(m_WVP, pos); // xform, input in world coords
|
||||
o.tc0 = v.tc.xy; // copy tc
|
||||
o.tc1 = calc_reflection(pos_w, norm_w);
|
||||
o.c0 = calc_model_lq_lighting(norm_w);
|
||||
o.fog = calc_fogging(float4(pos_w, 1)); // fog, input in world coords
|
||||
|
||||
#ifdef SKIN_COLOR
|
||||
o.c0.rgb *= v.rgb_tint;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
#define SKIN_LQ
|
||||
#define SKIN_VF vf
|
||||
#include "skin_main.hlsli"
|
||||
23
gamedata/shaders/r1/model_env_sl.ps.hlsl
Normal file
23
gamedata/shaders/r1/model_env_sl.ps.hlsl
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0 : TEXCOORD0; // base
|
||||
float3 tc1 : TEXCOORD1; // environment
|
||||
float2 tc2 : TEXCOORD2; // lmap
|
||||
float3 c0 : COLOR0; // sun
|
||||
float4 c1 : COLOR1; // lq-color + factor
|
||||
};
|
||||
|
||||
// Pixel
|
||||
float4 main(v2p I) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D(s_base, I.tc0);
|
||||
float4 t_env = texCUBE(s_env, I.tc1);
|
||||
|
||||
// final-color
|
||||
float3 final = lerp(t_env, t_base, t_base.a);
|
||||
|
||||
// out
|
||||
return float4(final.r, final.g, final.b, t_base.a);
|
||||
}
|
||||
25
gamedata/shaders/r1/model_exohealth.ps.hlsl
Normal file
25
gamedata/shaders/r1/model_exohealth.ps.hlsl
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D (s_base,I.tc0);
|
||||
t_base.g += clamp(0.5-abs(m_actor_params.y-0.5), 0, 0.5)*t_base.a;
|
||||
t_base.r += (1-m_actor_params.y)*t_base.a;
|
||||
|
||||
//ïîëó÷àåì ïèêñåëü øóìà è ìàñøòàáèðóåì åãî â ñîîòâåòñòâèè ñ òåêóùèì óðîâíåì ïðîáëåì
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb;
|
||||
|
||||
return float4 (t_base.r, t_base.g, t_base.b, 1);
|
||||
}
|
||||
|
||||
|
||||
22
gamedata/shaders/r1/model_exoscreen.ps.hlsl
Normal file
22
gamedata/shaders/r1/model_exoscreen.ps.hlsl
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float2 tc0: TEXCOORD0; // base
|
||||
float2 tc1: TEXCOORD1; // lmap
|
||||
float4 c0: COLOR0; // sun
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Pixel
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D (s_base,I.tc0);
|
||||
|
||||
//ïîëó÷àåì ïèêñåëü øóìà è ìàñøòàáèðóåì åãî â ñîîòâåòñòâèè ñ òåêóùèì óðîâíåì ïðîáëåì
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb;
|
||||
|
||||
// out
|
||||
return float4 (t_base.r,t_base.g,t_base.b,t_base.a * I.c0.a);
|
||||
}
|
||||
22
gamedata/shaders/r1/model_green_conditionbar.ps.hlsl
Normal file
22
gamedata/shaders/r1/model_green_conditionbar.ps.hlsl
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D (s_base,I.tc0);
|
||||
t_base.a = (I.tc0.x < m_actor_params.z) ? 1 : 0;
|
||||
t_base.r += (0.5 < m_actor_params.z) ? 0 : 0.5;
|
||||
t_base.g -= (0.25 < m_actor_params.z) ? 0 : 0.5;
|
||||
|
||||
return float4 (t_base.r, t_base.g, t_base.b, t_base.a);
|
||||
}
|
||||
|
||||
|
||||
26
gamedata/shaders/r1/model_green_energybar.ps.hlsl
Normal file
26
gamedata/shaders/r1/model_green_energybar.ps.hlsl
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D (s_base,I.tc0);
|
||||
t_base.a = (I.tc0.x < m_actor_params.a) ? 1 : 0;
|
||||
t_base.r += (0.1 < m_actor_params.a) ? 0 : 0.5;
|
||||
t_base.g -= (0.1 < m_actor_params.a) ? 0 : 0.5;
|
||||
|
||||
//ïîëó÷àåì ïèêñåëü øóìà è ìàñøòàáèðóåì åãî â ñîîòâåòñòâèè ñ òåêóùèì óðîâíåì ïðîáëåì
|
||||
float4 t_noise = tex2D(s_lmap, I.tc0) * m_affects.x * 2;
|
||||
t_base.rgb += t_noise.rgb;
|
||||
|
||||
return float4 (t_base.r, t_base.g, t_base.b, t_base.a);
|
||||
}
|
||||
|
||||
|
||||
30
gamedata/shaders/r1/model_pda_screen.ps.hlsl
Normal file
30
gamedata/shaders/r1/model_pda_screen.ps.hlsl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Pixel
|
||||
uniform sampler2D s_vp2;
|
||||
uniform sampler2D s_load;
|
||||
uniform sampler2D s_noise;
|
||||
|
||||
//float4 problems_main( v2p I )
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
//выбираем основное изображение, которое выведется на экран
|
||||
float4 t_vp2 = ( m_affects.a * m_affects.x > 0 ) ? tex2D(s_load, I.tc0) : ((m_affects.x < 0.27) ? tex2D(s_vp2, I.tc0) : tex2D(s_base, I.tc0));
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_noise, I.tc0) * m_affects.x * (1-m_affects.a) * 2;
|
||||
//t_vp2.rgb += t_noise.rgb;
|
||||
|
||||
t_vp2.rgb = (m_affects.x > 0.41) ? 0 : t_vp2.rgb + t_noise.rgb;
|
||||
|
||||
return float4 (t_vp2.r, t_vp2.g, t_vp2.b, 1);
|
||||
}
|
||||
36
gamedata/shaders/r1/model_scope_gauss.ps.hlsl
Normal file
36
gamedata/shaders/r1/model_scope_gauss.ps.hlsl
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Pixel
|
||||
uniform sampler2D s_vp2;
|
||||
uniform sampler2D s_noise;
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
float4 t_base = tex2D (s_base,I.tc0);
|
||||
|
||||
|
||||
I.tc0.x = (I.tc0.x-0.5f)*m_hud_params.x+0.5f+m_zoom_deviation.x; // Растягиваем картинку в линзе так, чтобы на любом разрешении экрана были правильные пропорции
|
||||
I.tc0.y = I.tc0.y+m_zoom_deviation.y;
|
||||
float4 t_vp2 = tex2D (s_vp2, I.tc0); // Изображение со второго вьюпорта
|
||||
|
||||
t_vp2.b = t_vp2.b + (t_vp2.r + t_vp2.g + t_vp2.b+1)*m_zoom_deviation.z;
|
||||
|
||||
//получаем пиксель шума и масштабируем его в соответствии с текущим уровнем проблем
|
||||
float4 t_noise = tex2D(s_noise, I.tc0) * m_affects.x * 2;
|
||||
t_vp2.rgb += t_noise.rgb;
|
||||
|
||||
// Миксуем с сеткой
|
||||
float4 res = lerp (t_vp2, t_base, t_base.a);
|
||||
|
||||
// out
|
||||
return float4 (res.r, res.g, res.b, min(m_hud_params.y, m_hud_params.a));
|
||||
}
|
||||
36
gamedata/shaders/r1/model_scope_lense.ps.hlsl
Normal file
36
gamedata/shaders/r1/model_scope_lense.ps.hlsl
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Pixel
|
||||
uniform sampler2D s_vp2;
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
|
||||
float4 t_base = tex2D (s_base,I.tc0);
|
||||
|
||||
|
||||
I.tc0.x = (I.tc0.x-0.5f)*m_hud_params.x+0.5f+m_zoom_deviation.x; // Растягиваем картинку в линзе так, чтобы на любом разрешении экрана были правильные пропорции
|
||||
I.tc0.y = I.tc0.y+m_zoom_deviation.y;
|
||||
float4 t_vp2 = tex2D (s_vp2, I.tc0); // Изображение со второго вьюпорта
|
||||
|
||||
|
||||
float4 final = float4 (0, 0, 0, 0);
|
||||
|
||||
{ //** Стандартный режим **//
|
||||
// Миксуем всё и собираем финальную картинку
|
||||
float4 base = lerp (t_vp2, t_base, t_base.a); // Сетку с вьюпортом
|
||||
final = base;
|
||||
}
|
||||
|
||||
// out
|
||||
return float4 (final.r, final.g, final.b, min(m_hud_params.y, m_hud_params.a));
|
||||
}
|
||||
36
gamedata/shaders/r1/model_scope_lense_lerp.ps.hlsl
Normal file
36
gamedata/shaders/r1/model_scope_lense_lerp.ps.hlsl
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include "common.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Pixel
|
||||
uniform sampler2D s_vp2;
|
||||
uniform sampler2D s_base2;
|
||||
|
||||
float4 main (v2p I) : COLOR
|
||||
{
|
||||
// Производим выборку правой и левой половин текстуры с сеткой
|
||||
float2 coords = I.tc0;
|
||||
coords.x *= 0.5;
|
||||
float4 base2 = tex2D(s_base2, coords);
|
||||
coords.x += 0.5;
|
||||
float4 t_base = tex2D(s_base, coords);
|
||||
// Миксуем половинки в соответствии с текущим уровнем подсветки
|
||||
t_base = lerp(base2, t_base, m_zoom_deviation.z);
|
||||
|
||||
// Коррекция пропорций в зависимости от разрешения
|
||||
I.tc0.x = (I.tc0.x - 0.5f) * m_hud_params.x + 0.5f + m_zoom_deviation.x;
|
||||
I.tc0.y = I.tc0.y + m_zoom_deviation.y;
|
||||
float4 t_vp2 = tex2D(s_vp2, I.tc0);
|
||||
|
||||
|
||||
float4 final = lerp(t_vp2, t_base, t_base.a);
|
||||
// out
|
||||
return float4(final.r, final.g, final.b, min(m_hud_params.y, m_hud_params.a));
|
||||
}
|
||||
36
gamedata/shaders/r1/model_scope_lense_night.ps.hlsl
Normal file
36
gamedata/shaders/r1/model_scope_lense_night.ps.hlsl
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include "common.hlsli"
|
||||
uniform float4 screen_res;
|
||||
#include "pnv.hlsli"
|
||||
|
||||
struct v2p
|
||||
{
|
||||
float4 tc0: TEXCOORD0; // base
|
||||
float4 tc1: TEXCOORD1; // environment
|
||||
float4 c0: COLOR0; // sun.(fog*fog)
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Pixel
|
||||
uniform sampler2D s_vp2;
|
||||
|
||||
float4 main ( v2p I ) : COLOR
|
||||
{
|
||||
|
||||
float4 t_base = tex2D (s_base,I.tc0);
|
||||
|
||||
I.tc0.x = (I.tc0.x-0.5f)*m_hud_params.x+0.5f+m_zoom_deviation.x; // Растягиваем картинку в линзе так, чтобы на любом разрешении экрана были правильные пропорции
|
||||
I.tc0.y = I.tc0.y+m_zoom_deviation.y;
|
||||
float4 t_vp2 = tex2D (s_vp2, I.tc0); // Изображение со второго вьюпорта
|
||||
|
||||
float4 final = float4 (0, 0, 0, 0);
|
||||
|
||||
//** Ночной режим **// //Зеленый ПНВ
|
||||
t_vp2.rgb = calc_night_vision_effect(I.tc0, t_vp2, float3(1.0, 2.0, 1.0));
|
||||
|
||||
// Миксуем с сеткой
|
||||
float4 res = lerp (t_vp2, t_base, t_base.a);
|
||||
|
||||
// out
|
||||
return float4 (res.r, res.g, res.b, min(m_hud_params.y, m_hud_params.a));
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue