7 ms·
Ray Tracing in Notepad.exe at 30 FPS (2020)
- inglor 4y agoThis needs a 2020 flare @dang Still very neat! Previous discussion: https://news.ycombinator.com/item?id=23246221 https://news.ycombinator.com/item?id=23246221
- habibur 4y ago"Using notepad.exe as an output device" is the message here. But impressive job nevertheless.
- AtlasBarfed 4y agois curses that hard? Not just a sarcastic question, I've never coded curses.
- shadowofneptune 4y agoCurses 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 4y agoCurses 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.
- deleted 4y ago[deleted]
- aardvarkr 4y agoGreat 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!
- soheil 4y agoFor 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.
- Silverback_VII 4y ago
- CyberDildonics 4y agoDo 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 4y agoExactly. 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
- soheil 4y agoI was referring to possibly not knowing about Ray Tracing which is a technique and a subset of the field of computer graphics and thus possibly not understanding its computational complexity, I don't know why you're upset at me.
- CyberDildonics 4y agoEven kids know what ray tracing is these days, it's used in video games to sell graphics cards. Teenagers write ray tracers in undergrad classes. This example is a cube and plane with one light. It is lines from the camera checked for collision against triangles then a line from the collision point checked against a light. Checking for collision against a triangle is just checking collision against the infinite plane and checking if that point is inside the triangle. What is the "significance" you are talking about? This is something common with an uncommon display.
- notorandit 4y agoAs cool as useless. But still cool.
- savant_penguin 4y agoThis is hilarious Now feed it Doom haha
- deleted 4y ago[deleted]
- anaisbetts 4y agoLove 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 4y agoI assume this allows them to get to 30fps.
- quickthrower2 4y agoAnd he found it less boring too!
- deleted 4y ago[deleted]
- louissan 4y agoutterly useless hence absolutely indispensable. <3
- cphoover 4y agoOnly a matter of time before doom
- rahen 4y agoThat seems to be ray casting (a la Wolfenstein 3D), not ray tracing.
- zardo 4y agoSeeing the rotating cube and glancing over the code, it looks like ray tracing to me.
- karma_fountain 4y agoThey 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.
- Dwedit 4y agoHey 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.
- int_19h 4y agoNotepad has been rewritten using the new WinRT APIs in Win11, so I doubt any of that still works.
- Dwedit 4y agoA quick check of Windows 11 notepad reveals that it is still creating child windows. Text editor is of class RichEditD2DPT, status bar is msctls_statusbar32, menu bar is Windows.UI.Composition.DesktopWindowContentBridge. As long as they are actual win32 Windows, then you can still interact with them using the system's API functions. Other fun fact, Direct3D has interfaces inside of GDI32.DLL, look at all the D3DKMT functions there.
- chunkyks 4y agoEvery 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 https://github.com/chunky/sqlraytracer
- alex989898 4y agoThat is really impressive!
- aliqot 4y agoInvoluntarily said 'woah'
- chunkyks 4y agoThank you! I try!
- guyzero 4y agoSadly I can only upvote you once for using "off-piste"
- dataking 4y ago> Standing on the Necks of Giants Put a smile on my face (from the sqlraytracer README)
- mambodog 4y agowell as long as we're posting them: https://github.com/jsdf/applescript-raytracer https://github.com/jsdf/applescript-raytracer
- jheriko 4y agoreminds me of doing this in excel in 1998 ... although i did a wireframe with bresenham, and struggled to exceed 15fps