Jo Engine Forum

Sega Saturn Development => General discussion about the Sega Saturn => Topic started by: 20EnderDude20 on August 07, 2018, 06:07:19 pm

Title: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 07, 2018, 06:07:19 pm
(This message was moved from another thread)
Ever since XL2 told the people on this form about changing the end addresses, I thought of this uv mapping system that uses interrupts.
I've made this diagram that gives a loose idea of a concept of primitive uv mapping. I’m not certain if this is possible, but it's an idea: (https://i.imgur.com/rRkssAv.png) .
Title: Re: Idea of UV mapping on the Saturn
Post by: corvusd on August 07, 2018, 07:09:13 pm
Hello

Let's see. Your idea is interesting.

The problem is that you raise it is practically programming a rendering engine of polygons. Because from somewhere the mask texture has to come out.

What you propose is practically what was done for Sonic R. Maybe in a more original way. But in the end, as I say, something must draw those masks, those "triangles"

At the UV point you can see it: http://www.davidgamizjimenez.com/inpostivegames/sega-saturn-to-the-limit-i/ ->  1.1 Triangle vs Quadrangle – EXTRA Ball: UV Mapping

Regards,
Title: Re: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 07, 2018, 08:10:56 pm
Is it costly in Saturn standards to use a software rendering engine?
Title: Re: Idea of UV mapping on the Saturn
Post by: ponut64 on August 08, 2018, 12:14:46 am
It is costly in all standards to use software rendering.
Title: Re: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 08, 2018, 12:19:00 am
Then how did Jon Burton make the Saturn use a software renderer without much slowdown?
Title: Re: Idea of UV mapping on the Saturn
Post by: ponut64 on August 08, 2018, 12:56:10 am
In what game?
Sonic R?
The extent of software rendering in that game is, IIRC, not an end-to-end pipeline. Certain stages are assisted via software rather than entirely software rendered.
A game that is software rendered on these consoles looks like the Saturn DOOM port, the HexXen Saturn/PS ports, and the Duke 3D playstation port. Compare said PS port of Duke 3D to the hardware-accelerated Duke 3D port that is on the Saturn. And in that way do also note: It also includes some software rendering assistance, as far as I have read from corvus.
You can't get real-time shading or fade-in / fade-out effects on VDP1 without such a thing.

In another way, the Saturn has two SH2s, so you can safely run the render pipeline on one of them without interrupting the program registers / task scheduler on the other. Which is what SGL does.
My point is that software rendering is massively slower than using VDP1 and VDP2 for everything you can use them for, even if it does mean using them in strictly unnecessary ways. Yet if you have the expertise, I do think you could schedule a system where triangles of a mesh are texture-mapped in software rather than on VDP1, but doing so would be a massive undertaking with regards to scheduling the program to ensure it both looks right and runs without interrupting the rest of the system (due to DMA time).

More to MY personal point of view on this matter, VDP1 is not fast enough to be invested in high-quality textures on every polygon alongside real-time shading. If that means all triangle polygons have to be untextured, GOOD! It saves performance and we don't have to be bothered with it!

Instead of throwing around conjecture like this, everyone would better use their time actually trying this out and determining if its worth the time. I haven't the time to prove what I am saying because folks around here have found ways to pre-distort the textures on triangles so they look more appropriate.
Title: Re: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 08, 2018, 02:18:54 am
Yeah, it's actually pretty simple to pre-distort the texture. Also, I DON'T know C, so I ask people like you to find out (Well, maybe a little C from observation).
Title: Re: Idea of UV mapping on the Saturn
Post by: Jorhlok on August 08, 2018, 03:15:00 am
From that video Jon says he planned to have an environment mapped metal sonic but scrapped it and only used the software renderer for the trophies.

From what I know of the VDP1 it draws in strips of pixels from the left side of the quad to the right. This way it reads from the sprite linearly. So it would take all the pixels from start to end in a row and stretch that from the left side of the quad to the right instead of leaving blank pixels to either side, I think? Having not programmed the saturn yet I can't say for certain, though.
Title: Re: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 08, 2018, 03:18:19 am
Also, even though transparency is not really an option for distorted sprites, what does it look like?
Title: Re: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 09, 2018, 07:34:36 pm
So, I've seen an Atari Jaguar game, Supercross 3d, and it has a billboard that shows the screen on it. Is there a way to do that on the Saturn?
Title: Re: Idea of UV mapping on the Saturn
Post by: corvusd on August 09, 2018, 11:24:41 pm
So, I've seen an Atari Jaguar game, Supercross 3d, and it has a billboard that shows the screen on it. Is there a way to do that on the Saturn?

In "theory" yes. A few games make a render-to-texture from VDP1 framebuffer, CPU or both VDPs... but only whit static images. Only can make a speculation about it. Is possible this feature would be to expensive to the graphic+cpu Saturn pipeline. Are be to many jumps of type of buffer, type of data... etc... I mean, is possible make it, but whit a very very slow result.

The most similar case, is Tempest 2000. This is a direct port from Jaguar to Saturn. It have in main logo screen a similar effect in the title. A render and blur in the logo. In Saturn go very low FPS, maybe 10/8FPS in Jaguar run quite well. In this case, is a render-to-texture over VDP2 layer from CPU render.

Greetings!
Title: Re: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 10, 2018, 12:12:30 am
I think that's why Supercross 3d has a low framerate.  ;)
Title: Re: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 10, 2018, 03:39:57 am
Another example is Rayman at those end level sequences, where it takes the screen and, (maybe) using software, wraps the screen on a sphere, rolls it up like a sheet of paper, or does water ripple distortion, while maintaining a constant framerate of 60 fps! https://youtu.be/G4SyK0fSwKM?t=11m43s. Now that is impressive. I think the lag is because of the efficiency of the code in Tempest 2000.
Title: Re: Idea of UV mapping on the Saturn
Post by: Jorhlok on August 11, 2018, 10:37:06 pm
Another example is Rayman at those end level sequences, where it takes the screen and, (maybe) using software, wraps the screen on a sphere, rolls it up like a sheet of paper, or does water ripple distortion, while maintaining a constant framerate of 60 fps! https://youtu.be/G4SyK0fSwKM?t=11m43s. Now that is impressive. I think the lag is because of the efficiency of the code in Tempest 2000.

I watched that and was thinking about it, I think a way to do that is to copy chunks of the framebuffer into sprites in vram and then using those sprites draw a sphere using the regular VDP1 functionality. This works because the image on the sphere doesn't change.
Title: Re: Idea of UV mapping on the Saturn
Post by: ponut64 on August 11, 2018, 10:49:05 pm
More to the point, it's pre-processed; the image on the sphere is pretty much just a screenshot. You'll notice the heavy lag time before the ball comes into play after the game stops.
Title: Re: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 12, 2018, 12:23:21 am
Well, how do other systems like the Jaguar pull this off at a better framerate? Is it because it has a higher bandwidth, or...? This is more of asking if we can remake Supercross 3d on the Sega Saturn.
Title: Re: Idea of UV mapping on the Saturn
Post by: Jorhlok on August 12, 2018, 08:15:02 am
More to the point, it's pre-processed; the image on the sphere is pretty much just a screenshot. You'll notice the heavy lag time before the ball comes into play after the game stops.

Oh yeah, the background wouldn't be in the VDP1 framebuffer so it would necessarily need to be touched up to include what the VDP2 would normally produce.
Title: Re: Idea of UV mapping on the Saturn
Post by: ponut64 on August 12, 2018, 10:42:28 am
Well, how do other systems like the Jaguar pull this off at a better framerate? Is it because it has a higher bandwidth, or...? This is more of asking if we can remake Supercross 3d on the Sega Saturn.

The Jaguar might do it because it has less data to handle in a more compressed format in a more unified memory access structure.
Heavily segmented memory [on the Saturn] has its advantages but speed definitely is not one of them.

Now, we wonder: How, on the Saturn, would we do this?
I imagine it would involve use of one of VDP2's rotating background layers and a lot of memory copies, possibly even compression, or culling of certain assets from the memory copy to a TGA / bitmap format that VDP2 understands.

In other words:
Stream frame-buffer of VDP1 to a work area where it can be processed to a bitmap format and re-pasted to VDP2 RBG0 area, line-by-line (line being a chunk of the stream).
You can then move, scale, and rotate this effective re-projection wherever you like in 3D space.
Problems:
1. Extraordinarily busy on DMAs, cannot happen in concurrence with music streams, file system access, or SCU DSP access.
2. Quite slow, I don't foresee it working beyond 10 FPS.
3. Effectively limits the scene complexity to what can fit into RBG0 data area [130KB?].
Title: Re: Idea of UV mapping on the Saturn
Post by: 20EnderDude20 on August 12, 2018, 06:08:24 pm
Maybe you can make it go at 1-2 fps, just make it a billboard, or demonstrate what is the best trade-off with using compression.