This should be required reading for anyone that trying to emulate the PS1 rendering aesthetic. Too many developers seem to think that PS1 games probably looked worse than how they remember them and try to compensate for their nostalgia (or just want to heighten the aesthetic) by introducing far, far more wobbling and warping than there actually was!
Love the project and the spirit of it. Brings be back to playing FFT.
Question to all C/C++ programmers out there. Why are your variables so terse? I have no idea what td and dt mean and why they are both in the same function. I'm genuinely trying to read your code and have no idea what is happening because there is seemingly a desire by the author to keep variables as short as possible. Why?
Don’t go to ShaderToy. You will find a really cool shader and then be disappointed when the code is incomprehensible because whoever wrote it want used one letter variables (starting alphabetically! So x, y, and x coordinates might not even be “x, y, z” but “o, p, q”).
That's so legit.. I just spent 3 hr reading code of shader toy last night at 1 am, all I could do was changing color... And it was in a variable named c1
Amazing. On the other hand it makes use of a graphics library that is way bigger than 500 lines. Regardless thank you for sharing but I get the feeling it was good fun.
It's true that https://github.com/nkanaev/tipsy/blob/master/src/tigr.c is 5500 lines of C but, as far as I can tell, it's just being used to load texture images, draw lines, get double-buffered pixel buffers onto the screen, and get keyboard and mouse events. It wouldn't be difficult to port it to something like https://gitlab.com/kragen/bubbleos/blob/master/yeso. yeso.h yeso-pic.c yeso-xlib.c png.c total 560 lines of C, and all you're missing then is a line-drawing function.
I did not notice. Neat. I appreciate the PS1 more. Remembering way back, N64 carts were 10 dollars or so more than PS1 discs, and as a result I had a stockpile of PS1 games. The texture popping of the PS1 I could never make sense of but it became an aesthetic of the era. Nice work OP, and thankyou for the credit
I know there’s another reply with videos here. I’m gonna put an explanation in text.
The N64 had two things which made things smoother. It had sub-pixel precision for geometry after projection, and it had perspective-correct interpolation. This meant that moving objects looked smooth and didn’t “pop”. Games on the PS1 addressed the interpolation problem by subdividing, but you could sometimes see geometry suddenly move when you got closer and saw more subdivisions.
The N64 also had texture interpolation (kind of like bilinear) and antialiasing, but those don’t make as big an impact.
The N64 got all these things right, more or less, but had problems with memory bandwidth and small texture memory.
Why thank you. They've all been passion projects and they were all published only after numerous rewrites. Roman2 ended up being the pinnacle of my work. I sadly don't know to work on next. Never thought I'd run out of ideas, but I guess turning 30 does that
i came across this a few days ago searching n64 style rendering, its awesome! i plan on trying to make a spiritual successor of sorts for blast corps using those techniques in another renderer
If anyone is interested in learning how graphics rendering works under the hood without too much scaffolding, there's a great course at https://pikuma.com/courses/learn-3d-computer-graphics-progra... (I'm no way associated with that website, just loved the course). That course starts from absolute basics: creating a colour buffer as in memory array and gradually covers lot of ground on 3D rendering: drawing pixels, lines, triangle fill rasterisation, texturing. The course uses minimal help: SDL is used for rendering on window and dynamic arrays are provided as a small C library. But everything else is coded from scratch in C by the instructor in the lecture, word by word.
Glad to see PS1 style rendering that simulates the affine texture warping side effects of the console. The original Playstation was very much not designed with 3D in mind, lack of perspective correction on textures lead to the aforementioned warping.
Vertex coordinates were rounded to whole integers, giving that hallmark polygon jiggle effect from the rounding that 'snapped' them in place. The complete lack of a z-buffer also lead to lots of z fighting, as the system rendered polygons strictly in the order they were calculated.
I couldn't help noticing that it tests every pixel on the "screen" to see whether it's inside a face. Back in the software renderer days we'd run the inner loop just for the pixels that fell inside a triangle. But then you'd need to explicitly handle polygon clipping and it would greatly complicate the code. I guess 320*240 tests is nothing these days.
would love to see this run inside a browser. how do you create ps1 texture and lo-poly models like this? I so badly want to create a PS1 style game in the browser.
For lot of us, our childhood was defined by this console. N64 as well but just something about the PS1 graphic that really speaks to me. Anybody else feel the same?
No clue what people use today, but when I worked on a psx game 3D Studio Max was the the main choice, with Lightwave 3D having a lot of fans as well. Doing low poly modeling you basically just live between the edge split, rotate, merge, and vertex move tools, so it's incredibly important they have a low friction UI.
It was a never published port of Unreal to Playstation 1.
Interestingly enough the renderer was up and running. It was a lot more limited in triangle count than the PC version, hence a lot of fiddling with models.
In any case, the project fell apart for the usual disorganized management reasons.
From a quick glance at the graphics library being used here[1], it doesn't seem like a terrible amount of work to add support for WebGL and then get this entire project compiled into wasm (at least for someone more comfortable working in C than myself!)
> fgetc() does not return 'char', it returns 'int' else EOF won't fit.
Or more precisely: don't store the return value in a 'char' and check if it is EOF. On some platforms (e.g. gcc ARM eabi), regular 'char' is unsigned and the check fails.
They need to be coupled with the same bespoke, precise controls and input handling though. There's a tightness to a lot of PS1 and N64 games that takes care to replicate. And Unity and friends don't exactly help you in that department.
I was wondering how this was done in 500 lines...then I saw the 5000+ line library file borrowed from another project. I do enjoy the look of your results though.
How long before somebody includes your library and says they created PSX graphics in 25 lines?