Jump to content
  • Advertisement
Sign in to follow this  
J.O.Y

Question for vertex shader stage and effect from file

This topic is 2513 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

[font=arial,helvetica,sans-serif]Hello all,

I'm studying [/font][font=arial, helvetica, sans-serif]

directx 10 in the book Introduction to 3D Game Programming with DirectX 10

[/font][color=#333333][font=arial, helvetica, sans-serif]

by Frank D. Luna. I'm really new and I don't get the way to use "effect from file". For example, I don't understand the uses of each function below:

[/font]

[color=#333333][font=Arial, Helvetica, sans-serif]


cbuffer cbPerObject
{
float4x4 gWVP;
};

[/font]
[color=#333333][font=Arial, Helvetica, sans-serif]

void VS(float3 iPosL : POSITION,
float4 iColor : COLOR,
out float4 oPosH : SV_POSITION,
out float4 oColor : COLOR)
{
// Transform to homogeneous clip space.
oPosH = mul(float4(iPosL, 1.0f), gWVP);

// Just pass vertex color into the pixel shader.
oColor = iColor;
}

[/font]
[color=#333333][font=Arial, Helvetica, sans-serif]

float4 PS(float4 posH : SV_POSITION,
float4 color : COLOR) : SV_Target
{
return color;
}

[/font]
[color=#333333][font=Arial, Helvetica, sans-serif]

technique10 ColorTech
{
pass P0
{
SetVertexShader( CompileShader( vs_4_0, VS() ) );
SetGeometryShader( NULL );
SetPixelShader( CompileShader( ps_4_0, PS() ) );
}
}
[/font]




[color=#333333][font=Arial, Helvetica, sans-serif]

Another question is in this book, chapter 5, e[/font]xercise 5 requires:




[color=#333333][font=Arial, Helvetica, sans-serif]

Modify the Colored Cube demo by applying the following transformation to each vertex in the vertex shader prior to transforming to world space:[/font]




[color=#333333][font=Arial, Helvetica, sans-serif]

iPosL.xy += 0.5f*sin(iPosL.x)*sin(3*gTime);[/font]



[color=#333333][font=Arial, Helvetica, sans-serif]

iPosL.z *= 0.6f + 0.4f*sin(2*gTime);[/font]




[color=#333333][font=Arial, Helvetica, sans-serif]

The gTime constant buffer variable corresponds to the current GameTimer::getGameTime() value. This will animate the vertices as a function of time by distorting them periodically with the sine function.[/font]


[/quote]

[font=arial,helvetica,sans-serif]I don't understand what is [/font][color=#333333][font=arial, helvetica, sans-serif]

vertex shader, its use and how to use it.

[/font]

[font=arial,helvetica,sans-serif][color=#333333]I also include the source in case you need it.[/font]



[color=#000000]www.mediafire.com/?n32geq2l3l43dcs


[color=#000000]Thanks,

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!