Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

hey

 

im tryin to learn HLSL(high level shader language)

i just have a bunch of doubts:

 

1) float4 Pos : POSITION <-- why do u need a ": POSITION" cant you just say POSITION Pos; ?

 

2)

pass P0

{

CullMode = None;

 

// shaders

VertexShader = compile vs_1_1 Transform();

PixelShader = NULL;

}

 

what's the purpose of a pass?.. why cant u just have a technique there

 

3)

float4x4 WorldViewProj : WORLDVIEWPROJECTION;

float Time = 1.0f;

 

what's the difference between:

float4, float4x4,.. well i know float ;p

 

4) last question:

 

struct VS_OUTPUT

{

float4 pos : POSITION;

float4 diff : COLOR0;

};

VS_OUTPUT Out = (VS_OUTPUT)0;

 

.. how dose that syntax of the last line work? why would you take "0" and convert it to a VS_OUTPUT type?

 

---

 

i used the book Managed DirectX9 Kickstart: Games and Graphics Programming

so if the code looks familiar... yeah :)

 

 

if you can help, heh, thanks

pent

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Posted

Well heres as far as i can tell

 

1) I dont know why you cant say POSITION pos, but if i remember correctly the : POSITION tells it to use the information that your vertexdeclaration defines as POSITION if you add a number say POSITION1 that would be position with a usage of 1 should i remember correctly.

2) a pass is well a pass (say you wanted to render the object normally (pass 0) then go over the whole thing again and render with a glow effect (pass 1) then maybe a fire effect (dont ask why but none the less pass 2) well you get the idea a technique can call multiple passes..

3)float4 is roughly equivalent to a vector4 (its 4 float variables you can access as either .x,.y.z,.w or if im not mistaken .a,.r.g.b) a float4x4 on the other hand is more like a matrix (a 4x4 matrix at that). and im not sure exactly how you access each of the variables here though.

4)im gonna have to say im not sure here at all, because well im not.

Anyways i hopes this helps a bit.

Posted

thanks :)

 

a couple of questions about your reply:

"POSITION1 that would be position with a usage of 1 should i remember correctly."

whats a usage of 1?

 

and uhh - if you program in C#, a : is the same as Inherits or Implements, does it have the same meaning here?

 

once again, thanks

pent

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Posted
thanks :)

 

a couple of questions about your reply:

"POSITION1 that would be position with a usage of 1 should i remember correctly."

whats a usage of 1?

 

and uhh - if you program in C#, a : is the same as Inherits or Implements, does it have the same meaning here?

 

once again, thanks

pent

 

As far as i can tell : is not inheritance/implementation (yes i now code in c#), the usage allows you to pass multiple of the same value type, like lets say a vertex has 2 texture coordinants (usage 0 and 1)...

EDIT that would be for say 2 textures (aka compleatly different coordinants just to be clear).

Posted

VS_OUTPUT Out = (VS_OUTPUT)0;

HLSL?

 

Is this a C++ Flavor/Library?

 

I don't do Game programming but by the looks of this, from my experience with C++, I assume it is declaring a variable of type VS_OUTPUT in the immediate scope of said type and initializing it to NULL.

 

but I could be wrong.

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted

HLSL is... well its hard to explain ..

ive heard explanations like "Programmable Function Pipeline" <-- HLSL vs "Fixed Function Pipeline", its a different way of rendering objects and manipulating them and stuff

 

yeah i think you're right about VS_OUTPUT Out = (VS_OUTPUT)0;

i think it initializes the variables in that struct to their default values or somethin

 

pent

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...