#13860 - shadez - Wed Dec 24, 2003 1:12 am
Hello.
Since I'm know sure that realtime voxel landscapes are possible on gba, does anyone know any good papers about programming them (well, also algorithmical papers)? Or even explain the technique here shortly? I have 3d experience with polygons, but voxels seem to be from other world :(
Thanks and merry christmas :)
- shadez
#13877 - f00l - Wed Dec 24, 2003 10:11 am
yeah .. I would like to know some tips too..
what I have this far :
Mode5 (rot)
a Line draw function
a render function
I can show a little mountain.
people told me that voxel's don't need any perspective,
is that right ? the only thing you have to do is drawing smaller
lines if it has to look "far" away.
anywayz.. I would like to have some tips on making it faster :)
_________________
woei!
#13878 - shadez - Wed Dec 24, 2003 11:28 am
f00l, please tell everything you know about this algorithm, I _may_ be able to point out some optimizations. Because I have absolutely nothing (no idea howto do so-called 3d pixels).
#13888 - tepples - Wed Dec 24, 2003 5:32 pm
First, make a simple Wolf3d-style raycaster engine with flat shading instead of texture mapping. Then make one where each map space can have a height. Now you have a Comanche-style height map engine.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#13907 - shadow_gg - Wed Dec 24, 2003 8:26 pm
that just like drawing an image into a trapeze
had done one and it works fast
good luck
#13940 - shadez - Thu Dec 25, 2003 11:11 am
Ok, thanks for replies. I'm trying to figure out something
#13941 - f00l - Thu Dec 25, 2003 12:04 pm
shadez... here's the cool part of voxels : there are no 3D pixel !!!!
Everybody is talking about 3D pixels (also in tutorials) but the fact is
that you draw lines! something like this :
map=
010
121
010
that would look like this ingame :
0*00
* * *
here's a line draw function I'm using :
draw_vline(int x,int y,int l, int c)
{
int i;
int o=160*x+y;
for(i=0; i<l; i++)
((unsigned short*)0x6000000)[o+i]=c;
}
now you need a raycast-like function so you can render the map :)
_________________
woei!
#13945 - sajiimori - Thu Dec 25, 2003 5:21 pm
The function you posted would actually draw horizontal lines. Here's one that draws a vertical line in mode 3, with a faster approach.
Code: |
#define VRAM ((u16*)0x6000000)
#define TIMES_240(x) (((x) << 8) - ((x) << 4))
faster_and_hopefully_correct_vline(int x, int y, int l, int c)
{
register u16* p = VRAM + TIMES_240(y) + x;
register u16* end = p + TIMES_240(l);
register u16 rc = c;
while(p < end)
{
*p = rc;
p += 240;
}
}
|
#13947 - f00l - Thu Dec 25, 2003 6:11 pm
yeah .. drawing horizontal is faster then vertical.. and the voxel stuff runs in Mode5 (I rotated it and stretch it) so it's pretty fast this way :D
_________________
woei!
#14009 - sajiimori - Sat Dec 27, 2003 9:27 am
Oh, well your function is named "vline" so I assumed it was supposed to draw vertical lines.
Anyway, the approach is slow regardless of what mode it runs in. Avoid the repetitive array access and addition by using pointers.
#14014 - f00l - Sat Dec 27, 2003 12:31 pm
YES!.. you are right.. at first it looks pretty fast, but now, when I load bigger landscapes it become's slow .. I will try to use your version :)
_________________
woei!
#14047 - Maddox - Sun Dec 28, 2003 10:41 am
You guys crack me up!
_________________
You probably suck. I hope you're is not a game programmer.
#14678 - MrMr[iCE] - Sat Jan 10, 2004 11:04 pm
Here's an idea:
You can use the vertical line idea with the speed of horizontal lines by rotating the background 90 degrees. Just tweak the bg rotation registers to flip the screen on its side. So while you raycast the landscape from left to right and figure out what lines to draw vertically, you're really drawing the lines horizontally in vram. In mode 4 you can plot 4 pixels at a time with a single word write, so theres lots of room for improvement there.
I posted a demo a few months ago that does a split screen and tweaks the bitmap bg so it's flipped on its side: Tweakmode 3d.
I also posted an asm version that does the same trick: ASM Tweakmode Demo
_________________
Does the corpse have a familiar face?