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.

Coding > Mode7 Demo

#66131 - sgeos - Sun Jan 08, 2006 12:49 pm

I got rotation and scaling to work with surprisingly little effort. Somehow centerX, centerY, startX, and startY are giving me trouble.

I think I'm having trouble with center of rotation, but I'm not sure. What should the values be? I'm currently calculating these values using something like this:
Code:
baseCenterX = camera.x;
baseCenterY = camera.y;
offsetX =  viewDistance * cos(camera.rotation) / SCANLINES;
offsetY = -viewDistance * sin(camera.rotation) / SCANLINES;

centerX = baseCenterX + scanline * offsetX;
centerY = baseCenterY + scanline * offsetY;
startX = SCREEN_WIDTH / 2;
startY = scanline;

-Brendan

#66157 - Cearn - Sun Jan 08, 2006 4:18 pm

Mode 7 and More mode 7. I'd like to help out right here, but it's kinda hard when none of the terms are defined, and almost none of the math there makes much sense to me. Anyway, everything you need is in the pages I mentioned.

#66271 - sgeos - Mon Jan 09, 2006 11:49 am

I'll have a look at your pages. I want to write a mode 7 demo that shows all scanlines at 100% scaling when:
A) looking straight down, and
B) when at some base viewing height

Changing the pitch should shear the scaling and change the horizon line. Changing the viewing height should scale the map accordingly.

-Brendan

#66275 - Cearn - Mon Jan 09, 2006 12:30 pm

That sounds like what the second page describes (with correct sprite placement thrown in). Check the demo that goes with the text and yoink what you think you can use.

sgeos wrote:
I want to write a mode 7 demo that shows all scanlines at 100% scaling when:
A) looking straight down, and
B) when at some base viewing height

By definition, 100% scaling happens at the focal length, or viewing distance. I've used 128 for that because it makes for a nice division and it looks right (~90? POV), but any one should be possible.

#66319 - DekuTree64 - Mon Jan 09, 2006 7:32 pm

Here's another useful tutorial. It's actually for raycasting, but useful to get a clear picture of the projection plane (where your scale will be 1 to 1) and how to define all the projection attributes.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#66584 - jake2431 - Thu Jan 12, 2006 4:45 am

Can the GBA handle ray-tracing? Non- Perpendicular walls and such. I have only seen demos with ray-casting type psuedo 3d. For example can the GBA handle displaying a mountain range?

#66590 - poslundc - Thu Jan 12, 2006 6:52 am

jake2431 wrote:
Can the GBA handle ray-tracing? Non- Perpendicular walls and such. I have only seen demos with ray-casting type psuedo 3d. For example can the GBA handle displaying a mountain range?


You can write a voxel terrain engine that would run at decent speeds. But it will still use raycasting.

You won't be able to write an actual raytracing engine that achieves a framerate suitable for animation.

Dan.

#66669 - kusma - Thu Jan 12, 2006 8:30 pm

poslundc wrote:

You won't be able to write an actual raytracing engine that achieves a framerate suitable for animation.


actually, i've written multiple raytracing-based effects on the gba that runs on a decent speed. ofcourse, there's heavy faking involved, but they still use raytracing. one example is the parallax-mapped fd-plane in "Newton never did this, BITCH".

#66681 - poslundc - Thu Jan 12, 2006 9:34 pm

kusma wrote:
poslundc wrote:

You won't be able to write an actual raytracing engine that achieves a framerate suitable for animation.


actually, i've written multiple raytracing-based effects on the gba that runs on a decent speed. ofcourse, there's heavy faking involved, but they still use raytracing. one example is the parallax-mapped fd-plane in "Newton never did this, BITCH".


I don't know the specifics of your project, but I doubt the GBA is capable of realizing practical raytracing without imposing some pretty severe constraints on the engine.

Dan.

#66682 - lorbar - Thu Jan 12, 2006 10:11 pm

kusma wrote:
poslundc wrote:

You won't be able to write an actual raytracing engine that achieves a framerate suitable for animation.


actually, i've written multiple raytracing-based effects on the gba that runs on a decent speed. ofcourse, there's heavy faking involved, but they still use raytracing. one example is the parallax-mapped fd-plane in "Newton never did this, BITCH".


btw, that was an impressive demo!

#66731 - tepples - Fri Jan 13, 2006 6:28 am

I couldn't get "Newton" to run in PogoShell on my F2A card. Does it need to be run as the only thing on the cart?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#66771 - kusma - Fri Jan 13, 2006 12:55 pm

tepples wrote:
I couldn't get "Newton" to run in PogoShell on my F2A card. Does it need to be run as the only thing on the cart?


i'm not sure if it's possible to run it through pogoshell, i've never really even tested pogoshell. what would be required to make it runable through it?

#66905 - tepples - Sat Jan 14, 2006 7:11 am

kusma wrote:
tepples wrote:
I couldn't get "Newton" to run in PogoShell on my F2A card. Does it need to be run as the only thing on the cart?

i'm not sure if it's possible to run it through pogoshell, i've never really even tested pogoshell. what would be required to make it runable through it?

I don't know. Just about every other GBA program that I've tested runs fine. Even the commercial GBA games that I've tried work, although that's more a topic for Pocket Heaven. It might be a timing error in your init code.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#66918 - kusma - Sat Jan 14, 2006 12:07 pm

Did you try the F2A-fixed version (http://www.demoscene.no/kusma/newton_f2a-fix.zip) or just the regular one? We originally set the lowest wait-states, as my flash-cart supported it. However, some F2As doesn't.

#66949 - tepples - Sat Jan 14, 2006 5:36 pm

kusma wrote:
Did you try the F2A-fixed version (http://www.demoscene.no/kusma/newton_f2a-fix.zip)

Thanks. Works.

And now back to the show...

Here's Halo 2, a simple demo of mode 7. Who wants the source code?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#67631 - jake2431 - Thu Jan 19, 2006 4:54 pm

I would like the source code. I would like to us mode 7 later and any examples would be cool. BTW, you program makes a creepy music video. It's like you are trying to excape those guys that never stop staring at you, but you can't