[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/vr/ - Retro Games

Search:


View post   

>> No.5463739 [View]
File: 316 KB, 1390x1070, 71140a79697fcef8ac454109e36a6fe3.jpg [View same] [iqdb] [saucenao] [google]
5463739

>>5463680
It's fucking magic to me too but I'll try to explain.

In 2D graphics you use 2D coordinates to tell the hardware where to draw a sprite. Each corner, or "vertex," can be described by two numbers, X and Y, referring to the column and row where a pixel is drawn. The hardware can then calculate averages between these values to refer to any point inside the graphic it's trying to draw; for example, the top center of a sprite is halfway between the top left vertex and the top right vertex. This is called "interpolation." The hardware needs to do this when it's trying to draw a sprite at a larger or smaller size than the actual pixel art that defines it.

In 3D graphics, you're constantly drawing stuff at different sizes, plus you also need to be able to tell the hardware how far away something is from the camera, so closer things can cover up things that are further away. To accomplish that, each vertex gets a third component, called Z. Now the hardware can scale and rotate any 2D graphic and place it anywhere in a 3D scene. It can also shrink one end of a graphic more than the other in order to simulate perspective (pic related). All this is called "projection."

Doing this for each polygon involves a bunch of math, but most of it only needs to be done once per camera position, and then you can save it in a structure called a matrix, and the rest is just a handful of additions and multiplications per vertex. A 2D matrix has 4 entries (2 times 2) and a 3D matrix on the Playstation would have 9 entries (3 times 3). And as long as you're drawing solid color triangles, that's all you need.

However, we all know that textured triangles on the Playstation have crazy warping effects when they get close to the camera. The "4D matrix" trick I described earlier is a workaround. I'm not sure why it works, exactly. I understand everything I just described, except for this.

Navigation
View posts[+24][+48][+96]