Help scale and rotation sega genesis

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

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
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: 753
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: 753
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: 379
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.

danibus
Interested
Posts: 16
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: 753
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: 16
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: 753
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".

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest