cybear
1
Hello to all!
I have a question regarding the HLSL language.
How do I project a texture on a Mesh treating as it would be a flat 2d image
instead of projecting it around the geometry?
I tried changing the Out.TexCd in the vertex shader and also the
tex2D in the pixelshader, but I didn’t find out how to do it.
Anyone has a hint?
Thanks in advance :)
cybear
2
The mesh should be like a mask where the texture is only visible where alpha is not zero.
DiMiX
3
i used to change UV mapping of the geometry (according point of view), maybe there is HLSL way to get the same.
cybear
4
I’m sure that it must be really simple. Unfortunately I’m really a beginner with hlsl…
readme
5
Hey,
this is another approach to it, without hlsl though.
in case you’re in a hurry.
https://discourse.vvvv.org/t/8328
tonfilm
6
tex2Dproj is the one you are looking for:
tex2dproj.zip (2.9 kB)
DiMiX
7
Thanks tonfilm. that’s it.
default shader mode: mirror - would be great to get border mode option as well
cybear
8
Thank you tonfilm! That’s it what I was searching! :)
tonfilm
9
the texture sampler modes can be set with something like:
code(lang=hlsl):
sampler Samp = sampler_state //sampler for doing the texture-lookup
{
Texture = (Tex); //apply a texture to the sampler
MipFilter = LINEAR; //sampler states
MinFilter = LINEAR;
MagFilter = LINEAR;
AddressU = border; //or mirror, wrap, clamp
AddressV = border; //or mirror, wrap, clamp
BorderColor = (someColor);
};
cybear
10
Thanks again, but that I always knew. But perhaps it can be useful for others! :)