Panajev2001a
GAF's Pleasant Genius
I could not make it longer tonight, I will already only get ~2 hours of sleep and the process is very tedious.
I converted for our PlayStation 2 Linux application code that would save teh frame-buffer in .tga format... I changed it so it would work in our engine and it would save files in .ppm format (.ppm is a RAW format.. each frame is like >1 MB ).
I remember when the GIF-to-GS bus was thought to be uni-directional... hehe, memories.
I save each frame (60 fps) and then I use the cjpeg utility to convert each .ppm file to a .jpg file.
Then I use the application JPGVideo to convert all the .jpg screens into an .avi file which is compressed with the VC-1/VC-9/WMV9 codec and the maximum frame-rate is 30 fps.
I cannot imagine making a 5 minutes trailer LOL.
http://iggs.ript.net/videos/IGGS_PS2_video_0001.avi
The compression artifacts kill whatever image quality there was (textureing looks screwy because it is, we are hardcoding arbitrary UV values ).
To add few things... the code for the CLIP matrix (Projection matrix) was changed thanks to nAo and Sparky.
No, it is not fully optimized... I can see myself that there are, for example, at least four float variables that are not even needed .
As an aside I finally got the CLIP instruction in VU1.
For those of you who have done some 3D graphics theory, the CLIPxyz.w instruction does basically the clipping test as you would do it in Clip Space (right after the Perspective Projection and before the Homogeneous divide by w): basically something like -w < x < w & -w < y < w & -w < z < w ).
Very nice instruction I must say: in a few step you can set the ADC bit in the w coordinate (if ADC == 1 in the primitive's vertices (say your nice triangle), the primitive will not be drawn... sorry for the over-simplification).
We basically clip against a bigger than normal View Volume and not draw anything that intersects or is outside that view volume.
Clipping and culling tend to steal precious cycles, so you tend not to do back-face culling in PlayStation 2 games, the GS is fast enough to handle all you can throw at it.
I'll post our VU1 code the day the project actually gets around enabling lighting and more stuff is cleaned up: the clipping part is as I described... you project the Vertex (Matrix * Vertex multiplication), do the clipping test, divide by w, set the ADC bit, kick the vertex data to the GS.
Bye for now .
Edit: as you can see this is mostly a test of the camera.
I rotate an object around its Z-axis and its Y-axis (to make it face the screen) and the other object by a global Y-axis (the difference is that I translate the object before I rotate it) while the camera moves toward the objects, passes them and then resets.
The video editing is not the best: I'll make a better one when I have more time .
I converted for our PlayStation 2 Linux application code that would save teh frame-buffer in .tga format... I changed it so it would work in our engine and it would save files in .ppm format (.ppm is a RAW format.. each frame is like >1 MB ).
I remember when the GIF-to-GS bus was thought to be uni-directional... hehe, memories.
I save each frame (60 fps) and then I use the cjpeg utility to convert each .ppm file to a .jpg file.
Then I use the application JPGVideo to convert all the .jpg screens into an .avi file which is compressed with the VC-1/VC-9/WMV9 codec and the maximum frame-rate is 30 fps.
I cannot imagine making a 5 minutes trailer LOL.
http://iggs.ript.net/videos/IGGS_PS2_video_0001.avi
The compression artifacts kill whatever image quality there was (textureing looks screwy because it is, we are hardcoding arbitrary UV values ).
To add few things... the code for the CLIP matrix (Projection matrix) was changed thanks to nAo and Sparky.
No, it is not fully optimized... I can see myself that there are, for example, at least four float variables that are not even needed .
Code:
void camera3d::IGGS_perspective (float FOV, float aspect_ratio, float Near, float Far) {
//the equations take care of the pixel size, aspect_ration and screen's dimensions:
//aspect_ratio != 640x448...
//aspect_ratio for regular TVs and monitors is 4:3 and for Widescreen TVs it is 16:9
//regardless of resolution as long as it's fullscreen
float width = sps2UScreenGetWidth();
float height = sps2UScreenGetHeight();
setFOV (fov);
// viewWindowSize is really the reciprocal
// value of, half the horizontal window
// size at distance 1.0
const float ax = width * viewWindowSize / guard_bandX;
const float ay = (height*aspect_ratio) * viewWindowSize / guard_bandY; // here aspectRatio would be 4/3
const float k1 = -(Near + Far) / (Far - Near);
const float k2 = -(Far * Near * 2) / (Far - Near);
// The clipspace projection matrix (right-handed)
/*
| ax 0 0 0 |
| 0 ay 0 0 |
| 0 0 k1 k2 |
| 0 0 -1 0 |
*/
float scaleX = 0.5f*guard_bandX;
float scaleY = -0.5f*guard_bandY;
float scaleZ = -0.5f*(maxZ - minZ);
scale_value.x = scaleX;
scale_value.y = scaleY;
scale_value.z = scaleZ;
scale_value.w = 0;
float offsetX = 2048;
float offsetY = 2048;
float offsetZ = 0.5f*(maxZ + minZ);
//offsetZ = 0;
offset_value.x = offsetX;
offset_value.y = offsetY;
offset_value.z = offsetZ;
offset_value.w = 0;
clipMatrix.IdentityMatrix();
clipMatrix.SetValue (0,0, ax);
clipMatrix.SetValue (1,1, ay);
clipMatrix.SetValue (2,2, k1);
clipMatrix.SetValue (2,3, k2);
clipMatrix.SetValue (3,2, (-1.0f));
clipMatrix.SetValue (3,3, 0.0f);
clipMatrix.PrintMatrix ();
}
As an aside I finally got the CLIP instruction in VU1.
For those of you who have done some 3D graphics theory, the CLIPxyz.w instruction does basically the clipping test as you would do it in Clip Space (right after the Perspective Projection and before the Homogeneous divide by w): basically something like -w < x < w & -w < y < w & -w < z < w ).
Very nice instruction I must say: in a few step you can set the ADC bit in the w coordinate (if ADC == 1 in the primitive's vertices (say your nice triangle), the primitive will not be drawn... sorry for the over-simplification).
We basically clip against a bigger than normal View Volume and not draw anything that intersects or is outside that view volume.
Clipping and culling tend to steal precious cycles, so you tend not to do back-face culling in PlayStation 2 games, the GS is fast enough to handle all you can throw at it.
I'll post our VU1 code the day the project actually gets around enabling lighting and more stuff is cleaned up: the clipping part is as I described... you project the Vertex (Matrix * Vertex multiplication), do the clipping test, divide by w, set the ADC bit, kick the vertex data to the GS.
Bye for now .
Edit: as you can see this is mostly a test of the camera.
I rotate an object around its Z-axis and its Y-axis (to make it face the screen) and the other object by a global Y-axis (the difference is that I translate the object before I rotate it) while the camera moves toward the objects, passes them and then resets.
The video editing is not the best: I'll make a better one when I have more time .