Help scale and rotation sega genesis

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

User avatar
Cristiano Sword
Interested
Posts: 15
Joined: Mon Jul 03, 2017 2:23 pm
Location: Sao Paulo -Sp
Contact:

Help scale and rotation sega genesis

Post by Cristiano Sword » Wed Jan 16, 2019 1:08 pm

Hello guys, could anyone point me to any site or link, that can study scale and rotation of tiles in sega genesis?
if anyone here has any example of a tile, would appreciate it very much :D
I'm trying to do via asm inline by sgdk, unsuccessfully :(
Because of the little that I've been studying there, I have to access the addresses of each pixel individually and redraw them in real time.
Well, I'm stuck here .... :mrgreen: :mrgreen: :mrgreen:
The Mega Drive Will Never Die In Our Hearts.

Project Leyria RPG for Sega Mega Drive / Genesis
https://gendev.spritesmind.net/forum/vi ... php?t=2728

User avatar
Sik
Very interested
Posts: 788
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Help scale and rotation sega genesis

Post by Sik » Thu Jan 17, 2019 8:44 am

You could do it in software, but it's slow as hell (hence "Mega Drive can't do scaling/rotation") so you need to find ways to cheat :​O)

If we're talking about sprites that don't take up the full screen (and you have some bandwidth to spare) these techniques could be useful:
https://plutiedev.com/scaling-sprites
https://plutiedev.com/rotating-sprites

Vertical scaling of a tilemap can be done with raster effects (changing the vertical scroll value every line), though horizontal scaling is a different matter. Other ideas… well, you'll need to find some way where you can afford to cheat and/or be inaccurate and try to come up with ideas that exploit those points.

Note that if you do get it done in software at 30 FPS, you could attempt to "double" it by interlacing (i.e. only rendering half of it each frame, but rather than consecutive parts you render every other line or something like that). It won't look perfect, but done well enough it can be pretty good at fooling people (when I wrote the initial version of the launch bay in Overdrive 2 I managed to fool one of the Titan members that way, even though it was skipping every other pixel in a checkerboard pattern ;​P).
Sik is pronounced as "seek", not as "sick".

User avatar
Cristiano Sword
Interested
Posts: 15
Joined: Mon Jul 03, 2017 2:23 pm
Location: Sao Paulo -Sp
Contact:

Re: Help scale and rotation sega genesis

Post by Cristiano Sword » Thu Jan 17, 2019 5:47 pm

Sik wrote:
Thu Jan 17, 2019 8:44 am
You could do it in software, but it's slow as hell (hence "Mega Drive can't do scaling/rotation") so you need to find ways to cheat :​O)

If we're talking about sprites that don't take up the full screen (and you have some bandwidth to spare) these techniques could be useful:
https://plutiedev.com/scaling-sprites
https://plutiedev.com/rotating-sprites

Vertical scaling of a tilemap can be done with raster effects (changing the vertical scroll value every line), though horizontal scaling is a different matter. Other ideas… well, you'll need to find some way where you can afford to cheat and/or be inaccurate and try to come up with ideas that exploit those points.

Note that if you do get it done in software at 30 FPS, you could attempt to "double" it by interlacing (i.e. only rendering half of it each frame, but rather than consecutive parts you render every other line or something like that). It won't look perfect, but done well enough it can be pretty good at fooling people (when I wrote the initial version of the launch bay in Overdrive 2 I managed to fool one of the Titan members that way, even though it was skipping every other pixel in a checkerboard pattern ;​P).
Thank you for the reply Sik :!:
I was already discouraged :(

I'll start trying to make this raster effects.
I'm trying to do the following effect below:

:arrow:
Image


:arrow:
Image

Hand in the Dough Now! :D
The Mega Drive Will Never Die In Our Hearts.

Project Leyria RPG for Sega Mega Drive / Genesis
https://gendev.spritesmind.net/forum/vi ... php?t=2728

User avatar
Sik
Very interested
Posts: 788
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Help scale and rotation sega genesis

Post by Sik » Thu Jan 17, 2019 6:08 pm

Huuuuh yeah, get good at unrolling loops in asm and cycle counting because you'll need it (and by that I mean "unroll the loops for whole lines"). Although if you only limit yourself to scaling instead of rotation it'll be much easier, so you may want to look into that. I wouldn't expect 60 FPS (unless you figure out some clever trick), but playable speed should be doable.

If you're willing to make some sacrifices (quality vs speed trade-off):
  • Trimming off a bit of the viewport can help improve speed. If it's e.g. 16px at the top and bottom, you could disable display on those lines (with a raster effect) and that'd be 32px more of blanking time (where you can load a lot more of tiles at fast speed using DMA).
  • If you decide to make the horizon visible (i.e. you can see the sky), then you reduce rendering time significantly since you only need to render what's below the horizon, not above.
  • As a more extreme measure, you could also skip every other line, then fill in the gap by showing the same tiles on both planes, but one of them is shifted down by 1px. It'll reduce the vertical resolution to half, but it'll also double the rendering speed.
Also if you haven't learned already, go look up how to scale sprites with software rendering (although admittedly Google loves to make things hell lately). Learn fixed point too (in short: you can use a value larger than 1 to represent one pixel, then smaller values represent "subpixel" precision).
Sik is pronounced as "seek", not as "sick".

Manveru
Very interested
Posts: 72
Joined: Wed Sep 05, 2012 3:30 pm

Re: Help scale and rotation sega genesis

Post by Manveru » Fri Jan 18, 2019 12:11 pm

Some time ago we made some tests with scaling and rotation, and as Sik said, it is very very expensive.
Anyway, i you want or need to make some basic stuff in intros or something like that, we used this guide with as much optimizartions as we could: http://www.drdobbs.com/architecture-and ... /184416337
The man who moves a mountain begins by carrying away small stones. Confucius, 551-479 BC

User avatar
Miquel
Very interested
Posts: 402
Joined: Sat Jul 30, 2016 12:33 am

Re: Help scale and rotation sega genesis

Post by Miquel » Sat Jan 19, 2019 4:12 am

Do you really need it? I mean, making these effects will increase the playability of your game?
That’s the first question you must address first.

I get it, in the 16bit generation the kind of raster effects were a novelty and everybody in games industry loves new shinny things. However, time has passed and no more it produces any fascination, so it’s no longer the so desirable sales booster.
Thinking back, I wish some games didn’t use the mode-7, for example the map on Zelda was very confusing when using this feature. Probably this mode was abused too much.

On the other hand games like “Outrun 2” and “Mario Kart” were extraordinary, which leaves me thinking that what really matters is how you use that mode, how do you program the FUN FACTOR, not the techniques used.

Ok let’s suppose you have done a great deal of thinking, and decided to go steaming ahead.
First thing: to obtain performance you need to code in ASM, not much since most of it is a loop; but you need to understand it. Period.

There are three ways to proceed:
  • Use horizontal exceptions to do vertical scaling.
  • Having a bitmap of 1byte per pixel of the whole map, then scaling and rotating it, then send it to VDP.
  • Sega/Mega CD has hardware capable of doing this.
Yes and no: by my calculations they are around 50000 years older than us. You are closer to resolve the A+ question.
(-26h:) more flashes, this time from the north hemisphere.

danibus
Interested
Posts: 35
Joined: Sat Feb 03, 2018 12:41 pm

Re: Help scale and rotation sega genesis

Post by danibus » Sun Feb 10, 2019 10:56 am

Talking about rotation

Sonic 3, carnival night zone
https://youtu.be/YaAgIKRPsXk?t=87

If this big gun are just sprites, all sprites in different angles, too much wasted I think.

User avatar
Sik
Very interested
Posts: 788
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Help scale and rotation sega genesis

Post by Sik » Tue Feb 12, 2019 8:54 pm

But that's Sonic Mania, it's running on hardware that's both a lot more powerful and that has a tad more of memory.

Sonic 3 didn't have those guns at all.
Sik is pronounced as "seek", not as "sick".

danibus
Interested
Posts: 35
Joined: Sat Feb 03, 2018 12:41 pm

Re: Help scale and rotation sega genesis

Post by danibus » Tue Feb 12, 2019 9:12 pm

Sik wrote:
Tue Feb 12, 2019 8:54 pm
But that's Sonic Mania, it's running on hardware that's both a lot more powerful and that has a tad more of memory.

Sonic 3 didn't have those guns at all.
:oops:

User avatar
Sik
Very interested
Posts: 788
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Help scale and rotation sega genesis

Post by Sik » Thu Feb 14, 2019 9:04 pm

I mean, there's always the Sonic 1 approach :​v
https://www.youtube.com/watch?v=2MKByhhm_S4

And one of the Seven Force forms in Gunstar Heroes is a gun that takes the same approach (the boss as a whole is like that, really).

That still requires sprites for several angles but not for all of them (motion is used to provide the extra precision instead). Mind you, this won't get you a fullscreen mode 7 landscape like originally requested in this thread.
Sik is pronounced as "seek", not as "sick".

User avatar
MisterDave
Newbie
Posts: 1
Joined: Wed Jan 30, 2019 6:34 pm
Location: UK
Contact:

Re: Help scale and rotation sega genesis

Post by MisterDave » Thu Mar 28, 2019 7:54 pm

Hi, this is a little demo that I recently put together that handles scaling and rotation. There is a lot of precalculation in the ROM, however, any bitmap can be scaled without requiring each image to be pre-scaled and rotated.

https://m.youtube.com/watch?v=8yS6xhLGJGk

Chilly Willy
Very interested
Posts: 2706
Joined: Fri Aug 17, 2007 9:33 pm

Re: Help scale and rotation sega genesis

Post by Chilly Willy » Thu Mar 28, 2019 8:11 pm

Very nice. Amazing what you can do on the Genesis with a bit of effort.

bioloid
Very interested
Posts: 121
Joined: Fri May 18, 2012 8:22 pm

Re: Help scale and rotation sega genesis

Post by bioloid » Fri Mar 29, 2019 6:59 am

nice demo

User avatar
Miquel
Very interested
Posts: 402
Joined: Sat Jul 30, 2016 12:33 am

Re: Help scale and rotation sega genesis

Post by Miquel » Fri Mar 29, 2019 5:46 pm

@Cristiano Sword check this: viewtopic.php?f=8&t=1959&hilit=kart is what you want.

But I don't fully understand how is done, if somebody knows, feel free to tech me. Basically I don't get how he picks tiles, and then 2 pixels in a fast way.
Yes and no: by my calculations they are around 50000 years older than us. You are closer to resolve the A+ question.
(-26h:) more flashes, this time from the north hemisphere.

User avatar
Miquel
Very interested
Posts: 402
Joined: Sat Jul 30, 2016 12:33 am

Re: Help scale and rotation sega genesis

Post by Miquel » Sat Mar 30, 2019 8:52 am

Ok, gasega68k just explained it on his first post, really silly of me to not read it :(. So that’s how a mode7 can be accomplished:

- Use HINTs to crop the screen a little.
-> You have around 7KB of bandwidth on vertical display retrace 60hz, but with the decrease screen size you obtain more. Don’t do it on display time since it uses too much cpu time.
- On memory you have a non-tiled map with the MD format (2 pixels per byte), just like a regular bitmap. gasega68k uses a 64KB buffer, but it will be more compatible to reduce it to 32KB.
- Like MD does for planes, when the point of view moves into the next tile (8x8 pixels) in whatever direction, a row/column gets updated.
- Then is just a matter of tracing lines on the bitmap IN A VERY FAST WAY, saving them on a buffer and uploading them to type of bitmap screen arrange (pretty much like the one SGDK uses for 3D).

Done. You have mode7 an probably not much more cpu time to waste.
Yes and no: by my calculations they are around 50000 years older than us. You are closer to resolve the A+ question.
(-26h:) more flashes, this time from the north hemisphere.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest