Im using this code from example in the web.
What im doing bad?. Thanks!
Material
Code: Select all
material BlackBorderMaterial
{
technique
{
pass
{
ambient 1 0 0
diffuse 1 0 0
specular 1.0 1.0 0.0
vertex_program_ref BlackBorderVertexShader
{
param_named_auto worldViewProj worldviewproj_matrix
}
fragment_program_ref BlackBorderFragmentShader
{
}
}
}
}
Code: Select all
float4x4 worldViewProj : WORLDVIEWPROJ;
struct VS_INPUT
{
float4 position : POSITION;
};
struct PS_INPUT
{
float4 position : POSITION;
};
VS_INPUT vs_main(VS_INPUT input)
{
VS_INPUT output = (VS_INPUT)0;
output.position = mul(worldViewProj, input.position);
return output;
}
float4 ps_main(PS_INPUT input) : COLOR
{
float2 screenPos = input.position.xy / input.position.w;
float thickness = 10.0 / 800.0; // Grosor del borde en píxeles, ajustado por la resolución de la pantalla
float border = step(thickness, length(screenPos - 0.5));
return float4(0, 0, 0, 1) * border; // Color del borde (negro)
}
technique BlackBorder
{
pass P0
{
VertexShader = compile vs_2_0 vs_main();
PixelShader = compile ps_2_0 ps_main();
}
}