gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Accessing video memory in 3D mode

#46860 - revo - Fri Jul 01, 2005 11:30 am

I have one question - are we able to access video memory and z-buffer in 3D mode? I'm going to use prerendered backgrounds in my game and it would be hopefull.

My idea is to render scene, then save it with z-buffer somewhere in memory, and in each frame use it, so when I'll add some polys to scene, they will fit in it, without any problems - hardware should take care of it.

If it's possible, please tell me where to start searching info.
_________________
[ sorry for all mistakes, but my english isn't as good as I wish it to be ]

#46874 - Ethos - Fri Jul 01, 2005 4:47 pm

Not yet....I believe the way we are going to find how to do it is by stepping through a game that uses 3D on both screens, but none have been released yet.
_________________
Ethos' Homepage (Demos/NDS 3D Tutorial)

#46875 - dovoto - Fri Jul 01, 2005 5:09 pm

I have deen told that the DS handles geometry per-scan line and not per frame. I am not certain how true this is but if so it would meen there is no actual frame based z buffer but instead only enough buffer to handle one line at a time. It would also mean that you could not increase poly count by decreasing frame rate nor could you render directly to the "3D frame buffer"; although you could still render one frame on the top screen and the next frame on the bottom screen ...

The only mechanism i know of that does something like what you desire is to stick your pre rendered frame into the three available 2D background layers...If you then arrange the layers by depth you (sortof) have a very low resolution z buffer (about two bits worth and perhaps a bit more if you through sprites into the mix).

The above method, allthough very limited, should be enough to allow some simple mixing between pre rendered scenes and 3D geometry, although you are stuck with all your 3D geometry at the same depth.

I could easily be mistaken as this comes from early speculation more so than any real facts but as of yet i have not seen any game/demo to suggest it works differently.
_________________
www.drunkencoders.com

#46895 - Mr Snowflake - Fri Jul 01, 2005 9:21 pm

Ethos wrote:
Not yet....I believe the way we are going to find how to do it is by stepping through a game that uses 3D on both screens, but none have been released yet.

I believe Another Code: 2 memories has a part where 2 3D screens are used.
Maybe if we copied a 3D rendered screen to a other location in the (v)ram and switched the screens, so the other screen gets the 3D rendering, The first screen could keep the previous renderend screen (we've just copied to another location in the memory). Is this even possible? I was thinking about this while studying, so I might not have thought well about it :D

#46904 - tepples - Fri Jul 01, 2005 10:48 pm

Mr Snowflake wrote:
Maybe if we copied a 3D rendered screen to a other location in the (v)ram and switched the screens, so the other screen gets the 3D rendering, The first screen could keep the previous renderend screen (we've just copied to another location in the memory). Is this even possible?

Yes. Apparently, the official developers (not homebrewers yet) know of a DMA source somewhere that returns the current pixel being drawn by the 3D core. Point the destination at a texture and you can display the texture on the other screen.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#46928 - Ethos - Sat Jul 02, 2005 5:44 am

Mr Snowflake wrote:
I believe Another Code: 2 memories has a part where 2 3D screens are used.
Maybe if we copied a 3D rendered screen to a other location in the (v)ram and switched the screens, so the other screen gets the 3D rendering, The first screen could keep the previous renderend screen (we've just copied to another location in the memory). Is this even possible? I was thinking about this while studying, so I might not have thought well about it :D


Yup, I gave a brief detail of this in the 3d on both screens example. If you look I believe I specified banks C+D for the buffer and mode 5 to display a the buffer when its not the LCD being used by the 3D engine.

Also, I don't think the DS developers know the actual DMA source...but the libraried command they use to DMA from the scanline to a specified VRAM bank.
_________________
Ethos' Homepage (Demos/NDS 3D Tutorial)