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

## Recommended Posts

float4x4 World;
float4x4 View;float4x4 Projection;

float4 AmbientColor = float4(1, 1, 1, 1);
float AmbientIntensity = 0.1;

{
float4 Position : POSITION0;
};

{
float4 Position : POSITION0;
};

{

float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);
output.Position = mul(viewPosition, Projection);

return output;
}

{
return AmbientColor * AmbientIntensity;
}

technique Ambient
{
pass Pass1
{
}
}

i am trying to learn how to use shaders with directx and i found this code over d net

icould not understand the following thingsin above code

float4 Position : (POSITION0)?;

Also how these function works
technique Ambient
{
pass Pass1(wt is this)
{
}
}

Also, let me know if there is any video tutorial on shaders with directx.

##### Share on other sites
What about those 2 lines do you not understand? They map vertex data to variables inside the shader. In this case position and a diffuse colour I guess.
As for the technique thingy it's a d3dx utility to use and manage shaders at a higher level.

##### Share on other sites
[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(250, 251, 252)]float4 Position : (POSITION0)?;[/background][/left][/size][/font][/color]
[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(250, 251, 252)]float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 ?[/background][/left][/size][/font][/color]
[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=3][left][background=rgb(250, 251, 252)]so the above functions are used to [/background][/left][/size][/font][/color][left][background=rgb(250, 251, 252)][font="helvetica, arial, verdana, tahoma, sans-serif"][size="2"][color="#282828"]map vertex data to variables inside the shader but what is the vertex data in the above two lines of code. (can you elaborate)[/color][/size][/font][/background][/left]

[color=#282828][font=helvetica, arial, verdana, tahoma, sans-serif][size=1][left][background=rgb(250, 251, 252)]Also suggest me a site or a tutorial where i can start learning to program shaders [/background][/left][/size][/font][/color]