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

Featured Threads
  inspiration alert!!!
(36 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies) Members Gallery
(516 replies)
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

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 338 times
2/16/2016 6:28:18 PM (last edit: 2/16/2016 8:07:23 PM)
#Maxforums IRC
Open chat window