|
Re: Apply a texture untransformed on a surface
[Re: ello]
#55427
09/16/05 16:49
09/16/05 16:49
|
Joined: May 2003
Posts: 609 Rattenfängerstadt
Rigoletto
OP
Developer
|
OP
Developer
Joined: May 2003
Posts: 609
Rattenfängerstadt
|
Hi, it don´t gives the wanted result. I don´t want the texture on the left, i want a plain texture in the shape of the face. I try to make a "volumic fog" mixed from the normal fog and a fog texture plain on the blocks with a an alpha from the bottom to the top, so higher it is, it get´s more alpha. It´s just a test, maybe it looks terrible.
|
|
|
Re: Apply a texture untransformed on a surface
[Re: Rigoletto]
#55428
09/18/05 18:40
09/18/05 18:40
|
Joined: Mar 2001
Posts: 3,298 Beverly, Massachusetts
Rhuarc
Expert
|
Expert
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
|
Exmaple: ( in.pos is POSITION semantic, out.tex0 is a float3 output TEXCOORD semantic)
VERTEX SHADER: float4 toScreen = mul(float4(pos.xyz,1),matWorldViewProj); out.tex0.x = 0.5f * (toScreen.z+toScreen.x); out.tex0.y = 0.5f * (toScreen.z-toScreen.y); out.tex0.z = 1.0f * toScreen.w;
PIXEL SHADER: float2 screenCoords; screenCoords.x = in.tex0.x/in.tex0.z; screenCoords.y = in.tex0.y/in.tex0.z; float4 screenSpaceSample = tex2D( screenprojSampler, screenCoords.xy );
You should be able to figure it out with that, just adjust your variable names for the inputs and outputs, as well as the texture read. This requires PS2.0, you can change it so it divides the coordinates by the w component in the VS to bring it down to 1.0, but that will cause artifacts on the edges of the screen. I'm working on a workaround for that right now... I'll let you know if I figure a way out.
-Rhuarc
|
|
|
|