Author Topic: [Help please] Mode 7.  (Read 7908 times)

0 Members and 1 Guest are viewing this topic.

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
[Help please] Mode 7.
« on: December 25, 2010, 06:01:23 pm »
ok, so i read wikipedia's thoughts about mode 7 and i am even more confused.

can someone explain this please?

mostly about the matrices.

"Planar texture maps using Mode 7 graphics are generated by transforming screen coordinates to background coordinates using a 2D affine transformation,


umm??? VVV
    \begin{bmatrix} x' \\ y' \\ 1 \end{bmatrix} = \begin{bmatrix} a & b & x_0 \\ c & d & x_0 \\ 0 & 0 & 1 \end{bmatrix} \begin{bmatrix} x - x_0 \\ y - y_0 \\ 1 \end{bmatrix}

where a, b, c, and d are the transformation coefficients; x and y are the screen offset; x_0 and y_0 are the origin offset; and x' and y' are the transformed coordinates. All arithmetic is carried out on 16-bit signed fixed point numbers, while all offsets are limited to 13 bits. The radix point is between bits 7 and 8.

Affine transformations only allow for displacement, scaling, and shearing effects. Many games create additional effects through creative manipulation of the transformation matrix parameters on a scanline by scanline basis. In this way pseudo-perspective, curved surface, and distortion effects can be achieved"
« Last Edit: December 25, 2010, 06:03:26 pm by happybobjr »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: [Help please] Mode 7.
« Reply #1 on: December 25, 2010, 06:12:23 pm »
Here's a nice post about it by JimE on Revsoft: http://www.revsoft.org/phpBB3/viewtopic.php?p=14409#p14409

If you don't understand it, I'll be happy to explain more.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: [Help please] Mode 7.
« Reply #2 on: December 25, 2010, 06:20:30 pm »
Please elaborate, I may have an idea...
But I can't really understand it yet.  ;)

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Help please] Mode 7.
« Reply #3 on: December 25, 2010, 06:22:01 pm »
Is that what you used on your


sorry, but that doesn't have enough info.
How would i make it?
« Last Edit: December 25, 2010, 06:25:22 pm by happybobjr »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: [Help please] Mode 7.
« Reply #4 on: December 25, 2010, 06:26:00 pm »
I worked out all the math on paper (it involved lots of similar triangles :D)

The thing to remember is that to figure out what each pixel is, you have to cast a ray through each screen pixel (as if there was a floating screen in the virtual space). This is how raytracing works, but this has much simpler math because you're only intersecting with a flat plane.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Help please] Mode 7.
« Reply #5 on: December 25, 2010, 06:28:25 pm »
can you give me a small code example of a small mode 7 screen or something?
« Last Edit: December 25, 2010, 06:28:33 pm by happybobjr »
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: [Help please] Mode 7.
« Reply #6 on: December 25, 2010, 06:28:44 pm »
so in for a car on a straight road, how would you figure out how the road shows up on a screen?

me too!  ;)
« Last Edit: December 25, 2010, 06:29:39 pm by yunhua98 »

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Help please] Mode 7.
« Reply #7 on: December 25, 2010, 06:44:57 pm »
can we see the program you used for
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline yunhua98

  • You won't this read sentence right.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2718
  • Rating: +214/-12
  • Go take a dive in the River Lethe.
    • View Profile
Re: [Help please] Mode 7.
« Reply #8 on: December 25, 2010, 06:46:36 pm »
I beleive the program is in F-Zero subforum, however, its in ASM

Spoiler For =====My Projects=====:
Minor setback due to code messing up.  On hold for Contest.
<hr>
On hold for Contest.


Spoiler For ===Staff Memberships===:






Have you seen any good news-worthy programs/events?  If so, PM me with an article to be included in the next issue of CGPN!
The Game is only a demo, the code that allows one to win hasn't been done.
To paraphrase Oedipus, Hamlet, Lear, and all those guys, "I wish I had known this some time ago."
Signature Last Updated: 12/26/11
<hr>

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: [Help please] Mode 7.
« Reply #9 on: December 25, 2010, 06:48:50 pm »
so in for a car on a straight road, how would you figure out how the road shows up on a screen?

me too!  ;)
You would essentially pick a point on the road away from you, and draw a line from your "eye" through the screen to where the point on the road is.  The distance between your eye and the screen (d1), and the distance between your eye and the point on the road (technically the point above the road that is directly in line with the first line (the one that makes d1) is what you would use instead of the point itself) This is d2.  You would then compare the height from the point on the ground to the point in the air that is eye-level.  This is r2.  So d1/d2=r1/r2.  Since r1 is what we need to find, (r2 * d1)/d2 = r1.  That is the point on the screen.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: [Help please] Mode 7.
« Reply #10 on: December 25, 2010, 06:57:54 pm »
If you want to see the Axe version I made a while back, you can download the source code here but it doesn't have rotation.  One confusing optimization that programs like these use though is to remove the multiplication in the main loop and replace it with an addition.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: [Help please] Mode 7.
« Reply #11 on: December 25, 2010, 06:58:56 pm »
I made an image here for you. Lines of the same color are similar, meaning the ratio is the same within each of the pairs of lines of the same color.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Help please] Mode 7.
« Reply #12 on: December 25, 2010, 06:59:20 pm »
ok, could i edit the code to have rotation?
If you want to see the Axe version I made a while back, you can download the source code here but it doesn't have rotation.  One confusing optimization that programs like these use though is to remove the multiplication in the main loop and replace it with an addition.
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: [Help please] Mode 7.
« Reply #13 on: December 25, 2010, 07:03:28 pm »
Oh, and the method you actually use for getting the points is by going out to the end of the bright green line, and then the points are evenly spaced along the blue line.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline jnesselr

  • King Graphmastur
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2270
  • Rating: +81/-20
  • TAO == epic
    • View Profile
Re: [Help please] Mode 7.
« Reply #14 on: December 25, 2010, 07:08:24 pm »
One confusing optimization that programs like these use though is to remove the multiplication in the main loop and replace it with an addition.
How exactly would you do that with addition?