Forum

Anaglyph Patch

Hi everyone,

i’m working on an anaglyph patch, and to a certain degree it works fine.
I was trying the anaglyph shader in the bazaar section, but i was not really satisfied with the results, so i made a easy to use module…

u can take a small peak at the result here… i was just playing around a little with the 3D effects… taking some posted patches to adopt them to 3D

But now i encountered some problems and i hope you can help me with that…

  1. When i want to combine “quads with PNG-textures” and 3D Objects, i either have no dephtbuffers and the Objects dont show properly, or i the quad textures don’t show the alpha and you can see the borders of the quad… i tried changing the “Fullscreen/Windowed Format” but it’s either this or that…

  2. I also don’t get the idea on MipMap. The smaller a quad gets, the more pixelated is the Texture. It works perfect on the original Renderer, but because of the Anaglyph Module i use a DX9Texture, and there the smoothness of the texture gets lost…

  3. For the 3DEffect i use the 3D Space.I have a Group-Node before my Anaglyph Module. It depends on which pin i use, which Object is shown in the back and in front… but how can i have for example a sphere sourrounded by quads, showing the quads in the right order (some in front some in the back) …

I had some other issues which i can’t remember now, but i think thats already a lot and i hope you can help me.
I found Posts on all of the issues, but couldn’t get a clear answer to my problems… most of the stuff i simply don’t understand… ;-)

I also post the Anaglyph Module… let me know what you think…

thanks
Dirk

Anaglyph (scarab).v4p (21.6 kB)

hej dirk

@1: have a look at the docu of the 3d rendering section. depthbuffer and alpha is a long discussed topic.
a quick solution is using depthbuffer and the alphatest node, but you’ll get ugly borders.

@2: maybe try dx9texture with mipmap set to all. won’t explain mipmapping here either.

@3: therefore you should be using depthbuffer

as attachment a shader i did some time ago with an optimized calculation of the channels as the website claimed

hope it helps
w

Anaglyph.fx (3.9 kB)

seas woei,

ollas kloa?

thanks for the answers.

i tried your modified analgyph shader. to be honest i don’s see a performance difference to my node. (i thought the shaders should enhance performance) …

a little help maybe for the usage of stereoscopic clips:
i dont know if you work a lot with stereographic stuff, but you would need for example a pin to change the parallaxe (the distance between camera1 and camera2 -> the virtual distance between the eyes) of the two inputs. that’s very important to adjust the 3d effect from small monitors to big projections.

cu soon
dd

seas

ois klar

i noticed that i deleted an important line out of the shader. the shader is just doing the anaglyph rendering. the left-right eye distinction you have to do by yourself. it might be possible to pack that (including parallax parameter) into one shader, but then you won’t be able to use different shaders, objects, etc.

this one is just an implementation of some optimized anaglyph calculation

i modified you’re patch to get rid of one camera module inside your module. whether you apply the eye distance into projection transform by translating or view transform by using an offset and rotating viewdirection back inside is just a matter of taste.

by the way, if you have some money for hardware go for this technique: no ghosting, nearly no loss of colors (and not as much loss of lumen as if you’d use 2 polarized projectors)

anaglyph_pack.zip (3.6 kB)

Thanks for the modified module.
if it’s ok, i will use that one from now one…

;-)

got to keep myself from duplicating nodes and use more spreads…

thanks…

hi woei

sorry my shader editing skills are not great

how would you change anaglyph.fx to output magenta/green, instead of red/blue?

wild guess:

change line 77
from

HLSL:
return float4(pow(lcol.r,1.25),rcol.gba);

to

HLSL:
return float4(pow(lcol.r,1.25),rcol.g,pow(lcol.b,1.25),rcol.a);

i can’t try this now so i am not sure about the pow thing

so may be

HLSL:
return float4(lcol.r,rcol.g,lcol.b,rcol.a);

or even

HLSL:
return float4(lcol.r,pow(rcol.g,1.25),lcol.b,rcol.a);

does better

please report your findings and i will integrate that as a second technique and post a nice, usable module containing that shader…

don’t think its enough just to change the distribution to the colorchannels.
the whole code is

float4 left = tex2D(LSamp, In.TexCd);
float4 right = tex2D(RSamp, In.TexCd);
left.r=left.g*0.7 + left.b*0.3;
return float4(pow(left.r,1.25),right.gba);

which is supposed to be kinda optimized link

so one would have to think of a nice way encoding the color information of one eye into magenta the other in to green…

in case one doesn’t care about preserving color information converting both pics to greyscale first should work out fine

i found this green/magenta shader code on the DVBViewer forum - does this help any?

<?xml version="1.0" encoding="iso-8859-1"?>
  <Shader>
    <Profile>ps_2_0</Profile>
    <Description>anaglyph Green/Magenta Optimized</Description>
    <Code>sampler s0 : register(s0);
float4 p0 : register(c0);

- define width (p0[0](0))
- define height (p0[1](1))

float4 main(float2 tex : TEXCOORD0) : COLOR
{	
   tex.x = tex.x / 2;

   float4 l = tex2D(s0, tex);

   tex.x = tex.x + 0.5;
 
   float4 r = tex2D(s0, tex);

   float red = r.g;
   float green = l.g * 0.7 + l.b * 0.3;
   float blue = r.b;
   
   return float4(red, green, blue, 1);
}</Code>
  </Shader>

not sure, if that is really optimized for green/magenta.
its exactly the same code as for red/cyan.

have no way to test if its working. here the fx with 2 techniques

Anaglyph.fx (4.6 kB)

repatched bit your module, really great one!
was thinking just yeasterday that i need new one
after some amazing bullet test ;]]
made it look more for the logic that i use…

+added help patch

Anaglyph (EX9) .woei_.rar (7.1 kB)

thanks woei, kalle, antokhio : )

spent the weekend fishing in a little boat!
very good for thinking

will test .fx today

cool some more people is playing with Anaglyph , i,m been last weeks playing with it again , found tricky the paralax , but works more or less good , and thanks for the shader and module maker it helped a lot ;D