/*********************************************************************NVMH3**** Path: NVSDK\Common\media\cgfx1.4 File: $Id: //sw/devtools/FXComposer2/Alpha4+/SDK/MEDIA/CgFX1.4/PureTexture.cgfx#1 $ Copyright NVIDIA Corporation 2003 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED *AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Comments: Just Show Me The Texture $Date: 2006/04/10 $ $Revision: #1 $ ******************************************************************************/ // string Category = "Effects\\Cg\\BRDF"; // string keywords = "texture"; string description = "Pure UV-Mapped Texture"; ////////////////////////////////////////////////////////// // tweakables //////////////////////////////////////////// ////////////////////////////////////////////////////////// float3 BaseColor : Ambient // declaration of "Ambient" is a Maya-related workaround < string UIHelp = "Base Color"; > = {1.0f, 1.0f, 1.0f}; ////////////////////////////////////////////////////////// // untweakables ////////////////////////////////////////// ////////////////////////////////////////////////////////// float4x4 WorldViewProjXf : WorldViewProjection < string UIWidget="none";>; /****************************************************/ /********** SAMPLERS ********************************/ /****************************************************/ texture ColorTex1 : Diffuse < string ResourceName = "default_color.dds"; string ResourceType = "2D"; >; sampler2D ColorSampler1 = sampler_state { Texture = ; MagFilter = Linear; MinFilter = LinearMipmapLinear; }; texture ColorTex2 : Ambient < string ResourceName = "NVDemon_COLOR.dds"; string ResourceType = "2D"; >; sampler2D ColorSampler2 = sampler_state { Texture = ; MagFilter = Linear; MinFilter = LinearMipmapLinear; }; /****************************************************/ /********** CG SHADER FUNCTIONS *********************/ /****************************************************/ /**************************************/ /***** SHARED STRUCT ******************/ /**** Data from app vertex buffer *****/ /**** for all passes *****/ /**************************************/ struct UVs { float2 UV1; float2 UV2; }; struct appdata { float3 Position : POSITION; float4 UVs : TEXCOORD0; }; /****************************************/ /****************************************/ // vertex->fragment registers used for this pass only struct outVertexData { float4 HPosition : POSITION; float2 UV1 : TEXCOORD0; float2 UV2 : TEXCOORD1; }; /****************************************/ /****************************************/ outVertexData textureVS(appdata IN) { outVertexData OUT; float4 Po = float4(IN.Position.xyz,1.0); OUT.HPosition = mul(WorldViewProjXf, Po); OUT.UV1 = IN.UVs.xy; OUT.UV2 = IN.UVs.zw; return OUT; } float4 texturePS(outVertexData IN) : COLOR { float4 map1 = tex2D(ColorSampler1,IN.UV1.xy); float4 map2 = tex2D(ColorSampler2,IN.UV2.xy); float4 surf = float4(BaseColor.xyz,1.0f); return (map1 * map2 * surf); } /****************************************************/ /********** TECHNIQUES ******************************/ /****************************************************/ technique main { pass p0 { VertexProgram = compile arbvp1 textureVS(); DepthTestEnable = true; DepthMask = true; CullFaceEnable = false; FragmentProgram = compile arbfp1 texturePS(); } } /***************************** eof ***/