Drawing to the Depth Buffer
I want to load a grayscale image or texture and draw that to the depth buffer, how is this possible?
Sir, e^iπ + 1 = 0, hence God exists; reply!
I think glDrawPixels can do that. I'm sure the gurus here will have some fancier (faster) solution.
Why are you trying to do this anyway?
Why are you trying to do this anyway?
"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
I aim to render color and depth images in a raytracer of the background scenes for a game, then setting the opengl projection matrix (or custom camera class probably) to the same as in the renders I should be able to have 3D models casting shadows and so on in a prerendered background.
Using a low poly model of the scene would also work but when shadows dont require any information about the scene's geometry, it would be great to have as high quality graphics as possible.
Draw pixels can do it, thanks! Ill see how fast I can get this to run.
Using a low poly model of the scene would also work but when shadows dont require any information about the scene's geometry, it would be great to have as high quality graphics as possible.
Draw pixels can do it, thanks! Ill see how fast I can get this to run.
Sir, e^iπ + 1 = 0, hence God exists; reply!
Could you not use lightmaps for the low poly models?
"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Making low poly models would be quite a hassle especially considering the amount of scenes that will be made, its also a lot less detailed than a depth render and so I really want to avoid that if at all possible.
glDrawPixels works, seems to be fast enough too (at 640x480)
If there are any speed improvments though, please tell me because I want to get this to work on as slow a computer as possible while still looking great
glDrawPixels works, seems to be fast enough too (at 640x480)
If there are any speed improvments though, please tell me because I want to get this to work on as slow a computer as possible while still looking great
Sir, e^iπ + 1 = 0, hence God exists; reply!
DrawPixels is your only option without any OpenGL extensions, I think.
It's horribly slow, though.
I suspect you'll find that using a texture and modifying the fragment's depth based on that texture using a fragment program will be much faster on capable hardware.
It's horribly slow, though.
I suspect you'll find that using a texture and modifying the fragment's depth based on that texture using a fragment program will be much faster on capable hardware.
Unfortunately, you have a GeForce 2 MX, right? I doubt you will be able to do anything other than glDrawPixels on your graphics card, since I don't know if you can even get the depth texture, and I know you can't use any shaders, vertex or fragment. It looks like if you want any faster method, you'll have to wait until you upgrade.
See? I told you a guru would be along shortly.
"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
Found some pages that might help.
http://www.gamasutra.com/features/199911...em_pfv.htm
http://64.233.167.104/search?q=cache:YXI...ent=safari
http://www.gamasutra.com/features/199911...em_pfv.htm
http://64.233.167.104/search?q=cache:YXI...ent=safari
Thank you all.
glDrawPixels is working nicely, I have a triangle moving around a prerendered cube.
Also I hadn't though about a dirty rect's like system for updating the background, that should be a good speed optimisation (from the star wars link).
Anyway, theres more precision close to zNear and very little close to zFar. So I need to do somthing to account for that.
glDrawPixels is working nicely, I have a triangle moving around a prerendered cube.
Also I hadn't though about a dirty rect's like system for updating the background, that should be a good speed optimisation (from the star wars link).
Anyway, theres more precision close to zNear and very little close to zFar. So I need to do somthing to account for that.
Sir, e^iπ + 1 = 0, hence God exists; reply!
unknown Wrote:Anyway, theres more precision close to zNear and very little close to zFar. So I need to do somthing to account for that.
I think that's always the case.
"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
unknown Wrote:Anyway, theres more precision close to zNear and very little close to zFar. So I need to do somthing to account for that.
Especially if you are using 8bit depth values in your stored images. Make sure you are clamping those near and far planes as close as possible.
Also, what are the GL_DEPTH_COMPONENT* texture formats for? I figured they were for this type of situation.
depth textures are only available on GeForce 3+ and Radeon 9500+, so ed won't want to use them.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| SLOW performance drawing multiple polygons per frame with stencil buffer | clam61 | 7 | 538 |
Apr 27, 2013 11:53 AM Last Post: clam61 |
|
| Depth Buffer Question | AnotherJake | 10 | 4,018 |
Sep 23, 2008 01:43 PM Last Post: AnotherJake |
|
| problems getting the depth buffer | akb825 | 3 | 3,788 |
Jun 2, 2006 12:51 PM Last Post: akb825 |
|
| Depth Buffer / Testing basic question... | WhatMeWorry | 5 | 5,881 |
Nov 18, 2005 12:50 AM Last Post: arekkusu |
|
| Reading from the Depth Buffer | Joseph Duchesne | 2 | 2,798 |
Jun 16, 2005 04:51 PM Last Post: OneSadCookie |
|

