6 ms·
Raytracer.el: a raytracer in Emacs Lisp
- Cieplak 10y agoAnother neat pair of raytacers that shows the performance boost from vectorization: http://www.excamera.com/sphinx/article-ray.html http://www.excamera.com/sphinx/article-ray.html
- kruhft 10y agoI've also written a GPU tracer using the same style of calculation, and it just blows anything done on the CPU out of the water. It gets about 10fps with 100 spheres on a mid range Mac Pro.
- WhitneyLand 10y agoThis one is great if you want to understand ray tracing. It explains everything step by step in a way that's easy to comprehend.
- molloy 10y agoAwesome project. While going over it to figure out how it worked, I looked up the 'cl' package and noticed that it has been deprecated in favor of cl-lib. [1] Also, what license (if any) does this fall under? [1] https://www.emacswiki.org/emacs/CommonLispForEmacs https://www.emacswiki.org/emacs/CommonLispForEmacs
- kencausey 10y agoI'm assuming you are asking what license cl-lib falls under. From the top of cl-lib.el in Emacs 25.1: ;;; cl-lib.el --- Common Lisp extensions for Emacs -*- lexical-binding: t -*- ;; Copyright (C) 1993, 2001-2016 Free Software Foundation, Inc. ;; Author: Dave Gillespie <daveg@synaptics.com> ;; Version: 1.0 ;; Keywords: extensions ;; This file is part of GNU Emacs. ;; GNU Emacs is free software: you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
- molloy 10y agoOh no, I meant raytracer.el. Would it fall under the GPL by default? (Does running raytracer.el within GNU Emacs count as extending it?)
- kruhft 10y agoTo run: Open raytracer.el M-x eval-buffer M-: (ray-test 256) Output will be in a buffer as well as 'image.pbm'.
- Annatar 10y agoThat code is so beatiful: clear, easily understandable. I don't think I've ever seen any C++ code which even comes close to this in readability. And it just flows. Really, LISP gets way too little credit (and use) than it deserves.
- kahrkunne 10y agoLisp gets nothing but loving praise from most people who've really looked into it. To me, it's a really good indicator of someone's quality as a programmer - someone who treats programming as just a job will probably never run into it in any meaningful way, but a true hacker will eventually encounter it and be able to appreciate its elegance. Wanting something like lisp to gain mainstream popularity would be a naive wish - your average web developer wouldn't be able to appreciate it, and over time lisp would change to become more like PhP. No offense meant to such people of course, not everyone needs to have that kind of passion, and someone needs to do web development - God knows it won't be me!
- Nekorosu 10y ago> over time lisp would change to become more like PhP. A lot of things are so wrong in this statement. First of all, PHP isn't bad. Don't get me wrong I don't like it (I also don't like Go but that's another story) but it has become so much better. Several of my colleagues use it (that's not the only language they use though) and believe me they are quite passionate about programming. Actually there is some zen in being able to use any tool life throws at you to solve some practical problems. Second, you are comparing family of languages to the one particular language. This doesn't do justice to both. Third, if the comparison with PHP was another way to say that Lisp would become worse then here is another thought. It won't. Every mainstream language I know is becoming better in a sense of better defaults and FP features. Java has got lambdas. JS ES6 is going to have TCO and strict mode which fixes a lot of old vague behaviour. Yes, there are a lot of crazy stuff in those languages because their features weren't well thought out back in the day and now it's impossible to fix everything without breaking the core semantics and behaviour. Basically you can fix some things but you can't evolve one language into another. Getting back to Lisp now. It doesn't need fixing. It has very basic and clear core which doesn't need to be fixed and a lot of advanced language features can be built upon it (and actually was built and are being built). Taking in account both that languages are becoming better with time and that Lisp has awesome core I don't see at all how's popularity can make it worse. I'd suggest reading some PLT books or taking some related courses. It helps to get the whole picture. You won't love Lisp less (probably the opposite) but you'll accept other languages more. :) I have to add I'd prefer something Lispish over anything else any day of the week. I'm looking into Clojure(ClojureScript). It's not as elegant as original Lisps and Schemes but it's tradeoffs come from real world use cases (running on top of JVM and JS). Even with them it's an awesome language.
- ginko 10y agoHow do I run this? Opening raytracer.el and doing M-x eval-buffer doesn't seem to work. Guess my Emacs 24.3.1 is too old.. EDIT: Ah, I see. You need emacs-jit from the parent project.
- kruhft 10y agoIt's built to test the JIT but shouldn't depend on it. To run: Open raytracer.el M-x eval-buffer M-: (ray-test 256) Output will be in a buffer as well as in 'image.pbm'
- sclaxton 10y agoThe whole "web developers can't be talented, passionate, real programmers" narrative is very myopic, tired, and just down right flawed. "Real programmer" machismo, in general, has no place on HN or any community that thrives to be productive and constructive.
- brians 10y agoWhy not? If programming were poorly paid scut work, that would be true. But since it's a very highly compensated ticket to the middle class---surely many will do it without love. Look at the games industry: worse pay, worse hours---those people must love their vocation.
- throwanem 10y ago> Why not? That's not the question. The question is: why? Why is programming such a special field of endeavor that those who approach it may only virtuously do so by vocation, rather than profession? The only other field I know of where that's true is the priesthood. We are not priests. Nor should we be.
- deleted 10y ago[deleted]
- Johnny_Brahms 10y agoNow, i am no web programmer, but I read that differently. Or at least I saw another truth in it compared to what theauthor meant. To me it seems like web programming is in many ways a "solved problem". Most of the tools for doing a large part of what is web development is already there, and there is a big living ecosystem for web developers. Lisp is not a part of that, and I doubt it would bring much even if it was. Learning lisp for someone that is fluent in some.pf the big frameworks seems to me like another way of being able to do less with more code and less neat abstractions. Sure, Lisp has some really cool things, and in many ways it is great for building abstractions in with all the macro facilities, but the path to the same ecosystem (to me) looks too long and too impossible.
- dang 10y ago
- topbagsvk 10y agoCL and Scheme are actually a lot nicer http://www.bagswalletssales.com http://www.bagswalletssales.com
- agumonkey 10y agoIf authors adds a lazy DAG transformation on eval and an ASCII dithered output, you could drop Autodesk Maya for Emacs.
- melling 10y agoHere's some additional information on ray tracing: https://github.com/melling/ComputerGraphics/blob/master/ray_tracing.org https://github.com/melling/ComputerGraphics/blob/master/ray_...
- pmoriarty 10y agoNow if we could only embed a flight simulator in to Emacs...
- wilkystyle 10y agoI'd settle for decent performance rendering long lines...
- eggy 10y agoMaybe you can be inspired by the flight sim written in PicoLisp RcSim back in 1991, and still included with the PicoLisp distribution. [1] [1] http://picolisp.com/wiki/?rcsim