; filename track.shd for Watkins 1 July 2004 - Dec 2010
; After shader_ put filename of images used
; WatkinsV5 track shaders by boomer541 & AlfaNut Oct 6, 2003
; =================================
; the window shader came from Race Sim Central forum
; other info from gyral track shaders by Oliver Pieper, pieper@viaregio.de (aka "Redburne" at RCS)

; =============================================================================
; shader subtrees for later reference
; =============================================================================
;shader_dirtrd~vf_standard_transparent
;{
;  cast_shadow=0
;  layer0
;  {
;    map=dirtrd.tga
;    ; Dithering (but Z-buffered)
;    alpha_to_coverage=1
;    ; Don't write depth; we're a decal - that makes sure Racer renders the road first, then the tracks on top
;    depthwrite=0
;    ; Regular blending
;    ;blendfunc=blend
;    ;alphafunc=gequal 128
;    ;depthwrite=0
;    ;depthfunc=lequal
;  }
;}

; Vertex/fragment templates
vf_standard
{
  ; Most-often used shader
  vertex_shader 
  {
    file=standard_v.cg
  }
  fragment_shader
  {
    file=standard_f.cg
  }
}
vf_standard_transparent
{
  ; Shader for transparent (blended) materials
  vertex_shader 
  {
    file=standard_v.cg
  }
  fragment_shader
  {
    file=standard_transparent_f.cg
  }
}
vf_vertexcolor
{
  ; Carlswood uses vertex coloring a lot in the grass. Other tracks may use 'standard_v.cg' and 'standard_f.cg' instead.
  vertex_shader 
  {
    file=standard_vc_v.cg
  }
  fragment_shader
  {
    file=standard_vc_f.cg
  }
}
vf_dyn_standard
{
  ; Dynamic objects (such as cones) with a default shader
  vertex_shader 
  {
    file=dyn_standard_v.cg
  }
  fragment_shader
  {
    file=standard_f.cg
  }
}
vf_animate
{
  ; Animation test (top moves around)
  vertex_shader 
  {
    file=animate_test_v.cg
  }
  fragment_shader
  {
    file=standard_f.cg
  }
}
vf_road
{
  ; The road uses specularity but burned through the red channel to get a coarse gloss map
;  scale=7.5
  vertex_shader 
  {
    file=standard_v.cg
  }
  fragment_shader
  {
;    file=standard_detail_burn_a_f.cg
     file=standard_burn_f.cg
   ; Burn specularity through alpha
;    file=standard_burn_a_f.cg
  }
}
vf_bump
{
  vertex_shader
  {
    file=standard_bump_v.cg
  }
  fragment_shader
  {
    file=standard_bump_f.cg
  }
}
vf_reflect
{
 vertex_shader
  {
;   file=dyn_standard_bump_reflect_v.cg
    file=dyn_standard_reflect_v.cg
  }
  fragment_shader
  {
;   file=dyn_standard_bump_reflect_f.cg
    file=dyn_standard_reflect_f.cg
  }
}
vf_tree
{
  ; Tree fake their normals pointing up
  vertex_shader
  {
    file=standard_tree_v.cg
  }
  fragment_shader
  {
    file=standard_tree_f.cg
  }
}
vf_wave_flag
 {
  vertex_shader
  {
    file=standard_wave_v.cg
  }
  fragment_shader
  {
    file=standard_wave_f.cg
  }
 }
vf_reflect_window
{
  vertex_shader
  {
    file=dyn_standard_reflect_window_v.cg
  }
  fragment_shader
  {
    file=dyn_standard_reflect_window_f.cg
  }
}
vf_glass
{
 vertex_shader
  {
    file=dyn_standard_reflect_v.cg
  }
  fragment_shader
  {
    file=dyn_standard_reflect_f.cg
  }
}
vf_water
{
 vertex_shader
  {
    file=water_v.cg
  }
  fragment_shader
  {
    file=water_f.cg
  }
}
vf_cloud
{
  vertex shader
  {
    file=clouds_v.cg
  }
  fragment_shader
  {
    file=clouds_f.cg
  }
}
vf_mix1w
{
  ; Single texture, world mapped
  vertex_shader 
  {
    file=standard_v.cg
  }
  fragment_shader
  {
    file=standard_mix1w_f.cg
  }
}
vf_mix2
{
  ; 2 textures, both world mapped
  vertex_shader 
  {
    file=standard_v.cg
  }
  fragment_shader
  {
    file=standard_mix2_f.cg
  }
}
vf_mix2w
{
  ; 2 textures with world mapping for the 2nd texture
  vertex_shader 
  {
    file=standard_v.cg
  }
  fragment_shader
  {
    file=standard_mix2w_f.cg
  }
}
vf_sky
{
  vertex_shader
  {
    file=sky_daynight_v.cg
  }
  fragment_shader
  {
    file=sky_daynight_f.cg
  }
}
;
; Shaders
;
; =============================================================================
; here there be shaders ...
; =============================================================================
; compression=0
shader_sky~vf_sky
{
;  compression=0
  sky=1
  fog=0
  cull=none
  layer0
  {
   map=sky.tga
   depthwrite=0
   depthfunc=always
  }
  layer1
  {
   map=sky_night.tga
   depthwrite=0
   depthfunc=always
  }
}
shader_grass2drt~vf_mix2w
 {
  scale=0.2
  layer0
  {
   map=grass2drt.tga
  }
  layer1
  {
   map=grass.tga
  }
 }
shader_grass~vf_mix1w
 {
  scale=0.2
  layer0
  {
   map=grass.tga
  }
 }
shader_dirtrd~vf_standard_transparent
{
  cast_shadow=0
  layer0
  {
    map=dirtrd.tga
    ; Dithering (but Z-buffered)
    alpha_to_coverage=1
    ; Don't write depth; we're a decal - that makes sure Racer renders the road first, then the tracks on top
    depthwrite=0
    ; Regular blending
    ;blendfunc=blend
    ;alphafunc=gequal 128
    ;depthwrite=0
    ;depthfunc=lequal
  }
}
shader_drtrdint1~vf_standard_transparent
{
  cast_shadow=0
  layer0
  {
    map=drtrdint1.tga
    ; Dithering (but Z-buffered)
    alpha_to_coverage=1
    ; Don't write depth; we're a decal - that makes sure Racer renders the road first, then the tracks on top
    depthwrite=0
    ; Regular blending
    ;blendfunc=blend
    ;alphafunc=gequal 128
    ;depthwrite=0
    ;depthfunc=lequal
  }
}
shader_drtrdint2~vf_standard_transparent
{
  cast_shadow=0
  layer0
  {
    map=drtrdint2.tga
    ; Dithering (but Z-buffered)
    alpha_to_coverage=1
    ; Don't write depth; we're a decal - that makes sure Racer renders the road first, then the tracks on top
    depthwrite=0
    ; Regular blending
    ;blendfunc=blend
    ;alphafunc=gequal 128
    ;depthwrite=0
    ;depthfunc=lequal
  }
}
shader_drtrdint3~vf_standard_transparent
{
  cast_shadow=0
  layer0
  {
    map=drtrdint3.tga
    ; Dithering (but Z-buffered)
    alpha_to_coverage=1
    ; Don't write depth; we're a decal - that makes sure Racer renders the road first, then the tracks on top
    depthwrite=0
    ; Regular blending
    ;blendfunc=blend
    ;alphafunc=gequal 128
    ;depthwrite=0
    ;depthfunc=lequal
  }
}
shader_drtrdint4~vf_standard_transparent
{
  cast_shadow=0
  layer0
  {
    map=drtrdint4.tga
    ; Dithering (but Z-buffered)
    alpha_to_coverage=1
    ; Don't write depth; we're a decal - that makes sure Racer renders the road first, then the tracks on top
    depthwrite=0
    ; Regular blending
    ;blendfunc=blend
    ;alphafunc=gequal 128
    ;depthwrite=0
    ;depthfunc=lequal
  }
}
shader_2rail~vf_standard_transparent
{
  sort_offset=49
  cull=none
  layer0
  {
    mipmap=1
    map=2rail.tga
    alpha_to_coverage=1
    alphafunc=greater 0
    depthwrite=1
   }
}
shader_asphalt~vf_standard
{
  layer0
  {
    map=asphalt.tga
  }
}
shader_bark~vf_standard_transparent
{
  layer0
  {
    map=bark.tga
    mipmap=1
    blendfunc=blend
    alpha_to_coverage=1
    alphafunc=greater 0
    depthwrite=1
  }
}
shader_cement~vf_dyn_standard
{
  sort_offset=51
  cull=back
  layer0
  {
    map=cement.tga
  }
}
shader_curb~vf_standard
{
  layer0
  {
    map=curb.tga
  }
}
shader_dam_asp~vf_standard
{
;  sort_offset=51
;  cull=back
  layer0
  {
    map=dam_asp.jpg
  }
}
shader_dirtrd_edged~vf_standard
;shader_dirt_1~vf_standard
{
  layer0
  {
    map=dirtrd_edged.tga
  }
}
;shader_dirtedge~vf_standard
;{
;  layer0
;  {
;    map=dirtedge.tga
;  }
;}
shader_grid~vf_road
{
;  ambient=0.1 0.1 0.1
;  diffuse=0.2 0.2 0.2
  specular=0.2 0.2 0.2
  shininess=1   ;0   ;1
  tangents=0
  layer0
  {
    map=grid.tga
    mipmap=1
    mipmap_lod_bias=-1
  }
}
shader_gstand~vf_standard_transparent
{
  cull=none
  layer0
  {
    map=gstand.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=greater 50
    wrap_t=clamp_to_edge
  }
}
shader_horiz~vf_standard_transparent
{
  cast_shadow=0
  layer0
  {
    map=horiz.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=greater 120
    ; Avoid too much light difference based on direction
    diffuse=0.5 0.6 0.5 
    wrap_t=clamp_to_edge
  }
}
shader_mtroad~vf_standard
{
  layer0
  {
    mipmap=1
    map=mtroad.tga
  }
}
shader_road~vf_road
{
;  ambient=0.1 0.1 0.1
;  diffuse=0.2 0.2 0.2
  specular=0.2 0.2 0.2
  shininess=1
  tangents=1
  layer0
  {
    map=road.tga
    mipmap=1
;    mipmap_lod_bias=-1
  }
  layer1
  {
    map=road_n.jpg
    mode=linear
    mipmap=1
    mipmap_lod_bias=-1
  }
}
shader_roadedge~vf_road
{
;  ambient=0.1 0.1 0.1
;  diffuse=0.2 0.2 0.2
  specular=0.2 0.2 0.2
  shininess=1
  tangents=1
  layer0
  {
    map=roadedge.tga
    mipmap=1
    mipmap_lod_bias=-1
  }
}
shader_sfline~vf_road
{
;  ambient=0.1 0.1 0.1
;  diffuse=0.2 0.2 0.2
  specular=0.2 0.2 0.2
  shininess=1
  tangents=1
  layer0
  {
    map=sfline.tga
    mipmap=1
    mipmap_lod_bias=-1
  }
}
shader_signs~vf_dyn_standard
{
  layer0
  {
    map=signs.tga
  }
}
shader_tree1~vf_tree
{
;  cull=none
  tangents=1
  layer0
  {
    mipmap=1   ;0
    map=tree1.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=greater 128
    ; Avoid too much light difference based on direction
    diffuse=0.5 0.6 0.5 
    wrap_t=clamp_to_edge
  }
}
shader_tree2~vf_tree
{
;  cull=none
  tangents=1
  layer0
  {
    mipmap=1   ;0
    map=tree2.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=greater 128
    ; Avoid too much light difference based on direction
    diffuse=0.5 0.6 0.5 
    wrap_t=clamp_to_edge
  }
;  layer1
;  {
;   map=tree_n.jpg
;   mode=linear
;   alpha_to_coverage=1
;;    depthwrite=1
;   alphafunc=greater 128
;   wrap_t=clamp_to_edge
;  }
}
shader_tree3~vf_tree
{
  tangents=1
  layer0
  {
    mipmap=1   ;0
    map=tree3.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=greater 128
    diffuse=0.5 0.6 0.5 
    wrap_t=clamp_to_edge
  }
}
shader_tree4~vf_tree
{
  tangents=1
  layer0
  {
    mipmap=1   ;0
    map=tree4.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=greater 128
    diffuse=0.5 0.6 0.5 
    wrap_t=clamp_to_edge
  }
}
shader_tree5~vf_tree
{
  tangents=1
  layer0
  {
    mipmap=1   ;0
    map=tree5.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=greater 128
    diffuse=0.5 0.6 0.5 
    wrap_t=clamp_to_edge
  }
}
shader_tree6~vf_tree
{
  tangents=1
  layer0
  {
    mipmap=1   ;0
    map=tree6.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=greater 128
    diffuse=0.5 0.6 0.5 
    wrap_t=clamp_to_edge
  }
}
shader_tree7~vf_tree
{
  tangents=1
  layer0
  {
    mipmap=1   ;0
    map=tree7.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=greater 128
    diffuse=0.5 0.6 0.5 
    wrap_t=clamp_to_edge
  }
;  layer1
;  {
;   map=tree_n.jpg
;   mode=linear
;   alpha_to_coverage=1
;;    depthwrite=1
;   alphafunc=greater 128
;   wrap_t=clamp_to_edge
;  }
}
shader_treln~vf_standard_transparent
{
  layer0
  {
    mipmap=1   ;0
    map=Treln.tga
    alpha_to_coverage=1
    depthwrite=1
    alphafunc=gequal 120
    diffuse=0.5 0.6 0.5 
    wrap_t=clamp_to_edge
  }
}
shader_treetop~vf_standard
{
  layer0
  {
    map=treetop.tga
  }
}
shader_tunnel~vf_standard
{
  sort_offset=50
  layer0
  {
    map=tunnel.tga
  }
}
shader_window~vf_standard
{
  layer0
  {
    map=window.tga
    blendfunc=blend
    alphafunc=gequal 140
    wrap_t=clamp_to_edge
    depthwrite=1
  }
  layer1
  {
    map=window.tga
    alphafunc=notequal 140   ;notequal to alpha value (128) for color, =128 for no color
    blendfunc=src_alpha one_minus_src_alpha
    emission=-0.0 -0.0 -0.0 1   ; colors all pixels not=alpha(176), - numbers make darker
    depthwrite=0
  }
}
