- Home /
3d render to alpha channel
Hi,
The idea is to make a shader that does this : http://www.youtube.com/watch?v=6r7hVWmNEcw&feature=g-upl
A friend of mine did this shader with HLSL ---------
uniform extern texture ScreenTexture;
sampler ScreenS = sampler_state
{
Texture = <ScreenTexture>;
};
float4 PixelShaderFunction(float2 texCoord: TEXCOORD0) : COLOR
{
float4 color = tex2D(ScreenS, texCoord);
if(color.r < 1.0f)
{
return float4(0.0f, 0.0f, 0.0f, 0.0f);
}
else
{
return color;
}
}
technique GreenToAlpha
{
pass Pass1
{
PixelShader = compile ps_2_0 PixelShaderFunction();
}
}
--------
Do you know the process that I can use with the free version of unity3D ?
Or maybe this shader have been already done in unity, if you have a link to it feel free to post it.
Sorry for my poor english.
Answer by no.One · Sep 17, 2012 at 12:13 AM
Hi,
I'm the guy who wrote the HLSL code up here. This shader is actually just a pixel shader taking all non-white pixels and turning them into a transparent one. I made it to reproduce the effect shown on the video with DirectX.
What he needs here is how to render the 3d text on white background into a texture, send it to this shader (who needs to be converted to GLSL/CG) and draw it on his scene.
Hope this post clarify his demand.