Homebrew [Request] 3D support on emulators

  • Thread starter Thread starter Billy Acuña
  • Start date Start date
  • Views Views 5,535
  • Replies Replies 38
  • Likes Likes 1
Slightly off-topic, but the GBA SP was originally designed to have autostereoscopic 3D for playing games in 3D without glasses. The idea was abandoned during development but apparently the code for it still exists somewhere. Would be cool if someone dug it out and used it to make GBA games playable in autostereoscopic 3D, but that's probably just wishful thinking.
 
If it were REALLY easy M2 would be mass-producing Genesis 3D Classics with is Gigadrive emulator
 
Slightly off-topic, but the GBA SP was originally designed to have autostereoscopic 3D for playing games in 3D without glasses. The idea was abandoned during development but apparently the code for it still exists somewhere. Would be cool if someone dug it out and used it to make GBA games playable in autostereoscopic 3D, but that's probably just wishful thinking.
It's nowhere in any code anywhere just an FYI. The only leftovers from development is an unused IO register which controls the IR port they were going to have for both GBA and legacy purposes.
 
Virtual boy emulator ;-;

Likely the best way would be to hack each rom with some sort of flags that'll tell a emulator with a 3D feature where to put the sprites and layers into a 3D plane.
Lot of work on both ends and doable on a case by case basics.
I'd be willing to try working toward it if someone manages an emulator with such a feature and a way to hack each one.
Might not be worth the work for the novelty but if someone comes up wit ha way I'm down to 3Derize as many games as possible. xD

Some games with 3D effects could be implemented into 3D though.
Say Master System's 3D glasses thing (flashing sprites) or red/blue glasses effects could be combined for the viewer.
Some emulators like the virtual boy emulators have features to enable/disable such features for regular viewing.
I remember a Master System one which made some 3D games playable via Red/Blue glasses so it would be doable on 3DS without too much work me thinks.

Still holding out for a Virtual Boy emulator with advanced features and further access to the 3DS hardware to speed things up to somewhat playable speeds heh.

We'll just have to wait and see if someone manages it even if it looks bad or broken it'll be fun to see someone try to get it to work in some way no matter how crazy and convoluted it is.
 
I feel like @StapleButter and @DiscostewSM touched on why SNES 3D implementation isn't worthwhile and is very difficult. View attachment 26747
Might as well make a big post covering all the oddities of SNES rendering, and why trying to apply 3D to it would be far more trouble than it's worth (try to ask how many people even use the 3DS stereoscopy).


So on the paper, the SNES gives you a maximum of 4 layers to work with (amount determined by which BG mode you use), and 128 sprites.

but then it should be easy to make all that 3D

... nope. There are a fair number of oddities that come into play.


1. Per-tile priority

On the SNES, individual tiles in layers can be given a different priority order.

For example, SMW uses this for midpoint/goal posts, to make it look like Mario is going through them. Applying 3D to that would completely ruin the effect.

This is also valid for many games, since they weren't designed to be rendered in a 3D fashion. They often use dirty tricks to achieve certain effects.


2. Color math

There are those nice graphes showing how layer/sprite priority works on the SNES. But there's another thing thrown in the mix: color math (basically add/sub blending).

How does this work? The PPU basically renders two separate screens (mainscreen and subscreen), each with its own set of layers. The two screens are then fused together, and how it happens is different depending on which layers the mainscreen pixels come from (basically you can choose to exclude color math from certain layers, in that case the plain mainscreen is rendered with no color math).

There are a variety of effects you can achieve with this mechanism, and quite a few of the possibilities would break 3D rendering.


3. Windows

This feature allows you to exclude layers from certain screen areas. It is also linked to color math: windows are applied on individual screens, before color math is done. But that's not all, windows can also control where color math happens.


4. Mid-frame PPU configuration changes

To push the limits of the PPU, many games change its configuration while the frame is being drawn. Possible uses include:

* changing BG positions midframe to simulate more layers (SMW does this with the topscreen HUD)
* or changing where the BG layers get their graphics from
* changing priority order is also a possibility if the game uses BG mode 1
* changing the BG mode midframe (mainly used to draw mode 7 sections. SMW uses this in boss fights)
* changing the mode 7 parameters (perspective effects are achieved by changing those at every scanline)


5. oh and quirky sprite ordering

Sprites have two priorities defined: sprite/sprite and sprite/BG. The PPU sorts sprites based solely on their sprite/sprite priority. The topmost sprite pixels are then merged with the rest according to their corresponding sprite/BG priority.

As a result of this method, "bad" sprite priorities can result in interesting effects.

Let's say you have two sprites, A and B, and a BG layer.

A appears in front of B. However, A is set to appear behind the BG layer, and B is set to appear in front of it. What happens if A and B overlap?

The PPU chooses the topmost sprite pixels, which in the case of the overlap, come from A. A is set to appear behind the BG, so... A obscures B all while still being hidden by the BG. Yep.

SMAS SMB3 uses this extensively (powerups coming out of blocks, venus firetraps, etc).



Long story short, SNES rendering isn't as simple as it may look, and it's nearly impossible to add 3D to it and have it look nice everywhere.
 
Might as well make a big post covering all the oddities of SNES rendering, and why trying to apply 3D to it would be far more trouble than it's worth (try to ask how many people even use the 3DS stereoscopy).


So on the paper, the SNES gives you a maximum of 4 layers to work with (amount determined by which BG mode you use), and 128 sprites.

but then it should be easy to make all that 3D

... nope. There are a fair number of oddities that come into play.


1. Per-tile priority

On the SNES, individual tiles in layers can be given a different priority order.

For example, SMW uses this for midpoint/goal posts, to make it look like Mario is going through them. Applying 3D to that would completely ruin the effect.

This is also valid for many games, since they weren't designed to be rendered in a 3D fashion. They often use dirty tricks to achieve certain effects.


2. Color math

There are those nice graphes showing how layer/sprite priority works on the SNES. But there's another thing thrown in the mix: color math (basically add/sub blending).

How does this work? The PPU basically renders two separate screens (mainscreen and subscreen), each with its own set of layers. The two screens are then fused together, and how it happens is different depending on which layers the mainscreen pixels come from (basically you can choose to exclude color math from certain layers, in that case the plain mainscreen is rendered with no color math).

There are a variety of effects you can achieve with this mechanism, and quite a few of the possibilities would break 3D rendering.


3. Windows

This feature allows you to exclude layers from certain screen areas. It is also linked to color math: windows are applied on individual screens, before color math is done. But that's not all, windows can also control where color math happens.


4. Mid-frame PPU configuration changes

To push the limits of the PPU, many games change its configuration while the frame is being drawn. Possible uses include:

* changing BG positions midframe to simulate more layers (SMW does this with the topscreen HUD)
* or changing where the BG layers get their graphics from
* changing priority order is also a possibility if the game uses BG mode 1
* changing the BG mode midframe (mainly used to draw mode 7 sections. SMW uses this in boss fights)
* changing the mode 7 parameters (perspective effects are achieved by changing those at every scanline)


5. oh and quirky sprite ordering

Sprites have two priorities defined: sprite/sprite and sprite/BG. The PPU sorts sprites based solely on their sprite/sprite priority. The topmost sprite pixels are then merged with the rest according to their corresponding sprite/BG priority.

As a result of this method, "bad" sprite priorities can result in interesting effects.

Let's say you have two sprites, A and B, and a BG layer.

A appears in front of B. However, A is set to appear behind the BG layer, and B is set to appear in front of it. What happens if A and B overlap?

The PPU chooses the topmost sprite pixels, which in the case of the overlap, come from A. A is set to appear behind the BG, so... A obscures B all while still being hidden by the BG. Yep.

SMAS SMB3 uses this extensively (powerups coming out of blocks, venus firetraps, etc).



Long story short, SNES rendering isn't as simple as it may look, and it's nearly impossible to add 3D to it and have it look nice everywhere.
Fascinating. I knew it wasn't as easy as some people make it sound but it's really neat to see *why* exactly it's so difficult. Thanks for the explanation! This should help next time someone asks for 3D support on... well, anything.

By the way, completely unrelated question, and I think everyone's thinking the same thing as I am: are there any plans to continue development of blargSNES?
 
This is not easy at all.I can't begin to imagine the headache to achieve this, at least partially. Heck, I don't even use the 3D mode in normal 3DS games for a few reasons:
  • Less battery life
  • I can't move or the 3D effect messes up (O3DS)
  • I don't like how it looks. The colors change a little.
 
Well at least Doom 3DS has 3D... Right?
The only homebrew I want to see so far with 3D support is a Virtual Boy emulator, nothing more.
I do have my VB stored but I want to be able to play my beloved games in real 3D without the hassle of getting the VB out and even worse...
Putting the visor on. O.o
 
I think a nice start would be releasing builds of 3D emulators designed solely for certain games, where there would be fixes and tricks used to overcome specific problems of those specifics games. Exemple: In SMW there's this trick used to make Mario look like he's passing between those poles, as the guy above said, so that build of the emulator would be programmed to adjust those sprites in a way this effect would be kept in 3D.

This would give a hell of a work? Yes, it would indeed. But this whole community is built upon the passion of some programmers, so I would not be surprised if a dev shows up saying "I love Super Metroid and I would like to see how it looks like in 3D".

I know nothing about programming, so I can't try to put this in pratice. Hell, I don't even know if this is possible, I'm just speculating. But playing Super Mario World in 3D would be a dream comming true.
 
@farias the guy you are on about in your post above is StapleButter he is the guy that made the Snes emulator for 3ds called Blargsnes so if anyone knows how hard it would be to do it would be him.
 
@farias the guy you are on about in your post above is StapleButter he is the guy that made the Snes emulator for 3ds called Blargsnes so if anyone knows how hard it would be to do it would be him.

Nice, thanks for the blargSNES, StapleButter, I'm using it and I'm loving it.

But my comment isn't about how hard it is to make a 3D emulator. I'm stating that I think the most plausible way to do this would be different builds for differnt games. Now if he has an opinion in this topic I'd love to hear it.
 
I'd imagine that having a universal 3D setting for each individual layer would seem troublesome for for many games. In order for the 3D effect to really work isn't it optimized for that particular game?
 
I'd imagine that having a universal 3D setting for each individual layer would seem troublesome for for many games. In order for the 3D effect to really work isn't it optimized for that particular game?

Yes, M2 had to painstakingly go over each game and even rebuild parts just to make everything work well and at 60FPS on O3DS. There are blog posts for 3D Classic titles that go in depth about their process.
 
The emulators already run poorly enough.

You can't make true stereoscopic 3d games without actually creating 3d models for everything in the game. Only DS games could potentially support stereoscopic 3d.

If you play around in the layers of 2d games you will only achieve a gimmicky appearance of 3d. It will simply look like 1 flat layer is hovering over another one.
 

Site & Scene News

Popular threads in this forum