Jump to content

Vertex Shader Code.............


postaldudeleo

Recommended Posts

Weeeeeeeeeeeeeeeee here it is.........

 

_________________________________________________________________________

 

#include "globals"

 

 

//---------------------------------------------------------------------------------

//Static constants

//---------------------------------------------------------------------------------

 

float FurLength_ID7 = 1.869998; //no comments

float FurDensity_ID8 = 3; //no comments

float4 DiffuseColor_ID9 = {0.6, 0.4, 0.2, 1}; //no comments

float4 SpecularColor_ID9 = {0.7, 0.6, 0.4, 1}; //no comments

float Power_ID9 = 10; //no comments

float Dullness_ID9 = 4; //no comments

 

 

//---------------------------------------------------------------------------------

//Dynamic constants

//---------------------------------------------------------------------------------

 

float4x4 Projection_ID5 : SEM_MATRIX_VIEWPROJECTION; //no comments

int PassIndex_ID6 : SEM_INT_RENDERINGPASS_INDEX; //no comments

int PassCount_ID6 : SEM_INT_RENDERINGPASS_COUNT; //no comments

float4 Camera_Position_ID9 : SEM_VECTOR_CAMERA_POSITION; //no comments

int PassIndex_ID9 : SEM_INT_RENDERINGPASS_INDEX; //no comments

int PassCount_ID9 : SEM_INT_RENDERINGPASS_COUNT; //no comments

 

 

//---------------------------------------------------------------------------------

//Functions

//---------------------------------------------------------------------------------

 

//Function (Block FID7)

 

float4 Transform_FID7(float4x4 Projection, int PassIndex, int PassCount, float4 Vertex_Position, float4 Vertex_Normal, float FurLength)

{

Vertex_Position.xyz += Vertex_Normal.xyz * ( ((float)PassIndex-1) / (float)PassCount ) * FurLength;

 

return mul(Vertex_Position, Projection);

 

 

 

 

 

}

 

//Function (Block FID8)

 

float4 Multiply_FID8(float4 Vector, float FurDensity)

{

return Vector * FurDensity;

}

 

//Function (Block FID9)

 

float4 Anisotropic_FID9(float4 Vertex_Position, float4 Vertex_Normal, float4 Vertex_Tangent, float4 Vertex_Binormal, float4 Camera_Position, float4 DiffuseColor, float4 SpecularColor, float Power, float Dullness, int PassIndex, int PassCount)

{

float3 E = normalize( Camera_Position.xyz - Vertex_Position.xyz);

 

// Anisotropic lighting

float cs = dot(Vertex_Tangent.xyz, normalize(Vertex_Position));

float sn = sqrt(1 - cs * cs);

float cl = dot(Vertex_Binormal.xyz, E);

float sl = sqrt(1 - cl * cl);

 

// Diffuse intensity

float4 Intensity = abs(dot(E, Vertex_Normal.xyz));

 

// Output the results

float3 Specular = SpecularColor * pow(saturate(cs * cl + sn * sl), Power);

float3 Diffuse = DiffuseColor * pow(Intensity, 1/Dullness);

 

float Ratio = 1 - ( ( (float)PassIndex-1 ) / (float)PassCount );

 

return float4( Diffuse.rgb + Specular.rgb, Ratio*Ratio*Ratio);

 

}

 

 

//---------------------------------------------------------------------------------

//Input

//---------------------------------------------------------------------------------

 

struct INPUT

{

float3 Vertex_Position : POSITION; //no comments

float3 Vertex_Normal : NORMAL; //no comments

float3 Vertex_Tangent : TANGENT; //no comments

float3 Vertex_Binormal : BINORMAL; //no comments

float2 Vertex_TexCoord0 : TEXCOORD0; //no comments

};

 

 

//---------------------------------------------------------------------------------

//Output

//---------------------------------------------------------------------------------

 

struct OUTPUT

{

float4 oPosition : POSITION; //no comments

float4 TC2_TexCoord : TEXCOORD2; //no comments

float4 TC0_Lighting : TEXCOORD0; //no comments

};

 

 

//---------------------------------------------------------------------------------

//Shader entry

//---------------------------------------------------------------------------------

 

OUTPUT Shader(INPUT In)

{

OUTPUT Out = (OUTPUT)0;

 

 

//Block level

 

float4 Vertex_Position_ID7 = float4(In.Vertex_Position, 1);

float4 Vertex_Normal_ID7 = float4(In.Vertex_Normal, 1);

float4 Vector_ID8 = float4(In.Vertex_TexCoord0, 0, 0);

float4 Vertex_Position_ID9 = float4(In.Vertex_Position, 1);

float4 Vertex_Normal_ID9 = float4(In.Vertex_Normal, 1);

float4 Vertex_Tangent_ID9 = float4(In.Vertex_Tangent, 1);

float4 Vertex_Binormal_ID9 = float4(In.Vertex_Binormal, 1);

 

float4 oPosition_ID7 = Transform_FID7(Projection_ID5, PassIndex_ID6, PassCount_ID6, Vertex_Position_ID7, Vertex_Normal_ID7, FurLength_ID7);

float4 Result_ID8 = Multiply_FID8(Vector_ID8, FurDensity_ID8);

float4 Lighting_ID9 = Anisotropic_FID9(Vertex_Position_ID9, Vertex_Normal_ID9, Vertex_Tangent_ID9, Vertex_Binormal_ID9, Camera_Position_ID9, DiffuseColor_ID9, SpecularColor_ID9, Power_ID9, Dullness_ID9, PassIndex_ID9, PassCount_ID9);

 

//Block level

 

Out.oPosition = oPosition_ID7;

Out.TC2_TexCoord = Result_ID8;

Out.TC0_Lighting = Lighting_ID9;

 

return Out;

}

 

_________________________________________________________________________

 

 

So thats the code I made, problem is that this code does not work with nvidia as they

redid their software code to fit how they want it............

 

Work so far,

1.Got texture

2. Got Shader

3. Got no way to compile into .fx :(

 

Anyone have any suggestions on what program to use to compile this? or then agian I can wait a month for the dudes at shaderworks to release thier finished compiler plugin............

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...