Game Development Community

Help TGEA creating a new shader

by Mark Joselli · in Technical Issues · 03/05/2008 (5:21 am) · 0 replies

Hello,

I Have the following vertex shader that i am trying to put on TGEA

#define IN_HLSL
#include "shdrConsts.h"

struct VS_INPUT
{
float4 Position : POSITION0;
float2 Texcoord : TEXCOORD0;
float3 Normal : NORMAL0;
float3 Binormal : BINORMAL0;
float3 Tangent : TANGENT0;

};

struct VS_OUTPUT
{
float4 Position : POSITION0;
float2 Texcoord : TEXCOORD0;
float3 ViewDirection : TEXCOORD1;
float3 LightDirection: TEXCOORD2;

};

VS_OUTPUT vs_main( VS_INPUT Input ,
float3 fvLightPosition :register(VC_LIGHT_POS1),
float3 fvEyePosition :register(VC_EYE_POS),
float4x4 matView,
float4x4 matViewProjection :register(VC_WORLD_PROJ))
{
VS_OUTPUT Output;

Output.Position = mul( Input.Position, matViewProjection );
Output.Texcoord = Input.Texcoord;

float3 fvObjectPosition = mul( Input.Position, matView );

float3 fvViewDirection = fvEyePosition - fvObjectPosition;
float3 fvLightDirection = fvLightPosition - fvObjectPosition;

float3 fvNormal = mul( Input.Normal, matView );
float3 fvBinormal = mul( Input.Binormal, matView );
float3 fvTangent = mul( Input.Tangent, matView );

Output.ViewDirection.x = dot( fvTangent, fvViewDirection );
Output.ViewDirection.y = dot( fvBinormal, fvViewDirection );
Output.ViewDirection.z = dot( fvNormal, fvViewDirection );

Output.LightDirection.x = dot( fvTangent, fvLightDirection );
Output.LightDirection.y = dot( fvBinormal, fvLightDirection );
Output.LightDirection.z = dot( fvNormal, fvLightDirection );

return( Output );

}


I have some doubts
-How do i get the matView (the view matrix) from the TGEA??
-Does the TGEA provide the float3 Normal : NORMAL0
and float3 Binormal : BINORMAL0
and float3 Tangent : TANGENT0 ???


Thanks

About the author

Recent Threads