Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,014 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Apply a texture untransformed on a surface #55425
09/16/05 11:07
09/16/05 11:07
Joined: May 2003
Posts: 609
Rattenfängerstadt
Rigoletto Offline OP
Developer
Rigoletto  Offline OP
Developer

Joined: May 2003
Posts: 609
Rattenfängerstadt
Hi,

it is possible to apply a texture on a surface that is not put on the surface? So that the texture is looking plain on the screen but only in the surface.

Which matrix must be used?

Re: Apply a texture untransformed on a surface [Re: Rigoletto] #55426
09/16/05 11:33
09/16/05 11:33
Joined: Oct 2002
Posts: 8,939
planet.earth
ello Offline
Senior Expert
ello  Offline
Senior Expert

Joined: Oct 2002
Posts: 8,939
planet.earth
use something like

texCoord.xy=oPos.xy; while oPos contains the mul(position,matWorldViewProj);

untested, but i think thats what it was like


www.earthcontrol.de
quoted: We want to maintain a clean, decent, American family suited forum look... which means you may post zombies or chainsaw massacres, but no erotic.
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 Offline OP
Developer
Rigoletto  Offline 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 Offline
Expert
Rhuarc  Offline
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


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog
Re: Apply a texture untransformed on a surface [Re: Rhuarc] #55429
09/18/05 20:30
09/18/05 20:30
Joined: May 2003
Posts: 609
Rattenfängerstadt
Rigoletto Offline OP
Developer
Rigoletto  Offline OP
Developer

Joined: May 2003
Posts: 609
Rattenfängerstadt
Rhuarc, thank you very much to push me back on track.

Re: Apply a texture untransformed on a surface [Re: Rigoletto] #55430
09/18/05 20:34
09/18/05 20:34
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
Rhuarc Offline
Expert
Rhuarc  Offline
Expert

Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
No problem!


I no longer post on these forums, keep in touch with me via:
Linkedin.com
My MSDN blog

Moderated by  Blink, Hummel, Superku 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1