Texture coordinates on the Saturn!

XL2

Established Member
Sunday I was watching again John Burton's video (Coding secrets - Gamehut) on environmental mapping as seen in Sonic R. He mentionned in the video that it's impossible to do environment mapping using the Saturn hardware as it lacks textures coordinates. So the only known solution was to do some kind of work on CPU side of things, either to generate a new texture with the effect applied or to fully software render the effect (like in Sonic R).

That sounded like a challenge!

What you see below is an UNTEXTURED polygon.
By using gouraud shading, you can actually use the palettes as texture - with the shading being the texture coordinate (x = red, y = green). So by simply using a fully untextured command, I just need to have the cmdColr center around red = 16 and green = 16. The gouraud shading takes care of the rest, as the texture is actualy the palette.
16 will be the center UV (0).
You can also clip the textures, which is impossible normally on the VDP1.
Of course, that means you are limited to 32x32, which takes half the CRAM.
By using the blue shading and ratios you could also have it change colors depending on the background. You could also limit the resolution to something like 32x16 or even 32x8 to save some CRAM.
So while this effect is useless for most cases because of the super low res and very high CRAM usage, it can be used for reflective mapping as the objects are unlikely to be huge.
Think of a stupid vase on the ground, a sword, a shield, etc...
You would just need to bake the chrome/gold color to the texture directly.
To compensate the low resolution, you could just stream new 32x32 chunks as you rotate the camera around, out of a, say, 256x128 texture or 128x64 texture.
I simply made a quick proof of concept test yesterday to confirm it works, but you should take a look at the video Mrkotfw made today, which shows the UV effect in action :



sl_coff-0000.png


This is an untextured draw command...
sl_coff-0001.png

This is by simply merging 2 vertices together and giving them the same value. Magic! The texture gets clipped (mostly) properly!
 
That's really cool! I always wondered, after seeing Sonic R, if AM2 could have made Dural reflective (even if at a lower resolution).

It might be limited in use, but it's a neat effect that could be great for specific situations.
 
Probably, but that model would need to have a reduced polygon count. But yes, you could totally make a way more impressive Dural than what we got...

Thanks for your reply.
Such a pity I am still very a newbie on 3D programming (I am just a regular dev java, php etc...)
I tried something in JoEngine but without success :( The API level is a little bit hard for me
One type of prof-of-concept that I really would love to see is a, even totally static, Virtua Fighter 3 demo on Sega Saturn.
 
Last edited:

Danthrax

Established Member
That looks cool at nighttime. Might look nice to have the reflection on the car disappear when it goes through a shadow, if that's possible.
 
I love the blood coming out of the cars, lol.

Since you don't plan on making an actual racing game - any chance you'd post code examples for others to use for one?
 
Top