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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Building a Ray-Tracing 3D Renderer from Scratch

33 点作者 jamesmiller5大约 9 年前

5 条评论

lomnakkus大约 9 年前
Ray tracing was my introduction to CS-like &quot;real&quot; programming, i.e. not just typing stuff in[1], but actually sitting down and thinking about the <i>math</i> of the problem[2]. I remember being super-excited (at 14-or-so yrs old) at being able to have my Turbo Pascal program draw a 640x480 grayscale(!) plane+sphere image on my monochrome VGA screen... which was the style at the time; the VGA card having been bought by me via pocket money and the screen having been bought by my parents. (Which is just another way of saying they bought both.)<p>Ray Tracing offers a <i>remarkably</i> big payoff for very little code. It <i>does</i> require a little algebra for line+(plane&#x2F;sphere) intersections and such, but that&#x27;s stuff you can easily look up these days.<p>[1] Yeah, I&#x27;m old. We had &quot;codes&quot; (typically heavily compressed&#x2F;obfuscated) in these things called computer &quot;magazines&quot; that you would type in and see what happened.<p>[2] There&#x27;s <i>always</i> math. Even if you&#x27;re doing CRUD, there&#x27;s probably math behind it: Form validation is a certain type of math, etc.
tsahyt大约 9 年前
Writing a toy ray tracer is something that I&#x27;d recommend to everyone who&#x27;s interesting in becoming a better programmer. Once you get deep enough into it you&#x27;ll encounter so many interesting problems (e.g. data structures, software architecture, some linear algebra, etc.) to hone your skills on. It&#x27;s almost up there with &quot;write your own compiler&quot; as a learning experience in my opinion and you get the added benefit of creating some pretty pictures in the process.
theoh大约 9 年前
Ray tracing is great, metropolis flavour particularly. But you need an artistic sense to create complex and rewarding scene geometry, whether it&#x27;s static or animated. I spent years obsessing over CS when the experience that actually drew me into the graphics field in the first place must have been the result of someone&#x27;s artistic judgement, passed through a conceptually very simple bit of software (this is the 90s I&#x27;m talking about) which really just projected geometry into the screen.<p>(Oliver Deussen&#x27;s work on rendering plants and other natural phenomena is an example of the kind of CS technique necessary to create geometry for any rendering process.)
daveidol大约 9 年前
I wrote a similar program in plain Java + Swing (and no other libraries) years ago, which I dumped on GitHub here (there are a few screenshots): <a href="https:&#x2F;&#x2F;github.com&#x2F;idolize&#x2F;ray-tracer" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;idolize&#x2F;ray-tracer</a>
blt大约 9 年前
I love ray tracing. A small amount of code generates magical looking images. More advanced methods have a really pleasing mix of geometry, probability, data structures&#x2F;algorithms, and low-level optimization.