#13321 - superx10 - Thu Dec 11, 2003 4:09 am
I wasn't sure if this should or in graphics or coding, so I just put this here...
i'm wondering if it's possible to create a library or something similar that could handle povray code? That would definitely make for some nice raytracers (a bit slow, but everything can be sped up...) I'm pretty good at povray now (thanks to a school project I had to do) and it seems it would be easier for me or whoever to create 3d graphics on the GBA
I mean,
Code: |
light
{ location<200,200,200>
}
sphere
{ location<0,0,0>,1
pigment
{ rgb <1,0,0>
}
finish
{ reflection .2
}
}
plane
{ location<0,-1,0>
pigment
{ rgb <0,1,0>
}
}
camera
{ location <10,10,10> angle 35
look_at<0,0,0>
}
|
seems a lot easier to me than 50,000,000 (exaggeration...) lines of code for the same thing
_________________
"Two wolves are fighting. One wolf is all evil, hate, jealousy and discontent, and the other good, love, happiness and is content." "Sounds like a tough battle. Who wins?" said the old man. “The one I feed”
#13322 - poslundc - Thu Dec 11, 2003 4:20 am
A good idea would be to define the data structures in C that are required to hold all of the information that is held in a POVRay file, then write a program (in C or any other language you desire) for your PC that reads in a POVRay file and spits out a .c text file containing all of the data declarations that are necessary to generate the same information that is in your POVRay file.
This is how I and many others "load" data into our GBA programs. I use it for everything from sprites, to backgrounds, to level information, to music, to fonts, etc. etc.
There are a couple other fancier ways as well, but this is one of the simplest and easiest.
Dan.
#13325 - sajiimori - Thu Dec 11, 2003 5:12 am
Quote: |
seems a lot easier to me than 50,000,000 (exaggeration...) lines of code for the same thing
|
PovRay is just a program that interprets those files and generates graphics based on the data therein. Whether you embed the world data in the program or interpret external data, the code has to be somewhere. In fact, the process of interpreting a foreign file format is more difficult than reading native data structures.
Besides, even in plain C you can define data structures pretty easily. First, describe how the structures will be layed out:
Code: |
typedef struct
{
float x, y, z;
} Vector;
typedef struct
{
float r, g, b;
} Color;
typedef struct
{
Vector location;
Color color;
} Light;
typedef struct
{
Vector location;
Color pigment;
float reflection;
} Sphere;
typedef struct
{
Vector location, look_at;
float angle;
} Camera;
|
Then you can create as many instances of the structures as you want:
Code: |
Light light =
{
location: { 200, 200, 200 }
};
Sphere sphere =
{
location: { 0, 0, 0 },
pigment: { 1, 0, 0 },
reflection: 0.2
};
Camera camera =
{
location: { 10, 10, 10 },
angle: 35,
look_at: { 0, 0, 0 }
};
|
After that it's a matter of writing the code that will use the data to draw the graphics. But if you really want to use the PovRay format, you'll have to write additional code to interpret it.
BTW, you would actually use fixed point math on GBA, rather than floats.
#13366 - superx10 - Thu Dec 11, 2003 11:38 pm
I know that the code has to be somewhere (i'm not a complete idiot) it just seems to me that it would be simpler to read/write it without the clutter in the program, just have a few #includes and lead off from there.
I think i'll be spending a little bit of time on some simple conversion programs. I'd probably also interpret GIMP's color optimization code to reduce images' filesizes + convert them to 256 colors or less.
Seriously, just think of the possibilities with POVray, especially for all those people who keep asking about video intros at the beginning of their programs.
_________________
"Two wolves are fighting. One wolf is all evil, hate, jealousy and discontent, and the other good, love, happiness and is content." "Sounds like a tough battle. Who wins?" said the old man. “The one I feed”
#13372 - Stroff - Fri Dec 12, 2003 12:34 am
POV Ray is a raytracer. While it could be compiled for use on the GBA, it would be extremely slow. Raytracers are relatively simple programs compared to real-time 3d engines, but they require a lot of horsepower and aren't suitable for games (outside of prerendered scenes).
#13380 - superx10 - Fri Dec 12, 2003 2:26 am
true, true but I'm sure if you dummed down the image depth a little and found a way to update the position of moving objects without having to completely re-render the whole scene, it would go a little bit faster at least. I guess in essence you could translate the 3d scene into a 2d image at the position&angle of the camera and use some of the data to draw in the pixels that need to be replaced (IE: if a ball moves left, the pixels to the right of it will need replacing) optionally, you could use the same pixel-guessing method older (and some or maybe even all newer) digital cameras use to draw in the replaced pixels, but i think if you did that, there would be graphical errors and trying to make a non-pixely image would just slow things down even more
_________________
"Two wolves are fighting. One wolf is all evil, hate, jealousy and discontent, and the other good, love, happiness and is content." "Sounds like a tough battle. Who wins?" said the old man. “The one I feed”
#13384 - XeroxBoy - Fri Dec 12, 2003 4:31 am
Quote: |
I'm sure if you ... found a way to update the position of moving objects without having to completely re-render the whole scene, it would go a little bit faster at least |
You'd likely just use sprites for that. In any case, what you seem to be suggesting is to use prerendered backgrounds, a l? Final Fantasy VII? That, certainly, is fine, should you compress your images well enough. On the other hand, as far as I know, it's impossible, no matter how dumbed down the 'image depth' is, to raytrace a scene in realtime on the GBA (in case that's what you were suggesting).
#13410 - superx10 - Fri Dec 12, 2003 10:45 pm
what i was talking about (sorry i'm a bit vague at times) with the prerendered thing you said was for the little movies (like cutscenes maybe) where only objects would be moving. If you truly wanted to make it look 3d, then the reflections would change and the shadows would move as well in relation to the light source, and it really wouldn't be great to use up all of your sprites data for one little movie, then have to erase it and re-load all your other sprites again. sure, you could dynamically load the data for the video sprites, but i think that would just slow things down even more. And what of the palettes? you'd have to reload those too.
EDIT- also, the objects might not fit the size requirements, and you would have to do more math and use up more sprites.
I guess what i meant by dumbing it down was that you could create some macro to quickly do the calculations and return to drawing the images. Optionally i suppose you could find a way to turn it into a hybrid raytracer-raycaster for speed if you wanted the game to be realtime 3d instead of prerendered or point&click. I think the raycaster hybrid idea would be *alright* but not great on the GBA. I would imagine you could do it too because hey, if you can make a good raycaster run quickly in uncompiled QBASIC fullscreen in Windows ME (which i got rid of finally...) on an OLD machine, you should be able to do it with a tracer/caster hybrid on the GBA. that's just my thoughts though, and i'm probably wrong. i'm not even sure how you would go about making a tracer/caster hybrid..
_________________
"Two wolves are fighting. One wolf is all evil, hate, jealousy and discontent, and the other good, love, happiness and is content." "Sounds like a tough battle. Who wins?" said the old man. “The one I feed”
#13412 - Miked0801 - Fri Dec 12, 2003 11:04 pm
GBA - 16Hmz Processor - no Math Coprocessor - no real amount of RAM for storing tables - no GTE unit ala PS1. A GBA is probably about equivilent to a 386SX16 or so with almost no RAM. I doubt the old computer you ran was that old, running through an interpreted language or not. :)
You can write a ray caster that would run pretty quickly on the GBA (ala Doom/Wolfenstein) but not a full ray-tracer.
Mike
#13419 - superx10 - Sat Dec 13, 2003 12:12 am
that's the thing with a hybrid, it would run a little slower than a regular raycaster but the graphics would be a lot smoother
BTW i do have an old 386 sitting unused in my room. It's so awful it can barely run windows 3.11. ahh, the good old days of 8-bit ISA slots and 5 1/4 inch floppy diskettes...
_________________
"Two wolves are fighting. One wolf is all evil, hate, jealousy and discontent, and the other good, love, happiness and is content." "Sounds like a tough battle. Who wins?" said the old man. “The one I feed”