Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MODE7 sample #24

Closed
hoit opened this issue Feb 25, 2019 · 15 comments
Closed

MODE7 sample #24

hoit opened this issue Feb 25, 2019 · 15 comments

Comments

@hoit
Copy link
Collaborator

hoit commented Feb 25, 2019

Hello,

I tried Mode7 sample under graphics/Backgrounds folder but it miss few lines of code.
sz et sx variable are declared but not used (except to increase/decrease it).

scanPads() function is called and i thought it was no more useful (already included in other function?) but in this sample if i remove it, keys are not updated. Maybe because Mode7 functions are specific ? (like consoleVblankMode7)

I tried setMode7Angle function but it don't seems change something.
I see in source code that 2 other functions exists (these functions are not available in documentation) : setMode7MoveForwardBack and setMode7MoveLeftRight but they give "implicit declaration of function ...." when i use it.

Could you please update this sample ?

Thanks

@alekmaul
Copy link
Owner

Hi,
Thanks for your reply. But I think I will remove mode7 because it is not really useful regarding the functions I currently did about it (only BG rotation, nothing related to "mario kart" like implementation.

@hoit
Copy link
Collaborator Author

hoit commented Feb 25, 2019

I find it is not a good idea. If you remove it, nobody will try to improve it or implement new functionalities for this mode. I think you already spent a lot of time on it so it should be better to separate in a new branch or in develop branch and why not create a roadmap to specify list of improvements to do :)

@alekmaul
Copy link
Owner

ok, right. I will update the example and try to clean a little mode7 code (some const are not used by the code) :)

@RetroAntho
Copy link
Collaborator

I saw this link on mode 7 implementation :
Super-Nintendo Mode 7 : https://github.com/Kannagi/SNES-Mode7
Video: https://youtu.be/ik8gEbf3Et4?t=32

I think it will be useful :)

@mills32
Copy link
Contributor

mills32 commented May 14, 2019

Hi alekmaul, you did a great work with this code!.

I also wanted to test some "mario kart" mode 7, and I saw this video about how it works:
https://youtu.be/K7gWmdgXPgk?t=857

I remember some time ago I compiled the mode7 sample, and it has all necesary functions to do it (I think). You just have to enable a mode 7 background, and then change the scalling every scanline using HDMA. Now scrolling and rotating the background, with the pvsneslib functions you already have, will result in a fake camera moving above the plane.

My programming skills are not good, so I was not able to test it.

Also you can add a sample using HDMA to change the scroll every scanline to make wavy backgrounds.

Thanks!

@alekmaul
Copy link
Owner

Nice video, thanks.
Sadly, as said just previously in this post, I currently have not yet implement it. You can try to check kannagy source code (https://github.com/Kannagi/SNES-Mode7)

@mills32
Copy link
Contributor

mills32 commented May 21, 2019

I did not understand very well the assembly source code from kannagy, so I used the HDMA sample from pvsneslib, and figured out how to change other registers (not just the brightness).

I "kind of" made it work, using only c code and pvsneslib. But the math involved in rotation and zoom in mode 7 is not easy, and the perspective is wrong.

I hope this image can be seen, (for some time at least):
http://i64.tinypic.com/28ujmgz.jpg

If someone is interested and knows a bit of math... :)

@hoit
Copy link
Collaborator Author

hoit commented May 22, 2019

You can upload a picture and display it directly in github without using a link on internet. You just need to drag and drop it in the text area.

You first result is cool and near the final known result.
Is it possible to upload it here (you can do it with zip files like with pictures) ?

@mills32
Copy link
Contributor

mills32 commented May 23, 2019

Ok here it is.

Untitled

I'm going to try a few things just in case I can make the perspective look ok. If I can't fix it, I'll upload the code.

@mills32
Copy link
Contributor

mills32 commented May 23, 2019

I got it!. It does not rotate, (That part is not easy...), but it looks perfect.

I used the sky and map from kannagy's sample:

screenshot

Here you have the source and compiled sample:

Mode7_Perspective.zip

@hoit
Copy link
Collaborator Author

hoit commented May 23, 2019

I tried it ! thanks, it is really impressive. There no much line to produce it :)
The format of different tables doesn't seems me really clear but i guess that it is DMA constraint ?
I am sure that Alekmaul will be happy too to use it and improve the lib!

What's your next objective ? :)

@mills32
Copy link
Contributor

mills32 commented May 23, 2019

I tried it ! thanks, it is really impressive. There no much line to produce it :)
The format of different tables doesn't seems me really clear but i guess that it is DMA constraint ?
I am sure that Alekmaul will be happy too to use it and improve the lib!

What's your next objective ? :)

You have to watch this video to understand how the tables work: https://www.youtube.com/watch?v=K7gWmdgXPgk&t=526s

@alekmaul
Copy link
Owner

@mills32 , can I add your example to snes examples for next release ?
I will modify it a bit, and don't worry, I will credit you about source code ;)

@mills32
Copy link
Contributor

mills32 commented Nov 29, 2020 via email

@hoit
Copy link
Collaborator Author

hoit commented Dec 14, 2020

Hi,

Thank you, the mode 7 code has been cleaned by Alekmaul for the last release and he added the new perspective sample.

The next step will be probably to add functionality to turn, if someone want to help :)

I close the issue

@hoit hoit closed this as completed Dec 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants