[hlcoders] Anaglyph Shaders

2010-11-09 Thread AndreaZzZ
I'm currently doing anaglyph. How to move left and right along the x axis, my shader moves along the axes xy as correct? Code: sampler BaseTextureSampler : register( s0 ); HALF4 main( HALF2 ZeroTexCoord : TEXCOORD0 ) : COLOR { float left_pos = 0.008; float right_pos = -0.008; float4 left =

Re: [hlcoders] Anaglyph Shaders

2010-11-09 Thread Joel R.
HALF2 has the .x and .y properties. So just do something like HALF2 leftCoord = ZeroTexCoord; leftCoord.x += left_pos; Then sample the color at the new coordinate. However you should note, that the color you will be returning in that function will be for the original pixel location. Shaders go

Re: [hlcoders] Anaglyph Shaders

2010-11-09 Thread Joel R.
If you go outside of the 0.0 - 1.0 range it will be capped to 0.0 or 1.0. I can't think of a way to fix that problem, since it would require rendering a bigger view than the users resolution. On Tue, Nov 9, 2010 at 10:21 AM, AndreaZzZ andrea_s...@mail.ru wrote: Thanks, I did it. But there is a

Re: [hlcoders] Anaglyph Shaders

2010-11-09 Thread AndreaZzZ
Coding will solve this problem... 2010/11/9 Joel R. joelru...@gmail.com If you go outside of the 0.0 - 1.0 range it will be capped to 0.0 or 1.0. I can't think of a way to fix that problem, since it would require rendering a bigger view than the users resolution. On Tue, Nov 9, 2010 at

Re: [hlcoders] Anaglyph Shaders

2010-11-09 Thread Joel R.
You could go cheap and just add a frame around the edges to hide the ugly parts. On Tue, Nov 9, 2010 at 11:17 AM, AndreaZzZ andrea_s...@mail.ru wrote: Coding will solve this problem... 2010/11/9 Joel R. joelru...@gmail.com If you go outside of the 0.0 - 1.0 range it will be capped to 0.0

Re: [hlcoders] Anaglyph Shaders

2010-11-09 Thread AndreaZzZ
Thanks, I did it. But there is a problem - http://img130.imageshack.us/img130/6206/testhardware0017.jpg (look at the rocks) 2010/11/9 Joel R. joelru...@gmail.com HALF2 has the .x and .y properties. So just do something like HALF2 leftCoord = ZeroTexCoord; leftCoord.x += left_pos; Then sample

Re: [hlcoders] Anaglyph Shaders

2010-11-09 Thread Alexander Hirsch
That's not even how anaglyph images work. If you look at that through your colored glasses you won't see a depth effect. You need to render the scene twice, once with a camera moved a little to the left and rotated to the right, and once with one moved a little to the right and rotated to the

Re: [hlcoders] Anaglyph Shaders

2010-11-09 Thread AndreaZzZ
DBViewer users say it works ( http://www.dvbviewer.tv/forum/topic/40858-3d-anaglyph-shader/) 2010/11/9 Alexander Hirsch 1ze...@googlemail.com That's not even how anaglyph images work. If you look at that through your colored glasses you won't see a depth effect. You need to render the scene

Re: [hlcoders] Anaglyph Shaders

2010-11-09 Thread Julian Moschüring
They are using a 3d source in the example of your link. It looks like a side by side texture containing the left and right eye images. The line tex.x = tex.x +0.5 after the first sample is taken switches to the second image on the same texture to take the right eye's sample. As Alexander said

Re: [hlcoders] Anaglyph Shaders

2010-11-09 Thread Alexander Hirsch
As you can see in the following image, they're using two images: http://www.dvbviewer.tv/forum/topic/40858-3d-anaglyph-shader/page__view__findpost__p__301613 While you are only using one. They combine the left with the right picture (hence the + 0.5). Let's talk about how anaglyph images make it