Hello everyone,
I have created a cheap analgyph 3D post processing effect for UDK.
This effect will most likely not be of any value for the PC, as there are numerous 3D options available, but it might be of some use in iPhone development.
I study Computer Sciences and one day I came across two students working on anaglyph 3D techniques in OpenGL/Cg, they told me they were somehow creating those images using only one scene render.
I asked myself how they could have created that technique, so today I devoted myself to recreating this effect.
First of all, for those of you interested in how you can create an anaglyph image (assuming the use of red/cyan glasses):
1. You need two images, a normal image and a right-shifted image.
2. Take the normal image and add full red to it.
3. Take the right-shifted image and add full cyan (full green and full blue) to it.
4. Multiply the two images.
Formula: (img1's RGB + full R) * (img2's RGB + full G B)
It's that easy. However, you can manipulate the images further to minimize some artifacts caused by this technique.
Porting it to UDK:
How do we make this effect cheap?
Apply it after rendering as a post processing effect.
How do we create the shifted image?
Sample the SceneTexture again and shift it's UV values using the depth of the scene (via SceneDepth in the material editor).
How do we put it all together?
Apply the formula mentioned above.
What does it look like?
Well at first... it didn't look like anything because I forgot to normalize the SceneDepth. It didn't look any better afterwards, as the normalized SceneDepth didn't work out as I had planned.
So I divided it by one percent of the MaxZ value, because I wanted the image to be shifted up to one percent of the screen. <-- Wrong explanation, I made an error when setting up the material, it's (SceneDepth / MaxZ) * 100.
After that I added it to the UV coords and put that into the UV value of the second sample.
Then it looked like this: http://www.twitpic.com/4pkbhg/
I'll keep this updated, because I'm not entirely satisfied with it yet, so stay tuned.
If I can find the time to do so, I'll quickly put a mutator together for UT3.
A few notes:
The effect is most convincing in small environments, the images are too wide apart when further away.
This is effect is not entirely real anaglyphic 3D, it's quite convincing, but you'd need two seperate scene renders with a seperate right shifted camera to do the real thing. That's why there are some cases in which the effect fails to simulate it convincingly.
Other than that it's quite convincing.
I have created a cheap analgyph 3D post processing effect for UDK.
This effect will most likely not be of any value for the PC, as there are numerous 3D options available, but it might be of some use in iPhone development.
I study Computer Sciences and one day I came across two students working on anaglyph 3D techniques in OpenGL/Cg, they told me they were somehow creating those images using only one scene render.
I asked myself how they could have created that technique, so today I devoted myself to recreating this effect.
First of all, for those of you interested in how you can create an anaglyph image (assuming the use of red/cyan glasses):
1. You need two images, a normal image and a right-shifted image.
2. Take the normal image and add full red to it.
3. Take the right-shifted image and add full cyan (full green and full blue) to it.
4. Multiply the two images.
Formula: (img1's RGB + full R) * (img2's RGB + full G B)
It's that easy. However, you can manipulate the images further to minimize some artifacts caused by this technique.
Porting it to UDK:
How do we make this effect cheap?
Apply it after rendering as a post processing effect.
How do we create the shifted image?
Sample the SceneTexture again and shift it's UV values using the depth of the scene (via SceneDepth in the material editor).
How do we put it all together?
Apply the formula mentioned above.
What does it look like?
Well at first... it didn't look like anything because I forgot to normalize the SceneDepth. It didn't look any better afterwards, as the normalized SceneDepth didn't work out as I had planned.
So I divided it by one percent of the MaxZ value, because I wanted the image to be shifted up to one percent of the screen. <-- Wrong explanation, I made an error when setting up the material, it's (SceneDepth / MaxZ) * 100.
After that I added it to the UV coords and put that into the UV value of the second sample.
Then it looked like this: http://www.twitpic.com/4pkbhg/
I'll keep this updated, because I'm not entirely satisfied with it yet, so stay tuned.

If I can find the time to do so, I'll quickly put a mutator together for UT3.
A few notes:
The effect is most convincing in small environments, the images are too wide apart when further away.
This is effect is not entirely real anaglyphic 3D, it's quite convincing, but you'd need two seperate scene renders with a seperate right shifted camera to do the real thing. That's why there are some cases in which the effect fails to simulate it convincingly.
Other than that it's quite convincing.
Comment