• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

First video of obscure ps2 engine in action ;)

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 ;).

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 :(.
 

Panajev2001a

GAF's Pleasant Genius
MightyHedgehog said:
What's with that Cheerios texture or whatever?

I explained it in the post: reading the ASE file the geometry was in we rushed a bit (ahem... mr mov ;) ) and we skipped reading the UV texture coordinates.

So basically, we just made them up while building the packets for the VU1.

I cycled through these values [0, 0], [0, 255], [255, 0] and [255, 255] which meant that everything got TILED TO a crazy amount.

Instead of having the texture cover the whole object: each tiny triangle is textured by the whole "shrinked" texture.

Bad approach... but it allowed us to get some of the more basic stuff up and working: it is one of the next steps (proper UV/ST coordinates and perspective correction, etc...) we want to take.

BTW, in the scene there are approximately 11,169 + 3,967 triangles: we actually transform more 1-1.5 vertices per triangle as we are not using triangle-strips, but independent triangles (we basically transform more than we should: if there are adjacent triangles, like in a nice strip, you would not need more than 1-1.5 vertices per triangle, but we end up with the usual 3 vertices oer triangle :().

15,136 * 60 fps = 908,160 polygons/s.

Well, now it is more understandable why we stay at a stable 60 fps... we are doing very very low polygon counts and no lighting, I would hope we keep 60 fps ;).
 

Panajev2001a

GAF's Pleasant Genius
Kiriku said:
Hey Pana ;)

So I saw a plane pass by, but what was that other thing? ;)

A steering wheel? ;)

Supposed to be a TIE fighter (TIE Interceptor)... does it notice that it is not an ILM model ?
 

Kiriku

SWEDISH PERFECTION
Panajev2001a said:
Supposed to be a TIE fighter (TIE Interceptor)... does it notice that it is not an ILM model ?

Ah, that figures. I'm not too familiar with the Star Wars Universe. ;)

Keep up the good work.
 

Panajev2001a

GAF's Pleasant Genius
Scalemail Ted said:
Are you gonna try your hand at any DS programming? :p

Already played a bit with GBA (got very annoyed by few quirks in the last revision of the lib we used and the fact the promised BIG update never came [read tUME] in addition to the fact that I did not have a Flash cart and I was doing everything on a Windows emulator) ;).

Still, we got far with that engine (you could already make simple nice games [collision detection was fully supported, large maps as well, rotation and scaling, etc...]) so maybe it will be continued one day... who knows :).

I would continue with that if I wanted to do 2D of course: even though Ourumov is working on a nice sprite engine for our engine, so... we migth play with that too.

3D on the DS does not attract me much: especially if there won't be any official kit from Nintendo like the PlayStation 2 Linux kit Sony/SCE sold to home-brew programmers.

It could be nice though... you would have close to N64 levels of performance, but hopefully not everything has to be done in software.

Realistically, I do not think I would have the time: I wonder how quckly people will be able to have DS Flash Carts that run home-brew programs.

The DS would be nice, but then again PSP for 3D programming would be even nicer ;).
 
Panajev2001a said:
Already did GBA ;).

I would continue with that if I wanted to do 2D.

3D on the DS does not attract me much: especially if there won't be any official kit from Nintendo like the PlayStation 2 Linux kit Sony/SCE sold to home-brew programmers.

It could be nice though... you would have close to N64 levels of performance, but hopefully not everything has to be done in software.

Realistically, I do not think I would have the time: I wonder how quckly people will be able to have DS Flash Carts that run home-brew programs.

The Ds would be nice, but then again PSP for 3D programming would be even nicer ;).

How'd you go about with the GBA programming? I remember you plugging a book several months ago that never did get released.
 

Panajev2001a

GAF's Pleasant Genius
I agree, I was thinking the same myself :lol.

Not only the engine is still not finished, but the trailer was badly done lol.

I'll make another one when I have some changes in the scene: just making a longer one with the same graphics and no other change seems a bit pointless for me to make and for you guys to watch: unless there is this crazy request, but somehow I do not think there will be ;).
 

Sho Nuff

Banned
PANAJEV.

ONCE AGAIN, NOBODY HERE UNDERSTANDS WHAT THE SHIT YOU ARE TALKING ABOUT.

Why don't you post this kind of incomprehensible braniac nonsense to the Beyond3D boards instead?
 

hirokazu

Member
Sho Nuff said:
PANAJEV.

ONCE AGAIN, NOBODY HERE UNDERSTANDS WHAT THE SHIT YOU ARE TALKING ABOUT.

Why don't you post this kind of incomprehensible braniac nonsense to the Beyond3D boards instead?

amen to the first bit... while i know what you just did is probably something impressive, with the technical knowhow that you have, i have absolutely no damn idea what it is.

i welcome your threads about technical stuff and all, but could you please explain what you it is you have achieved?
 

Panajev2001a

GAF's Pleasant Genius
I will explain in more detail, still I actually tried to do the same in the post.

Basically, the code I posted had a clip matrix which allowed me not to worry about hand-fixing it further in case I change screen resolution, Near and Far clipping planes and so on.

The rest that I achieved ? Well, taking frame-buffer grabs directly from the frame-buffer is one of them and actually being able to assemble a WMV9 movie out of the screen shots (having properly taken the screen-shots).

Also the perspective has been adjusted, the last screen shots I posted had too exageraded perspective.

I wanted as well to show that matrices composition (rotations + translations in any order and camera moovement through LookAt which takes an eye point, the target point the vector UP to move the camera) and clipping seems to work fine.

Sho-nuff: some people that are interested and/or work with me do not go on B3D much :p.
 

Panajev2001a

GAF's Pleasant Genius
RiZ III said:
So ps2 doesn't have any high level graphics api?

It has a few of them: one like PS2GL is incomplete and not really practical.... the other is not open to PlayStation 2 Linux developers, but pro devs say it sucks as well.
 
Top Bottom