TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Tiny PS1-like Renderer in 500 lines

141 点作者 nkanaev将近 3 年前

16 条评论

ok_dad将近 3 年前
Linked in the README is the article this is probably based on, which explains the rendering for a PS1 and why it has certain behaviors, it&#x27;s a great article: <a href="https:&#x2F;&#x2F;www.david-colson.com&#x2F;2021&#x2F;11&#x2F;30&#x2F;ps1-style-renderer.html" rel="nofollow">https:&#x2F;&#x2F;www.david-colson.com&#x2F;2021&#x2F;11&#x2F;30&#x2F;ps1-style-renderer.h...</a>
评论 #32343421 未加载
ppeetteerr将近 3 年前
Love the project and the spirit of it. Brings be back to playing FFT.<p>Question to all C&#x2F;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&#x27;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?
评论 #32343462 未加载
ptsneves将近 3 年前
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.
评论 #32337115 未加载
glouwbug将近 3 年前
heh, I wrote an N64 one not too long ago with the exact same style:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;glouw&#x2F;gel" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;glouw&#x2F;gel</a>
评论 #32337141 未加载
评论 #32338030 未加载
评论 #32339972 未加载
havercosine将近 3 年前
This looks nice! Great work.<p>If anyone is interested in learning how graphics rendering works under the hood without too much scaffolding, there&#x27;s a great course at <a href="https:&#x2F;&#x2F;pikuma.com&#x2F;courses&#x2F;learn-3d-computer-graphics-programming" rel="nofollow">https:&#x2F;&#x2F;pikuma.com&#x2F;courses&#x2F;learn-3d-computer-graphics-progra...</a> (I&#x27;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.
crabbygrabby将近 3 年前
So cool. Took me back to my childhood instantly. You nailed it
评论 #32337146 未加载
confident_inept将近 3 年前
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.<p>Vertex coordinates were rounded to whole integers, giving that hallmark polygon jiggle effect from the rounding that &#x27;snapped&#x27; 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.
0xf00ff00f将近 3 年前
Looks great!<p>I couldn&#x27;t help noticing that it tests every pixel on the &quot;screen&quot; to see whether it&#x27;s inside a face. Back in the software renderer days we&#x27;d run the inner loop just for the pixels that fell inside a triangle. But then you&#x27;d need to explicitly handle polygon clipping and it would greatly complicate the code. I guess 320*240 tests is nothing these days.<p>Anyway, great job!
herpderperator将近 3 年前
I thought this was referring to Prompt Shell 1 :&#x27;)
yomkippur将近 3 年前
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.<p>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?
评论 #32338831 未加载
评论 #32337837 未加载
doubled112将近 3 年前
Funny that my first thought was that the polygons better wobble and it&#x27;s right there in the features list.
unwind将近 3 年前
Very cool and nostalgic! Had no idea the PS1 look was trending.<p>Also, due to Stack Overflow conditioning: fgetc() does not return &#x27;char&#x27;, it returns &#x27;int&#x27; else EOF won&#x27;t fit.
评论 #32339814 未加载
aliswe将近 3 年前
WOW! Looks great! Definitely hit my nostalgia nerve!
LAC-Tech将近 3 年前
Have PS1 triangular graphics made a retro resurgence yet? Because I&#x27;m so down for that.
评论 #32337907 未加载
评论 #32339677 未加载
评论 #32337864 未加载
zem将近 3 年前
that was pretty prompt!
klipklop将近 3 年前
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.<p>How long before somebody includes your library and says they created PSX graphics in 25 lines?
评论 #32339824 未加载
评论 #32340203 未加载