Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Maxunderground news unavailable

structs, vertex input/vertex output
show user profile  digs
good afternoons

I was hoping to find some clarification on what exactly these are doing inside of a shader. I'm trying to better understand what happens when you pass off your shader to the gpu

so, something simple, we have

struct VS_INPUT
{ float4 mPosition : POSITION; };

struct VS_OUTPUT
{ float4 mPosition : POSITION; };

float4x4 gWorldMatrix;
float4x4 gViewMatrix;
float4x4 gProjectionMatrix;

VS_OUTPUT vs_main ( VS_INPUT Input )

Output.mPosition = mul(Input.mPosition, gWorldMatrix);
Output.mPosition = mul(Output.mPosition, gViewMatrix);
Output.mPosition = mul(Output.mPosition, gProjectionMatrix);

return Output;

my first question is about the input and output structs... I guess i'm not really sure whats happening here... I create a variable called mPosition in VS_INPUT, which I assign the POSITION semantic to.... so, the VS_INPUT struct looks at the object to which its applied, asks for vertex000001's position, and then completes the entire shader for vertex01 before moving on to the vertex0000002 and so on?

Im also not entirely sure why we need to create 'float4 mPosition' in both the input and output structs... coming from gameplay programming, i would expect to only create this variable once.
read 325 times
2/16/2016 6:28:18 PM (last edit: 2/16/2016 8:07:23 PM)
#Maxforums IRC
Open chat window