• Create Account

### #ActualYura

Posted 29 December 2012 - 07:22 AM

Sory for troubling guys, but as you can see, I'm very new in shaders. I wrote a program on direct3d9 which is drawing some surface from triangle list primitives. I have made rotation functions, which allows me to rotate this surface. All of it is made without using any shaders and it works. It works nice, fast, but with one defect. This surface is half transparent. I've tried to blend alfa component, tried to set color in RGB mode but all without success. They are still half transparent. So, now I'm trying to fix it with help of shaders and to add new features - draw this primitives with different colors on front and back sides.

I've made some changes to my shader, now it works, but color is still half transparent. Somebody knows how to fix it?

### #3Yura

Posted 29 December 2012 - 06:24 AM

Sory for troubling guys, but as you can see, I'm very new in shaders. I wrote a program on direct3d9 which is drawing some surface from triangle list primitives. I have made rotation functions, which allows me to rotate this surface. All of it is made without using any shaders and it works. It works nice, fast, but with one defect. This surface is half transparent. I've tried to blend alfa component, tried to set color in RGB mode but all without success. They are still half transparent. So, now I'm trying to fix it with help of shaders and to add new features - draw this primitives with different colors on front and back sides. I'm trying to write this shader, using ready-made samples and guides, but without success. So, maybe someone did something like this or know how to write this damn shader?

I've made some changes to my shader, now it works, but I can't rotate camera and colors still the same (front, back)
struct VertexShaderInput
{
float4 Position : POSITION0;
float4 Color : COLOR0;
};

{
float4 Color : COLOR0;
float4 BackColor : COLOR0;
float face : VFACE;
};

{
float4 Position : POSITION0;
float4 Color : COLOR0;
};

float4x4 worldViewProj;

{

output.Position = input.Position;
output.Color = input.Color;

return output;
}

{

if(input.face>0)
{
return input.Color;
}
else
{
return input.BackColor;
}

}

technique Technique1
{
pass Pass1
{
}
}

### #2Yura

Posted 29 December 2012 - 03:36 AM

Sory for troubling guys, but as you can see, I'm very new in shaders. I wrote a program on direct3d9 which is drawing some surface from triangle list primitives. I have made rotation functions, which allows me to rotate this surface. All of it is made without using any shaders and it works. It works nice, fast, but with one defect. This surface is half transparent. I've tried to blend alfa component, tried to set color in RGB mode but all without success. They are still half transparent. So, now I'm trying to fix it with help of shaders and to add new features - draw this primitives with different colors on front and back sides. I'm trying to write this shader, using ready-made samples and guides, but without success. So, maybe someone did something like this or know how to write this damn shader?

I've made some changes to my shader, but it still doesn't work (same - white screen):

struct VertexShaderInput
{
float4 Position : POSITION0;
float4 Color : COLOR0;
};

{
float4 Color : COLOR0;
float4 BackColor : COLOR0;
float face : VFACE;
};

{
float4 Position : POSITION0;
float4 Color : COLOR0;
};

{
float4 Color : COLOR0;
};

{

output.Position = mul(input.Position, input.Color);
output.Color = input.Color;

return output;
}

{

if(input.face>0)
{
output.Color = input.Color;
}
else
{
output.Color = input.BackColor;
}

return output;
}

technique Technique1
{
pass Pass1
{
}
}

### #1Yura

Posted 29 December 2012 - 02:30 AM

Sory for troubling guys, but as you can see, I'm very new in shaders. I wrote a program on direct3d9 which is drawing some surface from triangle list primitives. I have made rotation functions, which allows me to rotate this surface. All of it is made without using any shaders and it works. It works nice, fast, but with one defect. This surface is half transparent. I've tried to blend alfa component, tried to set color in RGB mode but all without success. They are still half transparent. So, now I'm trying to fix it with help of shaders and to add new features - draw this primitives with different colors on front and back sides. I'm trying to write this shader, using ready-made samples and guides, but without success. So, maybe someone did something like this or know how to write this damn shader?

PARTNERS