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 look 3D.
First, you have two eyes, producing two images. Your eyes are also
always crossed a little to find a common point in the two images.
This is your focal point.

Now, your brain tries to match the two images. It will try to find
matching colors and pattern and depending on how far apart the
patterns are you will see depth. If they are too far apart, you loose
focus.
You can easily try that by holding a pen or something close to your
head; while you can see the pen; you will see double.

Seeing it unsharp is another thing, that can also happen with a single
eye; it's got to do with the lens, but as said, that's another thing.


Well, not back to CG.
You can simply render two images from two cameras, alike your eyes a
bit apart and crossed.
The problem is, that you somehow need to send the image of the left
camera to the left eye and the image of the right camera to the right.
This can be done via simple color filtering. You put on glasses with,
as usually used, a red panel left and a blue or green panel right.
The red panel will let red light through, while blocking others (they
will appear black) while the blue or green panel does the same with
its color.

So now you simply take the red channel of the left image and combine
it with the blue and green channel of the right image.
As result, the red stuff, which is solely the left image, will pass
through the left (red) panel of your glasses and the blue and green
stuff will pass through the right (blue/green) panel of your classes.
Now, your left eye sees mostly only the left image and your right eye
mostly the right image. It will yet again try to match the images and
here is the flaw with your technique:

The differences of the two images are the same everywhere. Your brain
might try to add some depth - the same depth your kinda see in a
normal image - but it's worse than what you could get by using two
separately rendered images.

On Tue, Nov 9, 2010 at 7:51 PM, AndreaZzZ <andrea_s...@mail.ru> wrote:
> 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 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 left.
>> The amount of rotation defines the focal point; the rotation is
>> important and in your current shader it is not present.
>> Then you combine the red-channel of the left with the blue and green
>> channel of the right image to the final color.
>>
>> On Tue, Nov 9, 2010 at 6:27 PM, Joel R. <joelru...@gmail.com> wrote:
>> > 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 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
>> >> >
>> >> >
>> >> _______________________________________________
>> >> 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
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to