[HN Gopher] Ray Tracing in Notepad.exe at 30 FPS (2020)
       ___________________________________________________________________
        
       Ray Tracing in Notepad.exe at 30 FPS (2020)
        
       Author : madmax108
       Score  : 273 points
       Date   : 2022-10-10 13:51 UTC (9 hours ago)
        
 (HTM) web link (kylehalladay.com)
 (TXT) w3m dump (kylehalladay.com)
        
       | [deleted]
        
       | anaisbetts wrote:
       | Love this though I have to ask, wouldn't getting the HWND of the
       | Edit Control via WindowFromPoint and sending WM_SETTEXT be easier
       | than digging through memory?
       | 
       | I guess the point may be to learn how Cheat Engine can be used in
       | a practical way to hook things which is definitely more along the
       | lines of some of the author's other posts!
        
         | scoopertrooper wrote:
         | I assume this allows them to get to 30fps.
        
           | quickthrower2 wrote:
           | And he found it less boring too!
        
       | rahen wrote:
       | That seems to be ray casting (a la Wolfenstein 3D), not ray
       | tracing.
        
         | karma_fountain wrote:
         | They are really historically the same thing, but I think ray
         | casting has come to mean ray tracing a lower dimensional thing
         | like a map and representing the results in a higher dimension,
         | like 3d space.
        
         | zardo wrote:
         | Seeing the rotating cube and glancing over the code, it looks
         | like ray tracing to me.
        
       | chunkyks wrote:
       | Every time I see someone's off-piste raytracer project, I feel
       | compelled to link my own silly contribution to that diaspora:
       | https://github.com/chunky/sqlraytracer
        
         | aliqot wrote:
         | Involuntarily said 'woah'
        
           | chunkyks wrote:
           | Thank you! I try!
        
         | alex989898 wrote:
         | That is really impressive!
        
         | guyzero wrote:
         | Sadly I can only upvote you once for using "off-piste"
        
       | soheil wrote:
       | For those who don't understand the significance of this I highly
       | encourage you to learn about ray tracing and the complexity of
       | it. If combining something that complex with something so simple
       | (Notepad.exe) is not art I don't know what is.
        
         | st_goliath wrote:
         | > For those who don't understand the significance of this I
         | highly encourage you to learn about ray tracing and the
         | complexity of it.
         | 
         | Ray tracing, at it's core, is actually beautifully simple.
         | 
         | Also, ray tracing is absolutely not the interesting (or
         | "significant") part of this article. I highly encourage to RTFA
         | first.
         | 
         | As for combining the two: having read on Raymond Chens blog
         | about all the optimization that went into Notepad over the
         | years, I'd guess Notepad is the real complex part here.
        
         | gmiller123456 wrote:
         | I often considered the lure of raytracing as a project was that
         | it was rather simple to get really good results. Of course
         | there is no limit to how complicated you can make one, you
         | don't have to put much time in to get really nice images.
        
           | corysama wrote:
           | I'm assuming you've seen https://raytracing.github.io/ ;)
        
         | CyberDildonics wrote:
         | Do you think it might be a little patronizing to assume people
         | don't understand that text inside notepad is being used as a
         | display when there is a video showing it off?
        
           | dixie_land wrote:
           | Exactly. The idea is neat but it's no different than the mini
           | ray tracer you write in graphics 101, with the twist that the
           | output "frame" buffer is the text buffer of notepad
        
         | Silverback_VII wrote:
        
       | [deleted]
        
       | habibur wrote:
       | "Using notepad.exe as an output device" is the message here.
       | 
       | But impressive job nevertheless.
        
         | AtlasBarfed wrote:
         | is curses that hard? Not just a sarcastic question, I've never
         | coded curses.
        
           | shadowofneptune wrote:
           | Curses does not exist on Windows, but this could be done
           | easily using Windows's console API or ANSI escape sequences.
           | Wouldn't be nearly as fun, though.
        
             | junon wrote:
             | Curses also uses escape sequences, and curses outputs are
             | supported by the Windows Terminal (not CMD.exe however).
             | Curses doesn't do anything fancy, just convoluted.
        
       | Dwedit wrote:
       | Hey I can draw in Notepad.exe too! GetDC(hwnd)
       | 
       | Note that if you actually want to do something like this, you'd
       | probably need to deactivate the Edit window from rendering
       | anything, sending WM_SETREDRAW will probably work.
        
       | inglor wrote:
       | This needs a 2020 flare @dang
       | 
       | Still very neat!
       | 
       | Previous discussion:
       | https://news.ycombinator.com/item?id=23246221
        
       | notorandit wrote:
       | As cool as useless. But still cool.
        
       | cphoover wrote:
       | Only a matter of time before doom
        
         | fareesh wrote:
         | Happened yesterday I believe. I saw it on Twitter
         | 
         | https://twitter.com/SamNChiet/status/1579140903150964736
        
         | Yuioup wrote:
         | The very reason this post exists.
        
       | [deleted]
        
       | aardvarkr wrote:
       | Great write up! Building a memory scanner and using that to
       | inject text into notepad seems like a fascinating journey and it
       | sounds like you learned a lot. Keep up the good work!
        
       | savant_penguin wrote:
       | This is hilarious
       | 
       | Now feed it Doom haha
        
         | bcjordan wrote:
         | https://twitter.com/samnchiet/status/1579140903150964736
        
         | sphars wrote:
         | Earlier today: https://news.ycombinator.com/item?id=33149796
        
       | louissan wrote:
       | utterly useless hence absolutely indispensable. <3
        
       | jheriko wrote:
       | reminds me of doing this in excel in 1998
       | 
       | ... although i did a wireframe with bresenham, and struggled to
       | exceed 15fps
        
       ___________________________________________________________________
       (page generated 2022-10-10 23:00 UTC)