#if "@formatNormal@" == "" #if TARGET_PLATFORM == "xenon" #define NORMAL_MAP_FORMAT "DXN" #else #define NORMAL_MAP_FORMAT "DXT5" #endif #else #define NORMAL_MAP_FORMAT "@formatNormal@" #endif // // default images // #define COLOR_SUFFIX "c0" #if ("$normalMap$" == "" || "$normalMap$" == "$identityNormalMap") && "$specColorMap$" == "" && "$cosinePowerMap$" == "" #define NORMAL_MAP_TILE "tile both" #define NORMAL_MAP_FILTER "nomip nearest" #define NORMAL_MAP_IMAGE "$identityNormalMap" #define NORMAL_MAP_ANIMRATE 0 #define NORMAL_MAP_NOPICMIP 1 #define USE_SPEC_MAP 0 #define NORMAL_SUFFIX "" #define SPEC_SUFFIX "" #else #if "$normalMap$" == "" || "$normalMap$" == "$identityNormalMap" #define NORMAL_MAP_TILE "tile both" #define NORMAL_MAP_FILTER "nomip nearest" #define NORMAL_MAP_IMAGE "$identityNormalMap" #define NORMAL_MAP_NOPICMIP 1 #define NORMAL_SUFFIX "" #else #define NORMAL_MAP_TILE "@tileNormal@" #define NORMAL_MAP_FILTER "@filterNormal@" #define NORMAL_MAP_IMAGE "$normalMap$" #define NORMAL_MAP_NOPICMIP @nopicmipNormal@ #define NORMAL_SUFFIX "n0" #endif #if "$specColorMap$" == "" && "$cosinePowerMap$" == "" #define USE_SPEC_MAP 0 #define SPEC_SUFFIX "" #else #define USE_SPEC_MAP 1 #define SPEC_SUFFIX "s0" #if "$specColorMap$" != "" #define SPEC_COLOR_IMAGE "$specColorMap$" #else #define SPEC_COLOR_IMAGE "$white" #endif #if "$cosinePowerMap$" != "" #define COSINE_POWER_IMAGE "$cosinePowerMap$" #else #define COSINE_POWER_IMAGE "$white" #endif #if "@formatSpecular@" == "" #define SPECULAR_FORMAT "DXT5" #else #define SPECULAR_FORMAT "@formatSpecular@" #endif #if SPEC_COLOR_IMAGE != "$white" #define COSINE_POWER_SCALE (30.5 / 32.0) #else #define COSINE_POWER_SCALE 1 #endif #endif #endif #define USE_DETAIL_MAP ("$detailMap$" != "") #if USE_DETAIL_MAP #define DETAIL_SUFFIX "d0" #else #define DETAIL_SUFFIX "" #endif #include "commonsetup.template" #if @texScroll@ #define TEX_SCROLL_SUFFIX "_scroll" #else #define TEX_SCROLL_SUFFIX "" #endif #if @scorchable@ #define SCORCH_SUFFIX "_sco" #else #define SCORCH_SUFFIX "" #endif #define MAT_FEATURE_SUFFIX "_clothwet" #if "@customString@" == "Skin" #define SKIN_SUFFIX "_skin" #if "@blendFunc@" != "Replace" || "@alphaTest@" != "Always" #error "Only Replace Always materials support the Skin shader." #endif #else #define SKIN_SUFFIX "" #endif #if @noReceiveDynamicShadow@ #define NAME_PREFIX "l" #else #define NAME_PREFIX "l_sm" #endif #if "@materialFeatureType@" == "clothwet" && "@materialType@" == "model phong" #define USE_COLOR_DETAIL_MAP 1 #if USE_SPEC_MAP && "$specDetailMap$" != "" #define USE_SPEC_DETAIL_MAP 1 #else #define USE_SPEC_DETAIL_MAP 0 #endif #else #define USE_COLOR_DETAIL_MAP 0 #define USE_SPEC_DETAIL_MAP 0 #endif #if USE_COLOR_DETAIL_MAP #define COLOR_DETAIL_SUFFIX "_clrdtl" #else #define COLOR_DETAIL_SUFFIX "" #endif #if USE_SPEC_DETAIL_MAP #define SPEC_DETAIL_SUFFIX "_specdtl" #else #define SPEC_DETAIL_SUFFIX "" #endif #if "@blendFunc@" == "Add" #if SPEC_SUFFIX != "" #error "specular maps are not allowed on additive phong materials" #endif #if TEX_SCROLL_SUFFIX != "" #error "tex scroll not allowed on additive phong materials" #endif #if USE_DETAIL_MAP #error "detail map not allowed on additive phong materials" #endif techniqueSet( NAME_PREFIX + "_a0c0" ); #elif "@blendFunc@" == "Replace" #if "@alphaTest@" == "Always" techniqueSet( NAME_PREFIX + TEX_SCROLL_SUFFIX + SKIN_SUFFIX + "_r0" + COLOR_SUFFIX + DETAIL_SUFFIX + NORMAL_SUFFIX + SPEC_SUFFIX + SCORCH_SUFFIX + COLOR_DETAIL_SUFFIX + SPEC_DETAIL_SUFFIX + MAT_FEATURE_SUFFIX ); #else techniqueSet( NAME_PREFIX + TEX_SCROLL_SUFFIX + "_t0" + COLOR_SUFFIX + DETAIL_SUFFIX + NORMAL_SUFFIX + SPEC_SUFFIX + SCORCH_SUFFIX + COLOR_DETAIL_SUFFIX + SPEC_DETAIL_SUFFIX + MAT_FEATURE_SUFFIX ); #endif #elif "@blendFunc@" == "Blend" techniqueSet( NAME_PREFIX + TEX_SCROLL_SUFFIX + "_b0" + COLOR_SUFFIX + DETAIL_SUFFIX + NORMAL_SUFFIX + SPEC_SUFFIX + SCORCH_SUFFIX + COLOR_DETAIL_SUFFIX + SPEC_DETAIL_SUFFIX + MAT_FEATURE_SUFFIX ); #else #error "blendFunc '@blendFunc@' with alphaTest '@alphaTest@' not supported for phong materials" #endif textureTable { #if "$colorMap$" == "" #error "colorMap may not be blank in phong materials" #endif "colorMap" = streamable map( "@tileColor@", "@filterColor@", "$colorMap$", @nopicmipColor@ ) "@formatColor@" : "colorMap"; #if USE_COLOR_DETAIL_MAP #if "$colorDetailMap$" == "" #error "colorDetailMap may not be blank in USE_COLOR_DETAIL_MAP materials" #endif "colorDetailMap" = map( "tile both", "@filterColorDetail@", "$colorDetailMap$", @nopicmipColorDetail@ ) "@formatColorDetail@" : "colorMap"; #endif #if USE_DETAIL_MAP "detailMap" = normalMap( "tile both", "@filterDetail@", "$detailMap$", @nopicmipDetail@ ) NORMAL_MAP_FORMAT : "normalMap"; #endif #if NORMAL_MAP_IMAGE == "$identityNormalMap" "normalMap" = map( "tile both", "nomip nearest", "$identityNormalMap", true ) "" : "normalMap"; #else "normalMap" = streamable normalMap( NORMAL_MAP_TILE, NORMAL_MAP_FILTER, NORMAL_MAP_IMAGE, NORMAL_MAP_NOPICMIP ) NORMAL_MAP_FORMAT : "normalMap"; #endif #if USE_SPEC_MAP "specularMap" = streamable composite ( map( "@tileSpecular@", "@filterSpecular@", SPEC_COLOR_IMAGE, @nopicmipSpecular@ ).r, map( "@tileSpecular@", "@filterSpecular@", SPEC_COLOR_IMAGE, @nopicmipSpecular@ ).g, map( "@tileSpecular@", "@filterSpecular@", SPEC_COLOR_IMAGE, @nopicmipSpecular@ ).b, map( "@tileSpecular@", "@filterSpecular@", COSINE_POWER_IMAGE, @nopicmipSpecular@ ) * COSINE_POWER_SCALE ) SPECULAR_FORMAT : "specularMap"; #if USE_SPEC_DETAIL_MAP "specularDetailMap" = streamable composite ( map( "@tileSpecular@", "@filterSpecular@", "$specDetailMap$", @nopicmipSpecular@ ).r, map( "@tileSpecular@", "@filterSpecular@", "$specDetailMap$", @nopicmipSpecular@ ).g, map( "@tileSpecular@", "@filterSpecular@", "$specDetailMap$", @nopicmipSpecular@ ).b, map( "@tileSpecular@", "@filterSpecular@", "$specDetailMap$", @nopicmipSpecular@ ).a ) SPECULAR_FORMAT : "specularMap"; #endif #endif "cwWetnessMap" = streamable map( "@tileColor@", "@filterColor@", "$colorMap00$", @nopicmipColor@ ) "@formatColor@" : "colorMap00"; "cwWetCosineMap" = streamable composite ( map( "@tileSpecular@", "@filterSpecular@", "$colorMap01$", @nopicmipSpecular@ ).r, map( "@tileSpecular@", "@filterSpecular@", "$colorMap01$", @nopicmipSpecular@ ).g, map( "@tileSpecular@", "@filterSpecular@", "$colorMap01$", @nopicmipSpecular@ ).b, map( "@tileSpecular@", "@filterSpecular@", "$colorMap01$", @nopicmipSpecular@ ) * COSINE_POWER_SCALE ) SPECULAR_FORMAT : "specularMap"; } constantTable { #if USE_COLOR_DETAIL_MAP "colorDetailScale" = float4( @colorDetailScaleX@ * imageWidth( "$colorDetailMap$" ) / imageWidth( "$colorDetailMap$" ), @colorDetailScaleY@ * imageHeight( "$colorDetailMap$" ) / imageHeight( "$colorDetailMap$" ), 0, 0 ); #endif #if USE_DETAIL_MAP "detailScale" = float4( @detailScaleX@ * imageWidth( "$colorMap$" ) / imageWidth( "$detailMap$" ), @detailScaleY@ * imageHeight( "$colorMap$" ) / imageHeight( "$detailMap$" ), @detailScaleHeight@, 0 ); #endif #if USE_SPEC_MAP #if @envMapMin@ > @envMapMax@ #error "Minimum reflectance greater than maximum reflectance" #endif #define SUN_INTENSITY 2.5 "envMapParms" = float4( @envMapMin@ * 4, (@envMapMax@ - @envMapMin@) * 4, @envMapExponent@ * -1.7, SUN_INTENSITY * 0.25 ); #if USE_SPEC_DETAIL_MAP "specDetailScale" = float4( @specDetailScaleX@ * imageWidth( "$specDetailMap$" ) / imageWidth( "$specDetailMap$" ), @specDetailScaleY@ * imageHeight( "$specDetailMap$" ) / imageHeight( "$specDetailMap$" ), 0, 0 ); #endif #endif "colorTint" = float4( @,colorTint@ ); "cwWetColor" = float4(@cg00_x@,@cg00_y@,@cg00_z@,@cg00_w@); "cwWaterLevelHeight" = float1(@cg01_x@); "cwWetSpecularity" = float1(@cg01_y@); "cwEnvMapParms" = float4( @cg01_z@ * 4, (@cg01_w@ - @cg01_z@) * 4, @cg02_x@ * -1.7, SUN_INTENSITY * 0.25 ); "cwWetnessInvert" = float1(@wetnessInvert@); } allocReflectionProbe(); refImage( "$colorMap$" );