// Default Shader // Restores all default DirectX 9 renderstates // (c)2003 Virtools // The Default Shader is not saved and thus cannot be modified. // This is for coherence reason (from one .cmo to another the default // rendering will always be the same). // Beneath you'll find the list of all Automatics parameters known by Virtools. // Even though they aren't used by the Default Shader, they appear here // to help you remember the Semantics syntax. #if 0 // Skip Below Parameters During Compilation of Default Shader //--- Automatic Parameters float4x4 world : World; // Object World Matrix float4x4 view : View; // View Matrix float4x4 projection : Projection; // Projection Matrix float4x4 worldView : WorldView; // World x View Matrix float4x4 viewProj : ViewProjection; // View x Proj. Matrix float4x4 wvp : WorldViewProjection; // World x View x Proj. Matrix float3 objPos : ObjectPos; // Object Position float3 oBjPos : Position; // Synonym float3 eyePos : EyePos; // Camera World Position float3 camPos : CamPos; // Synonym float3 wcp : WorldCameraPosition; // Synonym float3 wCP : World_Camera_Position; // Synonym float3 bbMax : BoundingBoxMax; // Bounding Box Maximum float3 bBMax : Local_BBox_Max; // Synonym float3 bBMAx : LocalBBoxMax; // Synonym float3 bbMin : BoundingBoxMin; // Bounding Box Minimum float3 bBMin : Local_BBox_Min; // Synonym float3 bBMIn : LocalBBoxMin; // Synonym float3 bbSize : BoundingBoxSize; // Bounding Box Size float3 bBSize : Local_BBox_Size; // Synonym float3 bbSIze : LocalBBoxSize; // Synonym float3 bbCenter : BoundingCenter; // Bounding Box Center float bsSize : BoundingSphereSize;// Bounding Sphere Size float bsMinR : BoundingSphereMin; // Bounding Sphere Minimum Radius float bsMaxR : BoundingSphereMax; // Bounding Sphere Maximum Radius int passCount : PassCount; // Shader's pass count int passIndex : PassIndex; // Current rendering pass index float4 diff : Diffuse; // Material's Diffuse Color float4 emis : Emissive; // Material's Emissive Color float4 spec : Specular; // Material's Specular Color float4 ambi : Ambient; // Material's Ambient Color float power : SpecularPower; // Material's Specular Power Value float pOwer : Power; // Synonym texture tex_ : Texture; // Material's Texture texture tex0 : Texture0; // Texture of Channel 0 texture tex1 : Texture1; // Texture of Channel 1 texture tex2 : Texture2; // Texture of Channel 2 texture tex3 : Texture3; // Texture of Channel 3 texture tex4 : Texture4; // Texture of Channel 4 texture tex5 : Texture5; // Texture of Channel 5 texture tex6 : Texture6; // Texture of Channel 6 texture tex7 : Texture7; // Texture of Channel 7 float2 texSize : TexelSize; // Texel Size of the last texture parsed in the shader float time : Time; // Time elapsed since play event (in sec) float lastTime : LastTime; // Last simulation time in seconds (in sec) float elapsedTime : ElapsedTime; // Last delta time (in sec) float3 posLight : NearestLight; // Nearest Light's Position float4x4 matLight : NearestLight; // Nearest Light's World Matrix float4 colLight : NearestLight; // Nearest Light's Color float rangeLight : NearestLight; // Nearest Light's Range int lightCount : NearestLight; // Number of active lights in the scene float randValue : Random; // Random number in range [0.0 - 1.0] float4 glbAmbient : GlobalAmbient;// Global ambient color float4x3 bones[1] : Bones; // Bones Matrices Array float4x3 boNes[1] : Joint; // Synonym float3x4 tBones[1] : TBones; // Transposed Bones Matrices Array float3x4 tBoNes[1] : TJoint; // Synonym float4x3 rBones[1] : RBones; // Index of the register where bones matrices will be copied float4x3 rBoNes[1] : RJoint; // Synonym float3x4 rTBones[1] : RTBones; // Index of the register where transposed bones matrices of the skinned character will be copied float3x4 rTBoNes[1] : RTJoint; // Synonym int boneCountPV : BonesPerVertex; // Maximum number of bones per vertex int boneCOuntPV : JointPerVertex; // Synonym //--- Inversed and Transposed Matrices float4x4 tWorld : TWorld; // Transposed Object World Matrix float4x4 tView : TView; // Transposed View Matrix float4x4 tProjection : TProjection; // Transposed Projection Matrix float4x4 tWorldView : TWorldView; // Transposed World x View Matrix float4x4 tViewProj : TViewProjection; // Transposed View x Proj. Matrix float4x4 tWvp : TWorldViewProjection;// Transposed World x View x Proj. Matrix float4x4 invWorld : Inv_World; // Inversed Object World Matrix float4x4 invWOrLd : IWorld; // Synonym float4x4 invWOrld : WorldI; // Synonym float4x4 invWORld : WorldInverse; // Synonym float4x4 invView : Inv_View; // Inversed View Matrix float4x4 invVIew : IView; // Synonym float4x4 invVIEw : ViewI; // Synonym float4x4 invVIEW : ViewInverse; // Synonym float4x4 invProjection : Inv_Projection; // Inversed Projection Matrix float4x4 invPrOjection : IProjection; // Synonym float4x4 invProJection : ProjectionI; // Synonym float4x4 invProjEction : ProjectionInverse; // Synonym float4x4 invWorldView : Inv_WorldView; // Inversed World x View Matrix float4x4 invWOrldView : IWorldView; // Synonym float4x4 invWoRldView : WorldViewI; // Synonym float4x4 invWorLdView : WorldViewInverse; // Synonym float4x4 invVIewProj : Inv_ViewProjection; // Inversed View x Proj. Matrix float4x4 invViEwProj : IViewProjection; // Synonym float4x4 invVieWProj : ViewProjectionI; // Synonym float4x4 invViewProj : ViewProjectionInverse; // Synonym float4x4 invWvp : Inv_WorldViewProjection; // Inversed World x View x Proj. Matrix float4x4 invWVp : IWorldViewProjection; // Synonym float4x4 invWvP : WorldViewProjectionI; // Synonym float4x4 invWVP : WorldViewProjectionInverse; // Synonym float4x4 invTWorld : Inv_TWorld; // Transposed Inversed Object World Matrix float4x4 invTWOrLd : ITWorld; // Synonym float4x4 invTWOrld : WorldIT; // Synonym float4x4 invTWORld : WorldInverseTranspose; // Synonym float4x4 invTView : Inv_TView; // Transposed Inversed View Matrix float4x4 invTVIew : ITView; // Synonym float4x4 invTViEw : ViewIT; // Synonym float4x4 invTVieW : ViewInverseTranspose; // Synonym float4x4 invTPrOjection: Inv_TProjection; // Transposed Inversed Projection Matrix float4x4 invTProJection: ITProjection; // Synonym float4x4 invTProjEction: ProjectionIT; // Synonym float4x4 invTProjeCtion: ProjectionInverseTranspose;// Synonym float4x4 invTWorldView : Inv_TWorldView; // Transposed Inversed World x View Matrix float4x4 invTWOrLdView : ITWorldView; // Synonym float4x4 invTWOrldView : WorldViewIT; // Synonym float4x4 invTWORldView : WorldViewInverseTranspose;// Synonym float4x4 invTViewProj : Inv_TViewProjection; // Transposed Inversed View x Proj. Matrix float4x4 invTVieWProj : ITViewProjection; // Synonym float4x4 invTViEwProj : ViewProjectionIT; // Synonym float4x4 invTViewPrOj : ViewProjectionInverseTranspose;// Synonym float4x4 invTWvp : Inv_TWorldViewProjection; // Transposed Inversed World x View x Proj. Matrix float4x4 invTWVp : ITWorldViewProjection; // Synonym float4x4 invTWvP : WorldViewProjectionIT; // Synonym float4x4 invTWVP : WorldViewProjectionInverseTranspose;// Synonym //--- Available Annotations float3 entPos ; // Exposed as a 3D Entity float3 entPOs ; // Synonym float3 entPoS ; // Synonym float3 litPos ; // Exposed as a Light float3 camPOs ; // Exposed as a Camera float4 pos4 ; // Exposed as a 4D vector float2 texSIze ; // Previous texture's texel size float3 localCamPos : CamPos ; // Camera's Position in Local Space float lightRange : NearestLight ;// Range of the 3th nearest light float3 lightPos : NearestLight ; // Position of the first light given by the 3D engine float4 lightCol : NearestLight ; // Color of the nearest light, of green if no light exist texture myTexture ; // Get texture named "brick" texture myTExture ; // Load texture "images/brick.jpg" texture myTeXture < string Function="WoodFct"; // Call function WoodFct() to build the texture string ResourceType="3D"; // Procedural texture type string Target="tx_1_0"; // Procedural texture profile int Width=64; // Procedural texture width int Height=64; // Procedural texture height int Depth=64; // Procedural texture depth float4 Dimensions={64,64,64,0};// Procedural texture dimensions string Format="A8R8G8B8"; // Procedural texture format int MipLevels=0; // Procedural texture mipmap levels >; float myValue < float UIMin=5; float UIMax=10;>; // Exposed as a float slider technique t < bool NeedTangentSpace = true; // Force tangent space to be built bool NeedColorAndNormal= true; // Send Color and Normals to the stream > { pass p { } } #endif // Use the code below as a reference to common states. // If a shader does not modify a state then the state // will remain to its initial value defined below. static const float4x4 id4x4 = { {1, 0, 0, 0}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 1} }; technique Default { pass Restore { //--------------------------------------------------------------------- // Transform states // WorldTransform, ViewTransform, ProjectionTransform are automatically // set from within Virtools 3d engine. //--------------------------------------------------------------------- //--------------------------------------------------------------------- // Light states // // Warning: With LightEnable[n] = false, the compiler skips all other // light states. So even if the default light state LightRange is set to // 1000, it will be 0 ! // That is why you must explicitly set light state in order to see light // shine. Do not forget to set: // - LightEnable[0] = true; // - LightAttenuation0[0] = greater than 0 (like 1); // - LightDiffuse[0] = non-black color; // - LightRange[0] = greater than 0 (like 1000); //--------------------------------------------------------------------- LightEnable[0] = false; LightAmbient[0] = {0, 0, 0, 0}; LightAttenuation0[0] = 0; LightAttenuation1[0] = 0; LightAttenuation2[0] = 0; LightDiffuse[0] = {0, 0, 0, 0}; LightDirection[0] = {0, 0, 1}; LightFalloff[0] = 1.0; LightPhi[0] = 0; LightPosition[0] = {0, 0, 0}; LightRange[0] = 0; LightSpecular[0] = {0, 0, 0}; LightTheta[0] = 0; LightType[0] = DIRECTIONAL; //--------------------------------------------------------------------- // Material states //--------------------------------------------------------------------- MaterialAmbient = {0, 0, 0, 0}; MaterialDiffuse = {0, 0, 0, 0}; MaterialEmissive = {0, 0, 0, 0}; MaterialPower = 0; MaterialSpecular = {0, 0, 0, 0}; //--------------------------------------------------------------------- // Renderstates/Vertex Pipeline //--------------------------------------------------------------------- Ambient = {0, 0, 0, 0}; AmbientMaterialSource = MATERIAL; Clipping = false; ClipPlaneEnable = 0; ColorVertex = false; CullMode = CCW; DiffuseMaterialSource = COLOR1; EmissiveMaterialSource = MATERIAL; FogColor = {0, 0, 0 ,0}; FogDensity = 1.0; FogEnable = false; FogEnd = 1.0; FogStart = 0; FogTableMode = NONE; FogVertexMode = NONE; IndexedVertexBlendEnable = false; Lighting = true; LocalViewer = true; MultiSampleAntialias = true; MultiSampleMask = 0xFFFFFFFF; NormalizeNormals = false; PatchSegments = 0; PointScale_A = 1.0; PointScale_B = 0; PointScale_C = 0; PointScaleEnable = false; PointSize = 1.0; PointSize_Min = 1.0; PointSize_Max = 64.0; PointSpriteEnable = false; RangeFogEnable = 0; SpecularEnable = false; SpecularMaterialSource = COLOR2; TweenFactor = 0; VertexBlend = DISABLE; //--------------------------------------------------------------------- // Renderstates/Pixel Pipeline //--------------------------------------------------------------------- AlphaBlendEnable = false; AlphaFunc = ALWAYS; AlphaRef = 0; AlphaTestEnable = false; BlendOp = ADD; ColorWriteEnable = RED | GREEN | BLUE | ALPHA; DepthBias = 0; DestBlend = ZERO; DitherEnable = false; FillMode = SOLID; LastPixel = true; ShadeMode = GOURAUD; SrcBlend = ONE; StencilEnable = false; StencilFail = KEEP; StencilFunc = ALWAYS; StencilMask = 0xFFFFFFFF; StencilPass = KEEP; StencilRef = 0; StencilWriteMask = 0xFFFFFFFF; StencilZFail = KEEP; TextureFactor = 0xFFFFFFFF; Wrap0 = 0; Wrap1 = 0; Wrap2 = 0; Wrap3 = 0; Wrap4 = 0; Wrap5 = 0; Wrap6 = 0; Wrap7 = 0; Wrap8 = 0; Wrap9 = 0; Wrap10 = 0; Wrap11 = 0; Wrap12 = 0; Wrap13 = 0; Wrap14 = 0; Wrap15 = 0; ZEnable = true; ZFunc = LESSEQUAL; ZWriteEnable = true; //--------------------------------------------------------------------- // Sample states //--------------------------------------------------------------------- AddressU[0] = WRAP; AddressV[0] = WRAP; AddressW[0] = WRAP; BorderColor[0] = {0, 0, 0, 0}; MagFilter[0] = LINEAR; MaxAnisotropy[0] = 1; MaxMipLevel[0] = 0; MinFilter[0] = LINEAR; MipFilter[0] = POINT; MipMapLodBias[0] = 0; SRGBTexture[0] = 0; //--------------------------------------------------------------------- // Shaders // PixelShaderConstants and VertexShaderConstants are unchanged //--------------------------------------------------------------------- VertexShader = NULL; PixelShader = NULL; //--------------------------------------------------------------------- // Texture states/Textures //--------------------------------------------------------------------- Texture[0] = NULL; Texture[1] = NULL; Texture[2] = NULL; Texture[3] = NULL; Texture[4] = NULL; Texture[5] = NULL; Texture[6] = NULL; Texture[7] = NULL; //--------------------------------------------------------------------- // Texture states/Texture stages //--------------------------------------------------------------------- AlphaOp[0] = SELECTARG1; AlphaArg0[0] = CURRENT; AlphaArg1[0] = TEXTURE; AlphaArg2[0] = CURRENT; ColorOp[0] = MODULATE; ColorArg0[0] = CURRENT; ColorArg1[0] = TEXTURE; ColorArg2[0] = CURRENT; BumpEnvLScale[0] = 0; BumpEnvLOffset[0] = 0; BumpEnvMat00[0] = 0; BumpEnvMat01[0] = 0; BumpEnvMat10[0] = 0; BumpEnvMat11[0] = 0; ResultArg[0] = CURRENT; AlphaOp[1] = DISABLE; ColorOp[1] = DISABLE; AlphaOp[2] = DISABLE; ColorOp[2] = DISABLE; AlphaOp[3] = DISABLE; ColorOp[3] = DISABLE; AlphaOp[4] = DISABLE; ColorOp[4] = DISABLE; //--------------------------------------------------------------------- // Texture states/Texture coordinates //--------------------------------------------------------------------- TexCoordIndex[0] = 0; TextureTransformFlags[0] = DISABLE; TextureTransform[0] = ; TexCoordIndex[1] = 1; TextureTransformFlags[1] = DISABLE; TextureTransform[1] = ; TexCoordIndex[2] = 2; TextureTransformFlags[2] = DISABLE; TextureTransform[2] = ; TexCoordIndex[3] = 3; TextureTransformFlags[3] = DISABLE; TextureTransform[3] = ; TexCoordIndex[4] = 4; TextureTransformFlags[4] = DISABLE; TextureTransform[4] = ; TexCoordIndex[5] = 5; TextureTransformFlags[5] = DISABLE; TextureTransform[5] = ; TexCoordIndex[6] = 6; TextureTransformFlags[6] = DISABLE; TextureTransform[6] = ; TexCoordIndex[7] = 7; TextureTransformFlags[7] = DISABLE; TextureTransform[7] = ; } }