= {0.15f, 0.15f, 0.15f, 1.0}; float4 emissiveMaterial : Emissive < string UIWidget = "Color"; string Space = "material";> = {0.1, 0.1, 0.1, 1.0}; float4 specularMaterial : Specular < string UIWidget = "Color"; string Space = "material";> = {0.0, 0.0, 0.0, 1.0}; float4 diffuseMaterial : Diffuse < string UIWidget = "Color"; string Space = "material";> = {1.0, 1.0, 1.0, 1.0}; float powerMaterial : SpecularPower = 50.0; bool alphaBlendEnable = false; bool localViewerEnable = true; texture diffuseTexture : Diffuse < string ResourceName = "default_color.dds"; >; // Lights // Point lights //0 bool pointlight0Enable < > = true; float3 pointlight0Position : Position < string Object ="PointLight"; string Space = "DeviceLightSpace"; > = { 0.0f, 0.0f, -10.0f }; float4 pointlight0Diffuse : Diffuse < string Object ="PointLight"; > = { 1.0f, 1.0f, 1.0f, 1.0f }; float4 pointlight0Specular : Specular < string Object ="PointLight"; > = { .2f, .2f, .2f, 1.0f }; //1 bool pointlight1Enable < > = true; float3 pointlight1Position : Position < string Object ="PointLight"; string Space = "DeviceLightSpace"; >; float4 pointlight1Diffuse : Diffuse < string Object ="PointLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float4 pointlight1Specular : Specular < string Object ="PointLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; //2 bool pointlight2Enable < > = true; float3 pointlight2Position : Position < string Object ="PointLight"; string Space = "DeviceLightSpace"; >; float4 pointlight2Diffuse : Diffuse < string Object ="PointLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float4 pointlight2Specular : Specular < string Object ="PointLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; // Spotlights //0 bool spotlight0Enable < > = true; float3 spotlight0Position : Position < string Object ="SpotLight"; string Space = "DeviceLightSpace"; >; float3 spotlight0Direction : Direction < string Object ="SpotLight"; string Space = "DeviceLightSpace"; > = {1.0f, 0.0f, 0.0f}; float4 spotlight0Diffuse : Diffuse < string Object ="SpotLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float4 spotlight0Specular : Specular < string Object ="SpotLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float spotlight0Penumbra : LightPenumbra < string Object ="SpotLight"; > = 0.0f; float spotlight0Umbra : LightUmbra < string Object ="SpotLight"; > = 0.0f; float spotlight0Falloff : LightFalloff < string Object ="SpotLight"; > = 1.0f; //1 bool spotlight1Enable < > = true; float3 spotlight1Position : Position < string Object ="SpotLight"; string Space = "DeviceLightSpace"; >; float3 spotlight1Direction : Direction < string Object ="SpotLight"; string Space = "DeviceLightSpace"; > = {1.0f, 0.0f, 0.0f}; float4 spotlight1Diffuse : Diffuse < string Object ="SpotLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float4 spotlight1Specular : Specular < string Object ="SpotLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float spotlight1Penumbra : LightPenumbra < string Object ="SpotLight"; > = 0.0f; float spotlight1Umbra : LightUmbra < string Object ="SpotLight"; > = 0.0f; float spotlight1Falloff : LightFalloff < string Object ="SpotLight"; > = 1.0f; //2 bool spotlight2Enable < > = true; float3 spotlight2Position : Position < string Object ="SpotLight"; string Space = "DeviceLightSpace"; >; float3 spotlight2Direction : Direction < string Object ="SpotLight"; string Space = "DeviceLightSpace"; > = {1.0f, 0.0f, 0.0f}; float4 spotlight2Diffuse : Diffuse < string Object ="SpotLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float4 spotlight2Specular : Specular < string Object ="SpotLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float spotlight2Penumbra : LightPenumbra < string Object ="SpotLight"; > = 0.0f; float spotlight2Umbra : LightUmbra < string Object ="SpotLight"; > = 0.0f; float spotlight2Falloff : LightFalloff < string Object ="SpotLight"; > = 1.0f; //3 bool spotlight3Enable < > = true; float3 spotlight3Position : Position < string Object ="SpotLight"; string Space = "DeviceLightSpace"; >; float3 spotlight3Direction : Direction < string Object ="SpotLight"; string Space = "DeviceLightSpace"; > = {1.0f, 0.0f, 0.0f}; float4 spotlight3Diffuse : Diffuse < string Object ="SpotLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float4 spotlight3Specular : Specular < string Object ="SpotLight"; > = {0.0f, 0.0f, 0.0f, 0.0f}; float spotlight3Penumbra : LightPenumbra < string Object ="SpotLight"; > = 0.0f; float spotlight3Umbra : LightUmbra < string Object ="SpotLight"; > = 0.0f; float spotlight3Falloff : LightFalloff < string Object ="SpotLight"; > = 1.0f; technique textured { pass p0 { Texture[0] = ; MinFilter[0] = Linear; MagFilter[0] = Linear; MipFilter[0] = Linear; MaterialDiffuse = ; MaterialSpecular = ; MaterialAmbient = ; MaterialEmissive = ; MaterialPower = ; // 3 Point lights LightAttenuation0[0] = 1.0f; LightAttenuation1[0] = 0.0f; LightAttenuation2[0] = 0.0f; LightType[0] = Point; LightDiffuse[0] = ; LightSpecular[0] = ; LightAmbient[0] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[0] = ; LightRange[0] = 100000.0f; LightEnable[0] = ; LightAttenuation0[1] = 1.0f; LightAttenuation1[1] = 0.0f; LightAttenuation2[1] = 0.0f; LightType[1] = Point; LightDiffuse[1] = ; LightSpecular[1] = ; LightAmbient[1] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[1] = ; LightRange[1] = 100000.0f; LightEnable[1] = ; LightAttenuation0[2] = 1.0f; LightAttenuation1[2] = 0.0f; LightAttenuation2[2] = 0.0f; LightType[2] = Point; LightDiffuse[2] = ; LightSpecular[2] = ; LightAmbient[2] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[2] = ; LightRange[2] = 100000.0f; LightEnable[2] = ; // 4 Spot lights LightAttenuation0[3] = 1.0f; LightAttenuation1[3] = 0.0f; LightAttenuation2[3] = 0.0f; LightPhi[3] = ; LightTheta[3] = ; LightType[3] = Spot; LightDiffuse[3] = ; LightSpecular[3] = ; LightAmbient[3] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[3] = ; LightDirection[3] = ; LightRange[3] = 100000.0f; LightFalloff[3] = ; LightEnable[3] = ; LightAttenuation0[4] = 1.0f; LightAttenuation1[4] = 0.0f; LightAttenuation2[4] = 0.0f; LightPhi[4] = ; LightTheta[4] = ; LightType[4] = Spot; LightDiffuse[4] = ; LightSpecular[4] = ; LightAmbient[4] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[4] = ; LightDirection[4] = ; LightRange[4] = 100000.0f; LightFalloff[4] = ; LightEnable[4] = ; LightAttenuation0[5] = 1.0f; LightAttenuation1[5] = 0.0f; LightAttenuation2[5] = 0.0f; LightPhi[5] = ; LightTheta[5] = ; LightType[5] = Spot; LightDiffuse[5] = ; LightSpecular[5] = ; LightAmbient[5] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[5] = ; LightDirection[5] = ; LightRange[5] = 100000.0f; LightFalloff[5] = ; LightEnable[5] = ; LightAttenuation0[6] = 1.0f; LightAttenuation1[6] = 0.0f; LightAttenuation2[6] = 0.0f; LightPhi[6] = ; LightTheta[6] = ; LightType[6] = Spot; LightDiffuse[6] = ; LightSpecular[6] = ; LightAmbient[6] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[6] = ; LightDirection[6] = ; LightRange[6] = 100000.0f; LightFalloff[6] = ; LightEnable[6] = ; // Enable lighting and turn light 0 on. Lighting = true; LocalViewer = ; ZEnable = true; ZWriteEnable = true; DiffuseMaterialSource = Material; SpecularMaterialSource = Material; AmbientMaterialSource = Material; EmissiveMaterialSource = Material; // Assign diffuse color to be used ColorOp[0] = Modulate; ColorArg1[0] = Texture; ColorArg2[0] = Diffuse; AlphaOp[0] = SelectArg2; AlphaArg1[0] = Texture; AlphaArg2[0] = Diffuse; AlphaBlendEnable = ; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; SpecularEnable = true; CullMode = None; NormalizeNormals = true; } } technique diffuse { pass p0 { MaterialDiffuse = ; MaterialSpecular = ; MaterialAmbient = ; MaterialEmissive = ; MaterialPower = ; // 3 Point lights LightAttenuation0[0] = 1.0f; LightAttenuation1[0] = 0.0f; LightAttenuation2[0] = 0.0f; LightType[0] = Point; LightDiffuse[0] = ; LightSpecular[0] = ; LightAmbient[0] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[0] = ; LightRange[0] = 100000.0f; LightEnable[0] = ; LightAttenuation0[1] = 1.0f; LightAttenuation1[1] = 0.0f; LightAttenuation2[1] = 0.0f; LightType[1] = Point; LightDiffuse[1] = ; LightSpecular[1] = ; LightAmbient[1] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[1] = ; LightRange[1] = 100000.0f; LightEnable[1] = ; LightAttenuation0[2] = 1.0f; LightAttenuation1[2] = 0.0f; LightAttenuation2[2] = 0.0f; LightType[2] = Point; LightDiffuse[2] = ; LightSpecular[2] = ; LightAmbient[2] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[2] = ; LightRange[2] = 100000.0f; LightEnable[2] = ; // 4 Spot lights LightAttenuation0[3] = 1.0f; LightAttenuation1[3] = 0.0f; LightAttenuation2[3] = 0.0f; LightPhi[3] = ; LightTheta[3] = ; LightType[3] = Spot; LightDiffuse[3] = ; LightSpecular[3] = ; LightAmbient[3] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[3] = ; LightDirection[3] = ; LightRange[3] = 100000.0f; LightFalloff[3] = ; LightEnable[3] = ; LightAttenuation0[4] = 1.0f; LightAttenuation1[4] = 0.0f; LightAttenuation2[4] = 0.0f; LightPhi[4] = ; LightTheta[4] = ; LightType[4] = Spot; LightDiffuse[4] = ; LightSpecular[4] = ; LightAmbient[4] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[4] = ; LightDirection[4] = ; LightRange[4] = 100000.0f; LightFalloff[4] = ; LightEnable[4] = ; LightAttenuation0[5] = 1.0f; LightAttenuation1[5] = 0.0f; LightAttenuation2[5] = 0.0f; LightPhi[5] = ; LightTheta[5] = ; LightType[5] = Spot; LightDiffuse[5] = ; LightSpecular[5] = ; LightAmbient[5] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[5] = ; LightDirection[5] = ; LightRange[5] = 100000.0f; LightFalloff[5] = ; LightEnable[5] = ; LightAttenuation0[6] = 1.0f; LightAttenuation1[6] = 0.0f; LightAttenuation2[6] = 0.0f; LightPhi[6] = ; LightTheta[6] = ; LightType[6] = Spot; LightDiffuse[6] = ; LightSpecular[6] = ; LightAmbient[6] = {0.0f,0.0f,0.0f,0.0f}; LightPosition[6] = ; LightDirection[6] = ; LightRange[6] = 100000.0f; LightFalloff[6] = ; LightEnable[6] = ; // Enable lighting and turn light 0 on. Lighting = true; LocalViewer = ; ZEnable = true; ZWriteEnable = true; DiffuseMaterialSource = Material; SpecularMaterialSource = Material; AmbientMaterialSource = Material; EmissiveMaterialSource = Material; // Assign diffuse color to be used ColorOp[0] = SelectArg2; ColorArg1[0] = Texture; ColorArg2[0] = Diffuse; AlphaOp[0] = SelectArg2; AlphaArg1[0] = Texture; AlphaArg2[0] = Diffuse; AlphaBlendEnable = ; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; SpecularEnable = true; CullMode = None; NormalizeNormals = true; } } ]]> float Script : STANDARDSGLOBAL < string UIWidget = "none"; string ScriptClass = "scene"; string ScriptOrder = "preprocess"; string ScriptOutput = "color"; string Script = "Technique=TexBg;"; > = 0.8; // version # float ClearDepth = 1.0; float Timer : TIME < string UIWidget="noine";>; float BgSpeed < string UIName = "Bg Speed"; string UIWidget = "slider"; float UIMin = -0.1; float UIMax = 0.1; float UIStep = 0.001; > = 0.02f; static float BgOffset = (BgSpeed * Timer); float BgScale < string UIName = "Bg Horiz Scale"; string UIWidget = "slider"; float UIMin = 0.5; float UIMax = 16; float UIStep = 0.1; > = 1.0f; float MidSpeed < string UIName = "Midground Speed"; string UIWidget = "slider"; float UIMin = -0.3; float UIMax = 0.3; float UIStep = 0.001; > = 0.05f; static float MidOffset = (MidSpeed * Timer); float MidScale < string UIName = "Midground Horiz Scale"; string UIWidget = "slider"; float UIMin = 0.5; float UIMax = 16; float UIStep = 0.1; > = 1.0f; ///////// Textures /////////////// texture BgTexture < string ResourceName = "Veggie.dds"; string ResourceType = "2D"; string UIName = "Background Texture"; >; sampler2D BgSampler = sampler_state { Texture = ; MinFilter = Point; MagFilter = Point; MipFilter = None; }; texture MidTexture < string ResourceName = "Veggie.dds"; string ResourceType = "2D"; string UIName = "Midground Texture"; >; sampler2D MidSampler = sampler_state { Texture = ; MinFilter = Point; MagFilter = Point; MipFilter = None; }; /////////////// QuadVertexOutput ScrollQuadVS( QUAD_REAL3 Position : POSITION, QUAD_REAL3 TexCoord : TEXCOORD0, uniform float Offset, uniform float HorizScale ) { QuadVertexOutput OUT; OUT.Position = QUAD_REAL4(Position, 1); #ifdef NO_TEXEL_OFFSET OUT.UV = QUAD_REAL2(HorizScale,1)*TexCoord.xy + QUAD_REAL2(Offset,0); #else /* NO_TEXEL_OFFSET */ QUAD_REAL2 off = QUAD_REAL2(QuadTexOffset/(QuadScreenSize.x),QuadTexOffset/(QuadScreenSize.y)); OUT.UV = QUAD_REAL2((QUAD_REAL2(HorizScale,1))*TexCoord.xy+off) + QUAD_REAL2(Offset,0); #endif /* NO_TEXEL_OFFSET */ return OUT; } //////////////////////// technique TexBg < string Script = "ClearSetDepth=ClearDepth;" "Clear=Depth;" "Pass=Bg;" "Pass=Mid;" "ScriptExternal=Scene;"; > { pass Bg < string Script = "Draw=Buffer;"; > { VertexShader = compile vs_1_1 ScrollQuadVS(BgOffset,1.0/BgScale); AlphaBlendEnable = false; ZEnable = false; PixelShader = compile ps_1_1 TexQuadPS(BgSampler); } pass Mid < string Script = "Draw=Buffer;"; > { VertexShader = compile vs_1_1 ScrollQuadVS(MidOffset,1.0/MidScale); AlphaBlendEnable = true; SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; ZEnable = false; PixelShader = compile ps_1_1 TexQuadPS(MidSampler); } } /***************************** eof ***/ ]]>; \ sampler SampName = sampler_state { \ texture = ; \ AddressU = AddrMode; \ AddressV = AddrMode; \ MipFilter = LINEAR; \ MinFilter = LINEAR; \ MagFilter = LINEAR; \ }; // // Simple 2D File Textures // // example usage: FILE_TEXTURE_2D(GlowMap,GlowSampler,"myfile.dds") // #define FILE_TEXTURE_2D(TextureName,SamplerName,Diskfile) FILE_TEXTURE_2D_MODAL(TextureName,SamplerName,(Diskfile),WRAP) // // Use this variation of DECLARE_QUAD_TEX() if you want a *scaled* render target // // example usage: DECLARE_SIZED_QUAD_TEX(GlowMap,GlowSampler,"A8R8G8B8",1.0) #define DECLARE_SIZED_QUAD_TEX(TexName,SampName,PixFmt,Multiple) texture TexName : RENDERCOLORTARGET < \ float2 ViewPortRatio = {Multiple,Multiple}; \ int MipLevels = 1; \ string Format = PixFmt ; \ string UIWidget = "None"; \ >; \ sampler SampName = sampler_state { \ texture = ; \ AddressU = CLAMP; \ AddressV = CLAMP; \ MipFilter = POINT; \ MinFilter = LINEAR; \ MagFilter = LINEAR; \ }; // // Use this macro to easily declare typical color render targets // // example usage: DECLARE_QUAD_TEX(ObjMap,ObjSampler,"A8R8G8B8") #define DECLARE_QUAD_TEX(TextureName,SamplerName,PixelFormat) DECLARE_SIZED_QUAD_TEX(TextureName,SamplerName,(PixelFormat),1.0) // // Use this macro to easily declare variable-sized depth render targets // // example usage: DECLARE_SIZED_QUAD_DEPTH_BUFFER(DepthMap,"D24S8",0.5) #define DECLARE_SIZED_QUAD_DEPTH_BUFFER(TextureName,PixelFormat,Multiple) texture TextureName : RENDERDEPTHSTENCILTARGET < \ float2 ViewPortRatio = {Multiple,Multiple}; \ string Format = (PixelFormat); \ string UIWidget = "None"; \ >; // // Use this macro to easily declare typical depth render targets // // example usage: DECLARE_QUAD_DEPTH_BUFFER(DepthMap,"D24S8") #define DECLARE_QUAD_DEPTH_BUFFER(TexName,PixFmt) DECLARE_SIZED_QUAD_DEPTH_BUFFER(TexName,PixFmt,1.0) // // declare exact-sized arbitrary texture // // example usage: DECLARE_SIZED_TEX(BlahMap,BlahSampler,"R32F",128,1) #define DECLARE_SIZED_TEX(Tex,Samp,Fmt,Wd,Ht) texture Tex : RENDERCOLORTARGET < \ float2 Dimensions = { Wd, Ht }; \ string Format = Fmt ; \ string UIWidget = "None"; \ int miplevels=1;\ >; \ sampler Samp = sampler_state { \ texture = ; \ AddressU = CLAMP; \ AddressV = CLAMP; \ MipFilter = NONE; \ MinFilter = LINEAR; \ MagFilter = LINEAR; \ }; // // declare exact-sized square texture, as for shadow maps // // example usage: DECLARE_SQUARE_QUAD_TEX(ShadMap,ShadObjSampler,"A16R16G16B16F",512) #define DECLARE_SQUARE_QUAD_TEX(TexName,SampName,PixFmt,Size) DECLARE_SIZED_TEX(TexName,SampName,(PixFmt),Size,Size) // // likewise for shadow depth targets // // example usage: DECLARE_SQUARE_QUAD_DEPTH_BUFFER(ShadDepth,"D24S8",512) #define DECLARE_SQUARE_QUAD_DEPTH_BUFFER(TextureName,PixelFormat,Size) texture TextureName : RENDERDEPTHSTENCILTARGET < \ float2 Dimensions = { Size, Size }; \ string Format = (PixelFormat) ; \ string UIWidget = "None"; \ >; //////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////// Utility Functions //////// //////////////////////////////////////////////////////////////////////////// // // Scale inputs for use with texture-based lookup tables. A value ranging from zero to one needs // a slight scaling and offset to be sure to point at the centers of the first and last pixels // of that lookup texture. Pass the integer size of the table in TableSize // For now we'll assume that all tables are 1D, square, or cube-shaped -- all axes of equal size // // Cost of this operation for pixel shaders: two const-register // entries and a MAD (one cycle) QUAD_REAL scale_lookup(QUAD_REAL Value,const QUAD_REAL TableSize) { QUAD_REAL scale = ((TableSize - 1.0)/TableSize); QUAD_REAL shift = (0.5 / TableSize); return (scale*Value + shift); } QUAD_REAL2 scale_lookup(QUAD_REAL2 Value,const QUAD_REAL TableSize) { QUAD_REAL scale = ((TableSize - 1.0)/TableSize); QUAD_REAL shift = (0.5 / TableSize); return (scale.xx*Value + shift.xx); } QUAD_REAL3 scale_lookup(QUAD_REAL3 Value,const QUAD_REAL TableSize) { QUAD_REAL scale = ((TableSize - 1.0)/TableSize); QUAD_REAL shift = (0.5 / TableSize); return (scale.xxx*Value + shift.xxx); } // pre-multiply and un-pre-mutliply functions. The precision // of thse operatoions is often limited to 8-bit so don't // always count on them! // The macro value of NV_ALPHA_EPSILON, if defined, is used to // avoid IEEE "NaN" values that may occur when erroneously // dividing by a zero alpha (thanks to Pete Warden @ Apple // Computer for the suggestion in GPU GEMS II) // multiply color by alpha to turn an un-premultipied // pixel value into a premultiplied one QUAD_REAL4 premultiply(QUAD_REAL4 C) { return QUAD_REAL4((C.w*C.xyz),C.w); } #define NV_ALPHA_EPSILON 0.0001 // given a premultiplied pixel color, try to undo the premultiplication. // beware of precision errors QUAD_REAL4 unpremultiply(QUAD_REAL4 C) { #ifdef NV_ALPHA_EPSILON QUAD_REAL a = C.w + NV_ALPHA_EPSILON; return QUAD_REAL4((C.xyz / a),C.w); #else /* ! NV_ALPHA_EPSILON */ return QUAD_REAL4((C.xyz / C.w),C.w); #endif /* ! NV_ALPHA_EPSILON */ } ///////////////////////////////////////////////////////////////////////////////////// // Structure Declaration //////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// struct QuadVertexOutput { QUAD_REAL4 Position : POSITION; QUAD_REAL2 UV : TEXCOORD0; }; ///////////////////////////////////////////////////////////////////////////////////// // Hidden tweakables declared by this .fxh file ///////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////// #ifndef NO_TEXEL_OFFSET #ifdef TWEAKABLE_TEXEL_OFFSET QUAD_REAL QuadTexOffset = 0.5; #else /* !TWEAKABLE_TEXEL_OFFSET */ QUAD_REAL QuadTexOffset < string UIWidget="None"; > = 0.5; #endif /* !TWEAKABLE_TEXEL_OFFSET */ QUAD_REAL2 QuadScreenSize : VIEWPORTPIXELSIZE < string UIWidget="None"; >; #endif /* NO_TEXEL_OFFSET */ //////////////////////////////////////////////////////////// ////////////////////////////////// vertex shaders ////////// //////////////////////////////////////////////////////////// QuadVertexOutput ScreenQuadVS( QUAD_REAL3 Position : POSITION, QUAD_REAL3 TexCoord : TEXCOORD0 ) { QuadVertexOutput OUT; OUT.Position = QUAD_REAL4(Position, 1); #ifdef NO_TEXEL_OFFSET OUT.UV = TexCoord.xy; #else /* NO_TEXEL_OFFSET */ QUAD_REAL2 off = QUAD_REAL2(QuadTexOffset/(QuadScreenSize.x),QuadTexOffset/(QuadScreenSize.y)); OUT.UV = QUAD_REAL2(TexCoord.xy+off); #endif /* NO_TEXEL_OFFSET */ return OUT; } ////////////////////////////////////////////////////// ////////////////////////////////// pixel shaders ///// ////////////////////////////////////////////////////// // add glow on top of model QUAD_REAL4 TexQuadPS(QuadVertexOutput IN,uniform sampler2D InputSampler) : COLOR { QUAD_REAL4 texCol = tex2D(InputSampler, IN.UV); return texCol; } QUAD_REAL4 TexQuadBiasPS(QuadVertexOutput IN,uniform sampler2D InputSampler,QUAD_REAL TBias) : COLOR { QUAD_REAL4 texCol = tex2Dbias(InputSampler, QUAD_REAL4(IN.UV,0,TBias)); return texCol; } ////////////////////////////////////////////////////////////////// /// Macros to define passes within Techniques //////////////////// ////////////////////////////////////////////////////////////////// // older HLSL syntax #define TEX_TECH(TechName,SamplerName) technique TechName { \ pass TexturePass { \ VertexShader = compile vs_2_0 ScreenQuadVS(); \ AlphaBlendEnable = false; ZEnable = false; \ PixelShader = compile ps_2_a TexQuadPS(SamplerName); } } #define TEX_BLEND_TECH(TechName,SamplerName) technique TechName { \ pass TexturePass { \ VertexShader = compile vs_2_0 ScreenQuadVS(); \ ZEnable = false; AlphaBlendEnable = true; \ SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; \ PixelShader = compile ps_2_a TexQuadPS(SamplerName); } } // newer HLSL syntax #define TEX_TECH2(TechName,SamplerName,TargName) technique TechName { \ pass TexturePass < \ string ScriptFunction = "RenderColorTarget0=" (TargName) ";" \ "DrawInternal=Buffer;"; \ > { \ VertexShader = compile vs_2_0 ScreenQuadVS(); \ AlphaBlendEnable = false; ZEnable = false; \ PixelShader = compile ps_2_a TexQuadPS(SamplerName); } } #define TEX_BLEND_TECH2(TechName,SamplerName) technique TechName { \ pass TexturePass < \ string ScriptFunction = "RenderColorTarget0=" (TargName) ";" \ "DrawInternal=Buffer;"; \ > { \ VertexShader = compile vs_2_0 ScreenQuadVS(); \ ZEnable = false; AlphaBlendEnable = true; \ SrcBlend = SrcAlpha; DestBlend = InvSrcAlpha; \ PixelShader = compile ps_2_a TexQuadPS(SamplerName); } } #endif /* _QUAD_FXH */ ////////////// eof /// ]]>