The Meaning of Life, the Universe, and Everything.
Join Date:
10/14/2010
Posts:
58
Member Details
Quote from mxms »
Firstly, thank you for doing this.
You're welcome!
Quote from Laurina »
That update seems to have added a few extra FPS. Nice work! (but don't stop now).
I have more ideas on how to speed this up. I definitely know the performance problem exists at the OpenGL/Direct3D border - probably because each frame is going GPU(GL)->CPU->GPU(D3D) - at 1920x1080/32bbp that's 8,294,400 bytes each way per eye per frame! I've discovered there are some OpenGL extensions that allow you to use Direct3D resources - specifically let OpenGL draw straight into a Direct3D surface. Hopefully if used correctly the GPU will draw straight into the Direct3D texture without needing to transfer anything through the CPU. But, the problem with OpenGL extensions is they're vendor specific - this extension I'm looking at is nVidia specific.
Quote from Laurina »
One thing that was mentioned earlier I've found to be true, so I'll make the point once more:
The images for each eye are are rendered in a sort of staggered way - the image for the left eye is not the match for the right eye, but rather the right image is the next frame in time. This means that when things move fast or when framerate is not high enough, you get a lot of mismatch between the eyes. If it would be possible to make sure that each frameset contains a left and right image taken at the exact same time, that would eliminate the problem and make low framerates much more bearable to play.
That's actually a more interesting problem than it first seems. My code is working at the OpenGL layer and has no concept of what Minecraft is doing. So I can't tell Minecraft to draw the scene twice, so instead I let the game loop run twice - once for the left eye and once for the right eye so you're actually getting alternating frames to each eye. If you can maintain a steady 60fps (30fps per eye) this should be no problem, actually if you can maintain 120fps then each eye is updating as fast as the NVidia 3D Vision glasses can show. Anyway I do agree that it is distracting at choppy framerates. I'll look into ways to get the eyes rendering together. One possible way could be by recording the OpenGL calls as Minecraft draws one eye then play back the identical calls for the other eye (this introduces some special cases like what if Minecraft updates a texture half way through drawing one eye, do I record and play that back too?) I guess only experimentation will tell!
The Meaning of Life, the Universe, and Everything.
Join Date:
10/14/2010
Posts:
58
Member Details
Quote from PiercingGoblin »
I don't quite understand the cross-eyed thing. Still a great mod!
Thank you!
Cross-eyed is a bit difficult to focus first, and works best if you're playing the game in a small window or sitting a bit back from the screen. Also I wouldn't recommend playing it for half a day straight on cross-eyed unless you want some serious eye strain. But it is a cheap way to try out 3D without needing any special kind of glasses.
Basically the image the right eye sees is shown on the left half of the screen, and vice versa. Then you look at your screen cross-eyed. As you go cross-eyed you'll notice the two images come closer together and overlap. Try to get them to overlapped perfectly (in my experience this is easier if you focus on something static like the cross hair while wiggling the mouse so the background animates).
The Meaning of Life, the Universe, and Everything.
Join Date:
10/14/2010
Posts:
58
Member Details
Quote from Laurina »
Quote from MessiahAndrw »
One possible way could be by recording the OpenGL calls as Minecraft draws one eye then play back the identical calls for the other eye (this introduces some special cases like what if Minecraft updates a texture half way through drawing one eye, do I record and play that back too?) I guess only experimentation will tell!
I think that sounds like a perfectly reasonable approach. I daresay the inconvenience of the special cases would be less than that of the staggered eye output.
But then I might have to modify the code behind every OpenGL call (or at least scan the source for all those that Minecraft uses - not counting any mods that use additional calls like the shader mod) and modify it so it also logs what it's doing.
Another way would be to edit minecraft.jar (which I'd like to avoid because it'll break with an update). If you decompile minecraft.jar with MCP you can see that once per update Timer.updateTimer() is called which calculates how much time has passed since the last frame. If we can get Minecraft to think no time has passed between drawing the first and second eyes then the eyes should theoretically be drawn at the exact same point of time in the Minecraft world.
Timer.updateTimer() uses System.currentTimeMilliseconds() to find out what the current time is so it can calculate the difference since last time. System.currentTimeMilliseconds() is part of the Java runtime library so I don't think I can edit that. I can add a line of code to the top of Timer.updateTimer() so the timer doesn't update if I'm drawing the second eye. This is the easiest method, but the eyes won't be perfectly in synced - if you're in multiplayer and another player's position has updated even if the game thinks no time has passed then the other player will be drawn at a different position for each eye.
There are pros and cons of doing either method, and if I am going to do anything it'll be at the OpenGL level. I'll look into display lists (an OpenGL way of letting you record commands then play them back exactly - though I wonder about the speed of recording into a display list every frame) because it'll beat modifying every OpenGL call.
Of course if you have a steady frame rate >60fps then this is a lot of effort for little result.
Apologies for the long post - it helps to find a solution when you explain the problem aloud! :smile.gif:
The Meaning of Life, the Universe, and Everything.
Join Date:
10/14/2010
Posts:
58
Member Details
I can't find any more information about that extension... :/ I guess nVidia experimented with it then removed it.
I was looking into the source code of Minecraft and it mostly uses OpenGL 1.1 calls and only 3 extensions, so it seems completely feasible to map the OpenGL calls somewhat directly into Direct3D. Of course you'd loose compatibility with GLSL shaders (which we could replace with a new set of HLSL shaders :biggrin.gif:) and it'd fix tons of problems! I could perfectly sync the eyes, it would run significantly faster since I can render directly into a Direct3D texture, the 3D Vision crosshair would show natively, and I could add extra render settings since it'll be purely Direct3D (settings like anti-aliasing and frame smoothing come to mind). I would want to use Direct3D 11 to simplify the wrapper, because it's the only version of Direct3D that has render lists - and render lists enable me to record the drawing commands and play them back multiple times (once for each eye). But using Direct3D 11 will limit my wrapper to only run on Windows Vista and 7. Would loosing compatibility with Windows XP be worth it?
Anyway it's 1:40 AM in Australia so I'm off to bed!
The Meaning of Life, the Universe, and Everything.
Join Date:
10/14/2010
Posts:
58
Member Details
Quote from Laurina »
And, as you say, you could make shaders of your own. Perhaps 3D is just part of what you could be doing here; it could be as sweeping as a generalized Direct3d wrapper for Minecraft which happens to support stereoscopic 3D rendering :biggrin.gif:
I was thinking the same thing. This project was to prove you could use the consumer NVidia 3D Vision kit to play an OpenGL game (a feature I really want myself), and I've shown it can work, but I've reached a performance limitation and now it's time to take my project in a new direction. Perhaps one day it'll be a Direct3D 11 backend that supports custom full screen resolutions, HLSL shader effects, antialiasing, and stereoscopic 3D!
Description:
The MessiahAndrw's Renderer Wrapper is a mod for Minecraft. It enables you to play Minecraft in a variety of 3D modes (the NVidia 3D Vision Kit is supported!) as well as customize the full screen mode. It should be update-safe for now as it does not modify minecraft.jar.
MessiahAndrw, I just tested this wrapper with 1.3_01 on a system running two EVGA 260's in SLI and nVidia 3D Vision, using an emotive headset to control my movement quite literally with my brainwaves and head/face movements ( http://www.emotiv.com -- it's essentially a consumer level EEG and an SDK to interface with it, I have the Research Edition ) while wearing a Logitech G930 (high-end wireless gaming headphone & mic with 7.1 surround) on a 1920x1080 120Hz LCD (Acer GD235HZ).
I am not ashamed to admit that the sheer level of immersion I was able to acheive with the addition of stereoscopic rendering nearly brought me to tears of joy that even all that stuff I mentioned other than the nVidia 3D Vision could just never have done.
You.
Absolutely.
Totally.
Freaking.
ROCK.
Thank you so much for this wrapper. You have made my game so, so much better. This was the last piece I needed until someone comes out with a proper Mind-Machine Interace implant.
Remind me to buy you a dinner, drink, and evening entertainment if you and I ever bump into each other RL.
The Meaning of Life, the Universe, and Everything.
Join Date:
10/14/2010
Posts:
58
Member Details
I'm working on making a native Direct3D 11 backend that intercepts and bypasses the OpenGL calls so all rendering is done in D3D 11, but progress is slow. I've made a list of all of the OpenGL calls Minecraft makes, they're intercepted by my code, and now I have to fill the replacement code in. I've finished the code that emulate's OpenGL's matrix stack and operations, but there is still a lot more to do before I will get the first thing shown on the screen. At the least I must load the textures, load the array pointers, and render the geometry. To get it looking the same as Minecraft I will have to imitate fog and lighting in the pixel shader, and a bunch of other stuff (too tired to think right now!)..
It's just a lot of work.. :/ But I'll power through and it'll be done before I know!
I'm looking forward to the end result when I can experiment with some nice HLSL shaders! :smile.gif:
when I try to play the game, it says "Can not create texture for left eye" and then closes the application. Do you know what the problem is? I have Left and Right in my .minecraft directory.
The Meaning of Life, the Universe, and Everything.
Join Date:
10/14/2010
Posts:
58
Member Details
I'm letting people know that while I have been silent work is still progressing on my Direct3D 11 port! It just takes time to emulate OpenGL's functionality in D3D shaders, and I'm also attending university lectures, working on assignments, and my honours project. Sorry for the wait people!
Quote from Xuanz »
when I try to play the game, it says "Can not create texture for left eye" and then closes the application. Do you know what the problem is? I have Left and Right in my .minecraft directory.
Hmm.. That tells me Direct3D 9 has loaded but it fails when it tried creating a texture big enough to draw the left eye in. How much video memory do you have (and out of curiosity what video card - you can find out both of these by running 'dxdiag')?
I bought some 3d glasses. The 3d effect is there, but I keep getting alot of ghosting on the red lens. On the cyan lens I only see one image. It's really annoying, and I've tried so many different settings, but still can't get it to work right. Any tips? I bought these glasses from amazon http://www.amazon.com/gp/product/B002T0D81C/ref=oss_product
Rollback Post to RevisionRollBack
If I have solved your problem please reply. It helps future players, and lets me know my job is done.
I'm working on making a native Direct3D 11 backend that intercepts and bypasses the OpenGL calls so all rendering is done in D3D 11, but progress is slow. I've made a list of all of the OpenGL calls Minecraft makes, they're intercepted by my code, and now I have to fill the replacement code in. I've finished the code that emulate's OpenGL's matrix stack and operations, but there is still a lot more to do before I will get the first thing shown on the screen. At the least I must load the textures, load the array pointers, and render the geometry. To get it looking the same as Minecraft I will have to imitate fog and lighting in the pixel shader, and a bunch of other stuff (too tired to think right now!)..
It's just a lot of work.. :/ But I'll power through and it'll be done before I know!
I'm looking forward to the end result when I can experiment with some nice HLSL shaders! :smile.gif:
When you get all THAT done... take a look at the newest nVidia GeForce drivers... they support 3D Windowed Mode.
If you could manage to get THAT working too... well... that would have to be some very fun evening entertainment I'd owe you (ref: my prior post]. But hey, I make good money (as if the toys I mentioned in my previous post didn't kinda inadvertently hint that. :wink.gif: ).
This mod seems like it could have serious potential. Unfortunately, however, I am unable to run it. When I initialize the application, I go through the settings and such, but whenever I attempt to play Minecraft, it tells me that it could not render the left eye. Please help. Computer specifications below:
=======================================
Operating System: Windows 7 Home Premium x64
Graphics Card Memory: 1GB
Graphics Software: NVIDIA 3.4.772.04
Minecraft Version: B1.3_01
RAM: 6GB
DirectX Version: 9
Using ModLoader?: Yes
Does It Matter?: No idea
Paging File Size: 9GB
=======================================
Any help you can provide is greatly appreciated. I can provide additional details if needed. I would very much like to see this really become something. I also wish I could see it at all.
This mod seems like it could have serious potential. Unfortunately, however, I am unable to run it. When I initialize the application, I go through the settings and such, but whenever I attempt to play Minecraft, it tells me that it could not render the left eye. Please help. Computer specifications below:
Out of curiosity, which 3D technique were you trying to use? What model of graphics card do you have? If you were trying to use nVidia 3D Vision, do you have both the 3D Vision kit AND a certified nVidia 3D Vision ready monitor AND a graphics card which is 8800 or above (9k series, 200 series, 400 or 500 series)? I'm not the mod's developer but a lot of information that would likely be needed is missing from the specs you give. Which driver version is your graphics card, be it nVidia or AMD, running? Be sure you provide enough detail for the developer to trace data flow all the way from loading the game (game version, which you provided) all the way to the light hitting your eye or at least to the monitor (depending on if you're using nVidia's 3D vision or not -- to the monitor if not).
i get the same problem... it says it could not render texture for left eye in windowed mode, and just doesnt show in fullscreen.
EDIT: nvrmind. all i had to do was choose the width and height. no sweat... even though it said it would choose the desktop if i left it empty.
You're welcome!
I have more ideas on how to speed this up. I definitely know the performance problem exists at the OpenGL/Direct3D border - probably because each frame is going GPU(GL)->CPU->GPU(D3D) - at 1920x1080/32bbp that's 8,294,400 bytes each way per eye per frame! I've discovered there are some OpenGL extensions that allow you to use Direct3D resources - specifically let OpenGL draw straight into a Direct3D surface. Hopefully if used correctly the GPU will draw straight into the Direct3D texture without needing to transfer anything through the CPU. But, the problem with OpenGL extensions is they're vendor specific - this extension I'm looking at is nVidia specific.
That's actually a more interesting problem than it first seems. My code is working at the OpenGL layer and has no concept of what Minecraft is doing. So I can't tell Minecraft to draw the scene twice, so instead I let the game loop run twice - once for the left eye and once for the right eye so you're actually getting alternating frames to each eye. If you can maintain a steady 60fps (30fps per eye) this should be no problem, actually if you can maintain 120fps then each eye is updating as fast as the NVidia 3D Vision glasses can show. Anyway I do agree that it is distracting at choppy framerates. I'll look into ways to get the eyes rendering together. One possible way could be by recording the OpenGL calls as Minecraft draws one eye then play back the identical calls for the other eye (this introduces some special cases like what if Minecraft updates a texture half way through drawing one eye, do I record and play that back too?) I guess only experimentation will tell!
Thank you!
Cross-eyed is a bit difficult to focus first, and works best if you're playing the game in a small window or sitting a bit back from the screen. Also I wouldn't recommend playing it for half a day straight on cross-eyed unless you want some serious eye strain. But it is a cheap way to try out 3D without needing any special kind of glasses.
Basically the image the right eye sees is shown on the left half of the screen, and vice versa. Then you look at your screen cross-eyed. As you go cross-eyed you'll notice the two images come closer together and overlap. Try to get them to overlapped perfectly (in my experience this is easier if you focus on something static like the cross hair while wiggling the mouse so the background animates).
But then I might have to modify the code behind every OpenGL call (or at least scan the source for all those that Minecraft uses - not counting any mods that use additional calls like the shader mod) and modify it so it also logs what it's doing.
Another way would be to edit minecraft.jar (which I'd like to avoid because it'll break with an update). If you decompile minecraft.jar with MCP you can see that once per update Timer.updateTimer() is called which calculates how much time has passed since the last frame. If we can get Minecraft to think no time has passed between drawing the first and second eyes then the eyes should theoretically be drawn at the exact same point of time in the Minecraft world.
Timer.updateTimer() uses System.currentTimeMilliseconds() to find out what the current time is so it can calculate the difference since last time. System.currentTimeMilliseconds() is part of the Java runtime library so I don't think I can edit that. I can add a line of code to the top of Timer.updateTimer() so the timer doesn't update if I'm drawing the second eye. This is the easiest method, but the eyes won't be perfectly in synced - if you're in multiplayer and another player's position has updated even if the game thinks no time has passed then the other player will be drawn at a different position for each eye.
There are pros and cons of doing either method, and if I am going to do anything it'll be at the OpenGL level. I'll look into display lists (an OpenGL way of letting you record commands then play them back exactly - though I wonder about the speed of recording into a display list every frame) because it'll beat modifying every OpenGL call.
Of course if you have a steady frame rate >60fps then this is a lot of effort for little result.
Apologies for the long post - it helps to find a solution when you explain the problem aloud! :smile.gif:
"The first support is added a year ago, but from time to time this extension disappears from the drivers implementation."
I'm going to continue my investigation.. o_o
I was looking into the source code of Minecraft and it mostly uses OpenGL 1.1 calls and only 3 extensions, so it seems completely feasible to map the OpenGL calls somewhat directly into Direct3D. Of course you'd loose compatibility with GLSL shaders (which we could replace with a new set of HLSL shaders :biggrin.gif:) and it'd fix tons of problems! I could perfectly sync the eyes, it would run significantly faster since I can render directly into a Direct3D texture, the 3D Vision crosshair would show natively, and I could add extra render settings since it'll be purely Direct3D (settings like anti-aliasing and frame smoothing come to mind). I would want to use Direct3D 11 to simplify the wrapper, because it's the only version of Direct3D that has render lists - and render lists enable me to record the drawing commands and play them back multiple times (once for each eye). But using Direct3D 11 will limit my wrapper to only run on Windows Vista and 7. Would loosing compatibility with Windows XP be worth it?
Anyway it's 1:40 AM in Australia so I'm off to bed!
I was thinking the same thing. This project was to prove you could use the consumer NVidia 3D Vision kit to play an OpenGL game (a feature I really want myself), and I've shown it can work, but I've reached a performance limitation and now it's time to take my project in a new direction. Perhaps one day it'll be a Direct3D 11 backend that supports custom full screen resolutions, HLSL shader effects, antialiasing, and stereoscopic 3D!
MessiahAndrw, I just tested this wrapper with 1.3_01 on a system running two EVGA 260's in SLI and nVidia 3D Vision, using an emotive headset to control my movement quite literally with my brainwaves and head/face movements ( http://www.emotiv.com -- it's essentially a consumer level EEG and an SDK to interface with it, I have the Research Edition ) while wearing a Logitech G930 (high-end wireless gaming headphone & mic with 7.1 surround) on a 1920x1080 120Hz LCD (Acer GD235HZ).
I am not ashamed to admit that the sheer level of immersion I was able to acheive with the addition of stereoscopic rendering nearly brought me to tears of joy that even all that stuff I mentioned other than the nVidia 3D Vision could just never have done.
You.
Absolutely.
Totally.
Freaking.
ROCK.
Thank you so much for this wrapper. You have made my game so, so much better. This was the last piece I needed until someone comes out with a proper Mind-Machine Interace implant.
Remind me to buy you a dinner, drink, and evening entertainment if you and I ever bump into each other RL.
It's just a lot of work.. :/ But I'll power through and it'll be done before I know!
I'm looking forward to the end result when I can experiment with some nice HLSL shaders! :smile.gif:
My Clan:
[simg]http://i.imgur.com/h1Atq.gif[/simg]
My stories:(1)
[simg]http://i1081.photobucket.com/albums/j357/Nguyeninja/6kftusig.jpg?t=1295835928[/simg]
Hmm.. That tells me Direct3D 9 has loaded but it fails when it tried creating a texture big enough to draw the left eye in. How much video memory do you have (and out of curiosity what video card - you can find out both of these by running 'dxdiag')?
I was getting a black screen until I clicked on the link in the first post, and installed DX using that.
When you get all THAT done... take a look at the newest nVidia GeForce drivers... they support 3D Windowed Mode.
If you could manage to get THAT working too... well... that would have to be some very fun evening entertainment I'd owe you (ref: my prior post]. But hey, I make good money (as if the toys I mentioned in my previous post didn't kinda inadvertently hint that. :wink.gif: ).
=======================================
Operating System: Windows 7 Home Premium x64
Graphics Card Memory: 1GB
Graphics Software: NVIDIA 3.4.772.04
Minecraft Version: B1.3_01
RAM: 6GB
DirectX Version: 9
Using ModLoader?: Yes
Does It Matter?: No idea
Paging File Size: 9GB
=======================================
Any help you can provide is greatly appreciated. I can provide additional details if needed. I would very much like to see this really become something. I also wish I could see it at all.
Thanks,
TheMusiKid
Out of curiosity, which 3D technique were you trying to use? What model of graphics card do you have? If you were trying to use nVidia 3D Vision, do you have both the 3D Vision kit AND a certified nVidia 3D Vision ready monitor AND a graphics card which is 8800 or above (9k series, 200 series, 400 or 500 series)? I'm not the mod's developer but a lot of information that would likely be needed is missing from the specs you give. Which driver version is your graphics card, be it nVidia or AMD, running? Be sure you provide enough detail for the developer to trace data flow all the way from loading the game (game version, which you provided) all the way to the light hitting your eye or at least to the monitor (depending on if you're using nVidia's 3D vision or not -- to the monitor if not).
EDIT: nvrmind. all i had to do was choose the width and height. no sweat... even though it said it would choose the desktop if i left it empty.