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 :
This is an untextured draw command...
This is by simply merging 2 vertices together and giving them the same value. Magic! The texture gets clipped (mostly) properly!
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 :
This is an untextured draw command...
This is by simply merging 2 vertices together and giving them the same value. Magic! The texture gets clipped (mostly) properly!