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 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 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 from Top left corner to Top Right Corner and repeats until it reaches
> > the
> > bottom most row.
> >
> > This means you'll have to work in reverse by sampling left or right
> towards
> > the "original" pixel, instead of working from the original pixel outward.
> > It
> > would also be best to use different shader passes for each blue and red
> of
> > the anaglyph.
> >
> > On Tue, Nov 9, 2010 at 8:34 AM, AndreaZzZ <andrea_s...@mail.ru> wrote:
> >
> > > 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 = tex2D(BaseTextureSampler, ZeroTexCoord + left_pos);
> > > float4 right = tex2D(BaseTextureSampler, ZeroTexCoord + right_pos);
> > >
> > > float r = 0.7*left.g + 0.3*left.b;
> > > float g = 1*right.g;
> > > float b = 1*right.b;
> > >
> > > return float4(r, g, b, 1);
> > > }
> > >
> > >
> > > Sorry for my English because English isn't my native language.
> > > _______________________________________________
> > > To unsubscribe, edit your list preferences, or view the list archives,
> > > please visit:
> > > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> > >
> > >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives,
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to