Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Simple question:

I have this image that is 200x200. I want to change it to 100x200 inside the HSLS, making it thin. Anyone have idea? I tried to do something like

output *= tex2D(CustomTextureSampler, float2(input.UV.x*2,input.UV.y));

Didn't work. it simple returns black.

share|improve this question
    
Are you trying to resize the texture, or crop it? –  Jonathan Hobbs Dec 22 '11 at 7:05
    
nvm, i got the answer, lost all day thinking about it, then i posted here, and seconds later i figured out -.-"... answer: output *= tex2D(CustomTextureSampler, float2((input.UV.x-0.5)*2,input.UV.y)); i was failing in it before before i was trying to do something like: output *= tex2d(CustomTextureSampler, (input.UV-(0.5,0)) * float2(2,1))... it wasnt working, seems like the UV and float2 could not multiply very well. I dont know. –  H_DANILO Dec 22 '11 at 7:09
2  
Make sure you add the the actual answer in the answer section and then select it as the accepted answer. –  Samuel Slade Dec 22 '11 at 9:02
    
@H_DANILO Yes, please do post the answer and mark it as correct. It's encouraged so that future visitors with the same issue find the answer. It also means nobody needs to try to answer this question, and the system won't try to bump it. –  Jonathan Hobbs Dec 22 '11 at 9:34
add comment

1 Answer

I got the answer, lost all day, then I posted here I figured out:

output *= tex2D(CustomTextureSampler, float2((input.UV.x-0.5)*2,input.UV.y));

I was failing in it before before I was trying to do something like:

output *= tex2d(CustomTextureSampler, (input.UV-float2(0.5,0)) * float2(2,1));

and it wasnt working, seems like the UV and float2 couldn't make math between themselves.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.