Forum

Projected texture shader

Hi there

I have question about projected texture shader, is there a way how to get coordinates of texture after it hit mesh?
I mean something like burn to texture.

thanks

If all you want to do is frontally project the texture all you have to do is convert the screen space coordinates of the vertices (-1 to 1) to texture coordinate space. (0 to 1)

In your vertex shader it would look something like this:
make sure it is after the Out.Pos = mul(Out.Pos,tWVP);

Out.TexCd = mul(Out.Pos * 0.5 + 0.5,tTex);

I added the mul in there so you would still have transform control over your texture from the pin.

Is this what you are looking for?

Jon

Thanks for answer
i am not into shaders at all, but once id like to get into it. hope .

But yes as you write i want to convert in one pass screen coordinates to texture of an object, that in second pass (now texture) will be image sicked onto right position of the object even after deformation

My idea is to have something like virtual uvw map cache (as i can say like this) on one side there is screen input from projector on other side is object with new texture sticked on its coordinates.

i am not sure if i wrote it understandable

thanks you

maybe ( slide projector ) folder in /girlpower/ can be of any help?

thats only the first part
now is texture deformed by mesh
but is there a way how to use this texture back as the mesh texture?
something like hold position on mesh but already in object space

i feel it must be pretty simple :} and very helpful shader, but iam like without hands when i can’t shader coding

or better explanation what i want is to deform this mesh with projected texture, but in way that texture is lock on the mesh so is not sliding on the surface when the mesh is deformed

i don’t know if its understandable, thanks