#93857 - dak - Fri Jul 21, 2006 6:03 pm
I'd like to always draw a polygon behind anyother polygon. Is it possible for me to somehow keep it in the back no matter what? Sort of like draw whereever I want for a period of time, and then all other draw calls afterward will draw over it.
-dak
#93920 - HyperHacker - Sat Jul 22, 2006 12:08 am
Code: |
glDisable(GL_DEPTH_TEST};
//Draw Polygon A here
glEnable(GL_DEPTH_TEST};
//Draw other polygons here |
Polygon A will always be behind the others. Order is important though:
Code: |
glEnable(GL_DEPTH_TEST};
//Draw other polygons here
glDisable(GL_DEPTH_TEST};
//Draw Polygon A here |
With this version, A will always be in front.
_________________
I'm a PSP hacker now, but I still <3 DS.
#93927 - dak - Sat Jul 22, 2006 12:30 am
The response is much appreciated, but there is no GL_DEPTH_TEST definition as far as I can tell :$
(In libnds that is)
-dak
#93958 - dak - Sat Jul 22, 2006 2:33 am
This may or may not be stupid to ask, but is there a way for me to access the z-buffer directly?
-dak
#93965 - tepples - Sat Jul 22, 2006 3:14 am
You can do so using display capture with a few lighting tricks.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#94139 - dak - Sun Jul 23, 2006 8:41 am
:$ I was curious if it were possible to fudge with the draw order of the polygons (specifically to draw a skybox around my terrain). Tho I'm grateful for the possibilities the video capture introduces, I dont think it can quite solve my problem. I am quite open to ideas tho!
The code (psuedo) I am interested in is:
glDisable(DEPTH_TEST);
DrawSkyBox("awesome box!");
glEnable(DEPTH_TEST);
DrawTerrain("Grassy_textures.pcx");
Can someone give me an idea as to how depth is determined on the NDS? Perhaps I can figure something out if I had a deeper understanding of the device's z-ordering.
-dak
#94148 - tciny - Sun Jul 23, 2006 11:53 am
Why don't you just draw your skybox before adding any translations to the view matrix and then draw the rest of the scene onto there. Whereever there is no terrain painted the skybox will be visible...
I think it'd be more interesting to modify the depth values per pixel because it'd allow people to create sort of a displacement mapping approach where the contours of an object get extra detail without having to increase the polycount...
#94207 - dak - Sun Jul 23, 2006 8:17 pm
tciny wrote: |
Why don't you just draw your skybox before adding any translations to the view matrix and then draw the rest of the scene onto there. Whereever there is no terrain painted the skybox will be visible... |
Thats exactly the idea, but without the ability to disable depth testing, the hardware will still properly order the pixels :( I'd love to know how (if at all possible) to modify the zbuffer, but I'm starting to think that there is different way the nds handles it.
-dak
#94215 - sajiimori - Sun Jul 23, 2006 9:16 pm
If all else fails, you could draw the sky box at a great distance (using an orthographic projection) and make sure nothing in the world is that far away.
The skies in my last game were just distant models in regular world space and it looked fine. YMMV.
#94222 - HyperHacker - Sun Jul 23, 2006 10:31 pm
If you just want a sky, can't you use one of the 2D layers?
_________________
I'm a PSP hacker now, but I still <3 DS.
#94230 - tepples - Sun Jul 23, 2006 11:11 pm
Will a sky drawn with the 2D layers properly move when the camera moves? Did you mean draw it as an infinite "mode 7" ceiling with a rotation background?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#94283 - HyperHacker - Mon Jul 24, 2006 6:58 am
Eh, I guess if you want a lot of detail. Many N64 games just drew the sky as a polygon with a single gradient/texture behind everything else using an orthographic projection, then threw in some clouds. Mario Kart 64 is a good example; the clouds are separate polygons, the sky itself is just a big gradient. On such a small screen I don't think people are going to be looking for constellations anyway. ;-)
(Now here comes someone to point out the constellations in AC:WW...)
_________________
I'm a PSP hacker now, but I still <3 DS.
#94290 - dak - Mon Jul 24, 2006 7:50 am
I was actually thinking of using a 2D layer to solve my sky issues. If its possible to leave undrawn space as "see thru" area, then I could draw my skybox and capture the screen. I would then paste that as a full screen image and draw over it the rest of the scene. From my understanding, tho, wouldnt that use up 1/60 to draw the sky then 1/60 to draw the terrain? Seems sorta wastefull to me to drop the frame rate to 30 for just a sky (theres gotta be some way to disable z ordering!).
-dak
#94346 - tepples - Mon Jul 24, 2006 2:02 pm
HyperHacker wrote: |
Eh, I guess if you want a lot of detail. Many N64 games just drew the sky as a polygon with a single gradient/texture behind everything else using an orthographic projection, then threw in some clouds. Mario Kart 64 is a good example; the clouds are separate polygons, the sky itself is just a big gradient. |
And in Goldeneye, the clouds in the area outside the Severnaya bunker look like a "Mode 7" plane.
Quote: |
On such a small screen I don't think people are going to be looking for constellations anyway. ;-) |
Unless of course, you're making some sort of Katamari Dama-Shii clone, where rebuilding the constellations is the goal.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#94466 - dovoto - Mon Jul 24, 2006 10:08 pm
Two things: First the DS maintains its z buffer for one scanline only which means no access is possible (crapy i know).
second: I have never did figure out how to dissable depth testing on the DS which is why there is no GL_DEPTH_TEST in the lib. You could try looking into the bits of the gfx control register or perhaps in the polygon atribute registers.
I recomend you just draw a box and then scale to push it out past your other farthest polygons.
_________________
www.drunkencoders.com
#94679 - dak - Tue Jul 25, 2006 7:20 pm
I cry a million tears. :( I want to avoid scaling a box so bad. Though it would look fine in the general case, a texture wrapped around it will tend to warp at the edges giving it that distinct "wall" feeling. On the flip side, Ortho sky boxes are practically impossible w/o disabling z-ordering.
I tried playing around with the registers you mentioned, but I'm no pro at that sort of thing. I basically XOR'd each bit one at a time then two three and four at a time (I'm like a caveman!).
hmm... Gotta think of something --
-dak
#94720 - tepples - Tue Jul 25, 2006 10:21 pm
dak wrote: |
I cry a million tears. :( I want to avoid scaling a box so bad. Though it would look fine in the general case, a texture wrapped around it will tend to warp at the edges giving it that distinct "wall" feeling. |
Not if you draw the texture properly.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#94862 - M3d10n - Wed Jul 26, 2006 2:47 pm
Dude, you still don't get it. There is no need to disable the depth test: if your box is centered around the camera, it will look exactly the same no matter how small/big it is. As long as you have proper skybox textures.
I used to do 3D stuff with Macromedia Director years ago, and there was on way to disable depth testing there, and the "large box" trick worked just fine. At least try it before dismissing it.
#94934 - dak - Wed Jul 26, 2006 10:55 pm
Set phazers to chill!
Really tho, I have tried but I'm just an uber stickler for certain visual effects (this being one of them). I am aware that a similar effect can be obtained by centering a cube and scaling it to something large, but this can only be accomplished via a perspective projection (as opposed to ortho). I also agree that there aren't very many end-users looking for the big dipper, but as the developer/artist I seek to build my world as convincing as possible within the limitations imposed (which is what makes NDS programming so much fun!).
Imagine being an ant in a large cardboard box whose sides have perfectly parallel lines drawn. From even the center of the box, looking directly down one end, the lines will seem to draw closer and closer and even begin to appear smaller. That is the distortion I refer to when I speak about the usage of a perspective projection. With an ortho projection, that doesn't happen as no matter what distance of the box you look at, its all the same size! This means that no matter how you look at a texture drawn on it, it'll maintain it's look.
Unfortunately, you can't really control the location of an ortho projection; the easiest place to put it is immeadiately around the camera. Tho point of this topic was the investigation as to the z-ordering functions of the NDS, not to debate if perspective projections is ub3r 1337 enough. I prefer using ortho, hell I even like the word. Ortho Ortho Ortho Ortho Ortho Ortho, but I digress;
Theres gotta be some sort of z-ordering control put in by the big-N!
I love you all.
-dak
#94944 - tepples - Wed Jul 26, 2006 11:29 pm
dak wrote: |
Imagine being an ant in a large cardboard box whose sides have perfectly parallel lines drawn. From even the center of the box, looking directly down one end, the lines will seem to draw closer and closer and even begin to appear smaller. That is the distortion I refer to when I speak about the usage of a perspective projection. |
Now imagine the inside of the box is phosphorescent. Shine a spotlight with a circular illumination area from a point near the center toward one of the corners of the box. Then shut off the spotlight and put a camera at the same point. It'll still look like a circle.
Quote: |
I prefer using ortho, hell I even like the word. Ortho Ortho Ortho Ortho Ortho Ortho, but I digress; |
Is it that you own stock in the company that makes Weed-B-Gon?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#94951 - dak - Thu Jul 27, 2006 12:03 am
tepples wrote: |
Is it that you own stock in the company that makes Weed-B-Gon? |
HA! :D I don't, but maybe this is a sign!