Home Technical Talk

How do I make my work stereoscopic?

polycounter lvl 14
Offline / Send Message
AlexLegg polycounter lvl 14
I've searched around on the internet but I'm not finding much about making sterescopic games.

Can anyone tell me how I would go about making my work sterescopic?

What I was thinking is that there would be some way in UDK (for examaple) to out put to stereo.

As I'm not finding too much, I'm guessing it is too new a tech to be supported.

So I would then assume that to output to stereo I would have to involve a programmer and they would have to write something to render out two views and combine them in real time.

Any thoughts or guidance would be appreciated,

Alex

Replies

  • oglu
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    Alex what kind of stereo do you want to do? (red/blue or shutter glasses)I've been working with stereo imaging for a few years, so I don't think it will be a problem to render it out in UDK. It will take some work, but once it's set up, you will be fine.

    But I think in the latest version of UDK there is some kind of stereo support, but not for render. Or was that with the nVidia cards? Anyways, I will put this in my head to think of a way to do it. It can be done.
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    Damn it dude. Now I'm sidetracked for the challenge. Gonna start now.
  • bbob
    Options
    Offline / Send Message
    Actually, stereoscopic films have been around since the 50'ies.

    The basic premise is that you need two cameras that are spaced a little bit that has a common focus point.

    There are several ways of doing it:
    A: Get red and blue glasses, this works with any monitor. Then respectively redden and blue either split of the footage.

    B: Get some glasses with shutters in each eye, that opens and closes beyond the refresh-rate of the eye, 70hz or something. Then synchronize the footage with that. To make this work, you need a reciever that tells the glasses when to start getting jiggy.

    C: Get some glasses that filters different UV frequencies, and play your footage on a monitor that can display these. Thats those new 3D TV's and monitors that keeps popping up.

    Where the programmer comes in is because you need to constantly cast rays to make the cameras focus on whatever the crosshair is on. As for making it pop more, you need to space the cameras more, but if you do it too much, the player will get a urge to puke if he/she looks at something that is not on the crosshair.

    Can't tell you exactly how to do it, as I havent got experience with UDK, nor with programming.
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    LOL, thanks Lamont.

    I read that UDK was gonna incorporate S3D, but I guess we can't get our hands on it yet.

    Well I don't know much about the tech, but not the old 80s style red and green glasses (i have done animations using that before, actually looked OK) but whatever the current thinking is for games. I've read that the TV input is HDMI 1.4 which supports S3D, but how I make my levels S3D in UDK or any other kit is a mystery!

    I'm not even sure if I need a special graphics card (as I understand it thats only for converting 2D to S3D) or a 3D monitor. There just desnt seem to be any info out there!
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    If you don't want to do it with the red/blue glasses, how are you going to control the shutter glasses for this type? If you have dual projectors, yes, then you need polarizing filters for each, and polarized glasses set up for each. If you want 3D without the shutter glasses, do you have the proper display? And if you did, you need a way to encode this format for BluRay. And right now the only game in town for BluRay encoding for this is Sony, and they're charging $50,000 for the software.
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    Now if you wanted to do renders left and right. From my initial thoughts:

    • Set up your scene in UDK
    • Export the geometry
    • Import into your app of choice
    • Animate your stereo rig
    • Bring back into UDK for each "eye" (Collada Camera animation import)
    • Render out the frames* for each eye
    • Composite in your application of choice.

    Issues:

    Particle systems, anything that's time based (moving textures and such). Will not sync from the two renders. This is a performance thing, it will always be off.

    Solution?:

    Post process effect to render left and right, but from what I have read, it will always be from one camera and not actually shift the view for left and right. Might as well render out one and fake it doing it this way. There is software that can do this.

    Unless you can shift camera left and right in the node... which I think you can. But do this per frame and compile the results on screen. Sounds crazy now that I read it out loud.

    Quickly going through Unreal Script there's only one camera per pawn. Could be wrong.

    What I outlined above with the camera rig will work. Just make sure you have a sync frame/moment in UDK so when you start compositing, everything will match.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Actually been toying with the idea of getting stereo to work in UDK. Waiting for my damn red/cyan glasses. Havent tried anything right now. Toyed with the idea today at work whether a two camera rig constrained to the player that were separated eye width apart so you have left and right but somehow in kismet have it alternating between the two but this would require shutter glasses and 3d monitor I believe from what I have read (which are expensive as a student :P)

    Lamont how were you gonna tackle the combination of the two views assuming you were going the anaglyh route? I read somewhere I think in a sony slide that you could use a depth map to get stereo. need to find that....

    http://www.google.com/url?sa=t&source=web&cd=8&ved=0CD0QFjAH&url=http%3A%2F%2Fwww.technology.scee.net%2Ffiles%2Fpresentations%2FStereoscopic_3D%2FPS3_Making_Stereoscopic_3D_Games.pdf&ei=8VNITIfCG8GblgfFquWGCw&usg=AFQjCNE5D9TQYejHPHfcjW3pPNvU5K5D_A&sig2=ny_2EsZeMgwcCTTFfGElhA
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    Actually been toying with the idea of getting stereo to work in UDK. Waiting for my damn red/cyan glasses. Haven't tried anything right now. Toyed with the idea today at work whether a two camera rig constrained to the player that were separated eye width apart so you have left and right but somehow in kismet have it alternating between the two but this would require shutter glasses and 3d monitor I believe from what I have read (which are expensive as a student :P)
    Yeah, I'd try that route. As you're the same character in the same scene and everything will be in sync.



    Solution?

    You know what? When I was making a camera for top down action game, I messed up and the camera was going back and fourth so damn fast it was in stereo. I was getting two views and a single point of interest based on cross hairs. And this was all in kismet. You can put a hidden object as the camera target and this will be your point of interest.

    Lamont how were you gonna tackle the combination of the two views assuming you were going the anaglyh route? I read somewhere I think in a sony slide that you could use a depth map to get stereo. need to find that....
    After Effects or NukeX, well any composting application.

    If you can render out one depth map from UDK and one still image, email it to me and I'll make a stereo version for you in any format. I'm working with a friend on stereoscopic software, so it would be a nice test.

    BetterSimpsons.jpg
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    *grumbles at UPS for not shipping glasses faster

    Wonder how Batman: Arkham Asylum does it. Thats the only game I knew off that was on consoles and did 3d.
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    They released a patch. I think it was through nVidia cards only.

    269424954_5928cc3f98.jpg
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Will try stuff this weekend hopefully and report back. Might bug you Lamont for kismet help :)
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    When you're ready I'll give you the map that has all the stuff set up. Just PM me or send me an IM on MSN.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    sent my contact info. Dunno how you guys have time to research stuff when you have a full time job. Its not as bad for me as its summer only but by the time you get back you're tired and have to wake up at 6 am to go back to work :O
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    Hmm, so it sounds like to achieve the S3D effects that games will use I'll need a 3D monitor and shutter glasses, then set up some sort of camera rig in UDK?
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    AlexLegg wrote: »
    Hmm, so it sounds like to achieve the S3D effects that games will use I'll need a 3D monitor and shutter glasses, then set up some sort of camera rig in UDK?
    No, you will not need a 3D monitor, shutter glasses would be IR or USB controlled and will strobe with the correct image.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    this would be interesting to develop in flash. Maybe even with shutter glasses and or red / green glasses support. All it would need when embedding it would be the swf file with 2 parameters of the 2 (left and right eye / offset) images.

    count me interested in developing something like this, its just that I don't have any 3d glasses right now- maybe I'll have a look tomorrow at the shops here in Sydney.
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    renderhjs wrote: »
    this would be interesting to develop in flash. Maybe even with shutter glasses and or red / green glasses support. All it would need when embedding it would be the swf file with 2 parameters of the 2 (left and right eye / offset) images.

    count me interested in developing something like this, its just that I don't have any 3d glasses right now- maybe I'll have a look tomorrow at the shops here in Sydney.
    For red/blue you can use a single image to view. Shutter, you need to control the device/glasses.

    If you can't find glasses, go to a museum or a "plane-arium".
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Today on the bus I realized you can do simple anaglyph UDK animations by separating the channels. Red for left side and green blue for right side. (this is for red cyan glasses) Though how Im going to separate the distance is a whole other issue. Why can't glasses ship faster. Maybe I should resort to getting Hannah Montana in 3d :poly122:
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Lamont wrote: »
    No, you will not need a 3D monitor, shutter glasses would be IR or USB controlled and will strobe with the correct image.

    I always thought you needed a 120HZ monitor for shutter glasses.
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    I always thought you needed a 120HZ monitor for shutter glasses.
    No, just need a way to control the glasses.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Got my 3d glasses finally. Lamont that picture looks sweet :)
  • sprunghunt
    Options
    Offline / Send Message
    sprunghunt polycounter
    it should be possible to make a post process material in UDK for Red-Blue 3D imaging. Just offset the image using the depth buffer as a mask.

    From what I've heard with shutter glasses there's not much you can do from an art point of view. If your engine supports it then it'll work. It's purely something that's implemented in code.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    sprunghunt wrote: »
    it should be possible to make a post process material in UDK for Red-Blue 3D imaging. Just offset the image using the depth buffer as a mask.

    From what I've heard with shutter glasses there's not much you can do from an art point of view. If your engine supports it then it'll work. It's purely something that's implemented in code.

    that my plan of attack :) Will be a good thing to add to the tech art portfolio :poly142:
  • e-freak
    Options
    Offline / Send Message
    OK, I didn't read every single post in here so somethings might be covered already.

    I spend the last semester at university getting told how important stereoscopy is and what awesomeness it brings. The first thing you wanna make sure is (apart from if you're R&D or Tech Artist) - forget about it, Stereoscopy is nothing but another Post-Effect and it will not enhance the quality of your work! I feel it's important to point this out as 4 of 5 of my proffesors did this mistake (imho) and instead of talking about content they were talking about tech.

    Back to the topic!

    Stereoscopy is (as has been described) the rendering of two horizontal parallel cameras and theyr respective projection on each eye. The important thing is that you only have one output device in most cases (if you don't wanna do cross-eyed all the time) and your eyes can't seperate the image on theyr own (obviously).

    So at first you need an output device or a filter for Stereoscopy Image (like Red and Green glasses which will not allow for anymore colors than grayscale or a specific monitor with glasses (shutter or polarization or hue shift)).

    On the format of your output it depends what image you generate.

    The easiest to fake/create are these two approaches:

    Shutter glasses:
    Create a camera rig (easiest way: 2 cameras attached left and right of another camera for previs) and get the shutter glasses controller's state and activate the corresponding camera of your rig (no signal is base camera). Alternatively you can get it cheaper by just creating a key-frame on every frame switching the cameras (this will not synchronize though and might not work too well).

    Red and Green:
    The exact same as the above - create two cams on a parent constraint, have them switch permanently at highest possible speed (by script or by keyframes) and overlay them with PP effect for Gray-Scale on Red Channel or Gray-Scale on Green Channel. It's not easy on the eyes and color needs to be calibrated but very easy to implement.

    Easier to render but hard on the math and getting an absolute correct image: Read out the z-Buffer of your image (render seperate path or look up your engine's renderpath. Now you create two new images where you fill in the pixel of the rendered picture offset by + or - (left or right eye) of the grayscale value of the zBuffers pixel at the same original position * the amount of shift you want to have (will increase or decrease the stereoscopic effect).
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    Thanks e-freak, very useful info. Wish my degree course was as relevant and cutting edge as yours sounds!
  • e-freak
    Options
    Offline / Send Message
    If it sounded that way I'm sorry - the course it self was bollocks (because the information can be gathered in a week and they spread it over 3 months.) But hope it helps anyway :D
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    They spread it out over three years on mine, and then I had to pretty much learn it all when I left as I found out I knew very little after all! LOL
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    I think I have something. Hold on. Give me about 30 minutes.
  • renderhjs
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    Thanks for that link Lamont, very helpful.

    Renderhjs, that is a cool site, can't check the other links at work, so will have to look at home!

    Cheers guys.
  • e-freak
    Options
    Offline / Send Message
    personally I'd not work with the default nvidia drivers (it calls a second camera in the directx render iirc) and really is uncontrolable. It's like hardware teselation on Half-Life 1. Technically your graphics card can do it, practically it's seperated from the content and will look wrong. Do your stereo your self or leave it out completely!
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Sorry been busy with work :( Im gonna try this weekend to replicate the photoshop effect (hopefully lol) with a post process volume. The way I understand the photoshop effect works is that it take the regular image, takes the depth map, apply offset like e-freak said and blend between the two images. Dont even know if its possible but will be a great way to learn the material editor while I look up nodes haha. I tried bringing in stereoscopic images into UDK and just looking at that and they actually looked okay....thought for some reason they would be screwed up.

    Found this:

    http://http.developer.nvidia.com/GPUGems/gpugems_ch41.html
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Arise from the ashes thread.

    Got some work done and my mind was going insane but apparently I didn't check screen align >.<

    3dTest.jpg

    Havent messed with putting in a depth map instead of numbers....Anyone know of a better way to offset a texture rather than using the screen space to offset it? Don't even think the way I did it is even remotely correct but there is some sort of 3d effect so I must be on the right track :)
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    EDIT: material print screen grab
    Material.jpg\

    Goddamit fail edit.
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    Great try, but yeah, you're not getting any depth out of it. Load up the 3D map located in the maps folder, build that and run it.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Lamont wrote: »
    Great try, but yeah, you're not getting any depth out of it. Load up the 3D map located in the maps folder, build that and run it.

    3d map? Which one is this?
  • Lamont
    Options
    Offline / Send Message
    Lamont polycounter lvl 15
    3d map? Which one is this?
    Look in the last UDK release (July) and there will be a map that has stereoscopic available: DM-Sanctuary3D.

    Performance is horrible.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    Bah I unistalled July UDK to install the August one but swear I never saw that, maybe cause Im using ATI (?) or is this anaglyph stereoscopic? Thinking I might have to go a different route. Either

    A. Generate second image using depth map and displace filter (would have to look into if I can grab the algorithm that photoshop uses)

    B. Constrain two cameras to the player and switch via kismet hoping that if they switch fast enough I can overlay the images. Problem with this is theoretically I would not be able to isolate the red and green/blue. Unless I can store the previous frame in somehow and use that.

    EDIT: Totally forgot e-freak's comment on this. Hmm more experimentation...
  • AlexLegg
    Options
    Offline / Send Message
    AlexLegg polycounter lvl 14
    I have UDK july and the 3D level isn't there! just downloaded August as I assumed it was there instead! I am using nvidia.
  • e-freak
    Options
    Offline / Send Message
    I don't see the map in either of those. Come to think of a very hardware heavy way to fake stereoscopy is to build a setup for your entities, where the original position of the entity is the pivot point and the engine automatically adds the same geometry on a hard-set radius. The Materials get Color-Overlayed and the Radius turns relative to the camera rotation (think sprites), while the models stay in same orientation. This way you double polycount (but keep rendering simple due to instances) and get a perspective based stereoscopy. Even better: If you don't want to use anaglyph you flag all original geometry to be visible only to camera1 and all "fake" geometry visible to camera2 (no real cameras but render allowances) and get a switching picture out of it.

    Not sure if this makes sense, will try to make a pictogram for it :D
  • r0xmys0x
    Options
    Offline / Send Message
    r0xmys0x polycounter lvl 10
    Here is a post shader I've been working on in UDK for a few hours. Its works to an extent - has a few tweakable parameters - its depth based. I'll post the shader at some point tomorrow after I've had a wee bit longer to fiddle.
  • haiddasalami
    Options
    Offline / Send Message
    haiddasalami polycounter lvl 14
    NOOOOO :( Just found the algorithm for the displace tool...will be looking forward to the material
  • r0xmys0x
    Options
    Offline / Send Message
    r0xmys0x polycounter lvl 10
    A little more progress on the anaglyph post material. Worked out a better way to calculate the scene depth - still breaks when looking at sky domes but I'm not to bothered about that at the moment as this is a for a top down game. I'll post a shot the material setup once I have tweaked a few more things...

    stereo2.th.jpg
Sign In or Register to comment.