Raytracing on a Graphing Calculator (again)
2024 ж. 21 Мам.
1 961 395 Рет қаралды
A long time ago, I wrote a really slow ray tracing program for a TI-84 calculator. I figured it's about time for an upgrade.
Check out the code here:
github.com/TheScienceElf/TI-8...
Music Used:
Cream of the Earth - Romeo Knight (0:00, 11:03)
Take it Slow - SefChol (2:58)
Sunday Plans - Silent Partner (5:31)
Sunshine Samba - Chris Haugen (8:33)
Clips in Order of Appearance:
Computer Color is Broken - • Computer Color is Broken (8:14)
KZhead Animated Subscribe button - • KZhead Animated Green... (12:58)
Minecraft RTX - RTX On/Off Gameplay - • Minecraft RTX - RTX On... (13:20)
Don't mind me, I'm just playing Doom 2016 raytraced on my Ti-84 Plus CE while you're stuck playing a bad Pacman port in math classes
I have the same calculator. Got any recommendations?
There's a gameboy emulator called TI-BOYCE
@Alma Franklyn "Yeah, don't mind me, casually mining Bitcoin in math class"
@Alma Franklyn LiveOverflow made a GameBoy miner
@Alma Franklyn almost no hashrate
Back in the dark ages when I was in school, I put several formulas into my TI calculator instead of memorizing them. A classmate tattled to the teacher who replied with, "If he can actually figure out how to do that, I won't stop him."
Teacher is a legend
Teacher understands that in real life you use tools
Seems like a good and understanding teacher.
Your teacher knows... By the way, if the computer gets it right, it is because you really know step by step of how it is done...
Chad
at this point, 'computer' and 'calculator' are synonyms of each other, just as much as 'compute' and 'calculate' are.
For real... Especially the fact you can run games on those...
the zilog Z80 was also used in the Gameboy
@@tf_d It is also what makes Genesis' sounds...
I mean. Yeah. "Compute" is basically "calculate a hundred things in a millisecond"
A calculator has always been a really low end computer. Well maybe not the accabus.. or is it.. I mean the accabus requires input, it shows output and you have to do the processing manually but you know...
Graphing calculators can do this but can’t draw a sin graph without taking like a full hour
i don't really understand the point of them tbh, they cost more than a low end computer like a raspberry pi which could do way, way better and can be ran for general purpose computing as well. It made sense in the 90's but now... just why?
@@ChristopherGray00 Kids are still going to high school.. you are aware of that, right?
@@Dbotime yes... you are aware that there are cheap laptops that can do general computing and faster calculations than these handheld bricks correct? a literal raspberry pi 4 would completely blow this out of the water.
@@ChristopherGray00 You try and bring a laptop into a high school exam and see how that goes for ya 👍
@@Dbotime i have, they literally provided them in my school and that was in 2016.
too cool - i struggled to get this type of thing done with opengl
i struggled with opengl altogether lmao
@@SomeRandomPiggo lmao
It's you lol
In this case it's CPU-only, so ironically that can make things easier depending on your mindset. Didn't expect you to be a programmer tho lmao
@@SomeRandomPiggo I just struggle
I guess he's the guy who made it possible for Nasa to go on moon with 4Kb of Ram in 1969
His role was specifically making sure that they could play Crysis on the same machine while they were up there.
All jokes aside, the lead software engineer for Nasa was Margaret Hamilton and she was a boss!
@@gljames24 😆😆
@@gljames24 Much Respect to her, she made history
@@gljames24 She's awesome!
The TI-Nspire is WAY more powerful. It can already run doom in full speed and color! With the source code out for Super Mario 64, I bet it could be possible to get it running on there. If not the TI-Nspire, definitely the TI-Nspire II (Which is 2.5 times faster)
holy crap, now I wanna see that!
Ehhhhh doubtful, at least not at full speed
@@NinjaWeedledon't underestimate the power of the N-spire. It can run Minecraft (albeit a knockoff one). People have developed their own graphic libraries like nGL and X3D. Impressive stuff
@@ChickenScratch True, but DOOM is a long way from Mario 64. All versions of that require a CPU and a GPU.
@@ZipplyZane it's still possible to run on only the CPU, and it can be optimized a bunch. For example there doesn't need to be any sound taking up CPU time because calculators don't have speakers. There is also the amazing work of Kaze Emanuar where he optimized the Super Mario 64 source code to be 4-5 times faster
Nerdy thing i love about this video: the font you use in your infographics is *Segoe UI!* It's the main stylistic font in most Microsoft products, and has been their logo text since *Windows 8!* It's also used in the Microsoft-published indie darling game *Ori and the Blind Forest!* It's such a clear and official-looking font and as much as people crap on Microsoft (fair) I absolutely love the look of it. Anyway awesome video!!
I suddenly flashback that segoe ui light is widely used in huge size in main screens and texts back in iOS 9 They are so clean, light, simple, small footprint, feels so neat and elegant
I think Segoe UI was somewhat used in Windows Vista/Windows XP era as well.
It's very nice to see someone working for efficient code, even as a hobby. Too much nowadays is just incredibly bloated. Good luck with future endeavors!
If more people had an efficiency mindset, our e-waste problem wouldn't be as bad as it is.
Well he was basically forced to optimize the code
Check out all of the demoscene then
@@BringMayFlowers the limits of silicon will force it
A lot of embedded development such as this focuses on efficient code. It's a constraint, a challenge, that lets me be creative, and that's why I enjoy it.
This was a real trip down memory lane. I used to love writing ray-tracers using languages and hardware completely unsuitable for them and was very familiar with fixed point math. I never quite cracked global illumination but there was no internet back then, it was all from books. I've always felt that ray tracing is the best way to learn about computer graphics because it's so intuitive - you don't even need to know any matrix math. To do the same thing using OpenGL or DirectX is an absolute nightmare because you have to master matrices, cameras, lights, shader programs, fragments etc. You can literally write a ray tracer in a dozen lines of code provided you have some function to draw pixels. You get so many things for free with RT, for example 3D textures and constructive solid modelling, because you're dealing with surfaces and objects and not millions of flat triangles. And there's a lot you can do to speed it up, which I'm surprised you didn't cover. For example using bounding volumes or adaptive sampling.
imagine what you can do now with internet
That’s so cool. Make videos about that
It's so intuitive even the ancient greeks used it to explain how human vision worked.
Do document your work
@@MaxOakland go resonate some electrons
“As always, it could always be improved. When writing some of the more complex fixed point functions, I got a little lazy and just used the floating point library instead of writing it myself in assembly.” is one of the most insane sentences i've heard said so casually
Great work! It's awesome to see your projects develop! I remember most of the comments on your TI-Basic version were "why didn't you do this in ASM?" :P The transition of moving the window to the calculator screen was so smooth I though you were using a program to do it until I re-watched it!
There he is lol. I’d had a feeling you would be here
The man the myth the legend 🙌
I know it's not the focus of the video but blender's raytracing engine, cycles, had a complete overhaul in 3.0 and renders waaay faster, especially on low end devices.
Using GPU instead of CPU would also give multiple orders of magnitude speed up
@@BoyBaykiller I think it might have messed up the recording
They should port it to TI calculators
@@BoyBaykiller that would not be a good comparison though. A gpu is great for rendering, but the calculator does not have a gpu. It is just one core.
its a shame that new cycles engine doesn't work on most AMD GPUs
I wasn't expecting another upload for atleast a month!
I was expecting a few months tbh
I was expecting another 1-2 years
Rude
@@JonahNelson7 Not trying to be rude, I'm just genuinely surprised that he's starting to upload consistently again.
Awesome video
you should check out some of rctestflights content man it’s super interesting
Your name fits your comment.
@@JobiMorkosya gotta watch his stuff lol. Definitely one of the best engineers on the platform, like no doubt more skilled than the popular ones like mark rober
It’s actually quite amazing how well a video about raytracing with calculators can teach you the basics of how shaders and graphics fundamentally work. Following step-by-step the actual process of building the renderer from scratch and seeing how they affect the final image really helps you understand how it works. I’ve been working with unity for almost a year now and have fairly good experience using shaders for my projects and now seeing how one works under the hood (albeit using a very different rendering technique) really gives you a sense of appreciation for these wonderful bits of code.
I always knew that interpreters were more computationally expensive than compilers, but I never truly appreciated it until I had to write a compiler. It was a painfully simple one, but a compiler nonetheless. Honestly, we programmers are spoiled in the modern day by how much extra processing capacity we can assume will be available to the program.
I'm not pro and i program for hobby... But i'm learning to program on old processors just for the sake of limiting me... One video which inspired me, i don't remember correctly, but it pretty popular, so i bet you know, is the one that teaches how to fit a game in a NES cartridge...
@@sophiacristina this one? kzhead.info/sun/jbuKYJlxaIJ3q4U/bejne.html
tbf though I think a lot of modern interpreters (like the js engine in your browser) actually do compile parts that get run a lot, just at runtime instead
@@cookiecan10 yes! :) This video is so cool! Even lay people can understand!
@@sophiacristina you should also look up how some enterprising individuals fit a fully functional 3D first person shooter on a 1.44mb floppy using trickery to generate textures
This video held my interest to the end, a pleasant surprise for what seemed like an absurd premise. It takes me back the early days of computer graphics and my first experiments with POV-ray on a 66MHz '386 when rendering an image took hours and Blender didn't exist.
It still takes hours, just looks better now hahaha
Great job! For sqrt(), it's easy to do using plain ints. Start with an approximate value that's 1 shifted left by half of the bits of your input number, then perform 1, 2 or 3 iterations of Raphson-Newton to get a more precise value, doing ret=(ret+x/ret)/2. You'll have to shift each intermediary result by 12 since you're using fixed point, but that can be way faster than passing by floats!
This is really impressive! I'm currently taking a computer graphics course and have implemented the techniques you mentioned in my own c++ projects (like shadows and ray tracing), but I never would've thought to try rendering using a graphing calculator. Really cool idea and video!
Banger video! Just as I'm going to sleep, you just uploaded today! Thanks The Science Elf, I'll watch this after I wake up tomorrow morning 😆 Goodnight everyone and take care! 👋
Goodnight!
Sleep is for the weaks!
as someone who fiddled around with TI-Basic for a total of 3 weeks I’ll pretend I understand this video
As a musician, I was surprised by how much of these terms I've stumbled across in my audio engineering courses. This was a great video, and I learned a lot about how sound and images are related! I was thinking of writing some advanced audio processing algorithms for my Gameboy Advance, and this video definitely helped to see your approaches on optomizing the code.
A very basic raytracing algorithm like this sounds really awesome to implement on a modern computer for real time raytracing that isn't RTX, maybe a certain Java game...
Oh, real-time raytracing has been around for a LONG time! Over 25 years. My go-to early example is Transgression 2 by MFX from 1996. kzhead.info/sun/hLKrhJaFinWhrYk/bejne.html That demo will run on a Pentium with MS-DOS or in DOSBox on a modern machine if you use the link in the description to download the original program.
@@Roxor128 Yea I also found out recently that raytracing was not a new thing that came with the RTX gpus haha. I was watching a behind the scenes clip on how Cars the Pixar movie was made and they started talking about the techniques they used to simulate reflections and lighting so they talked about raytracing. Also I really recommend anyone to rewatch Cars and appreciate the details that went into the movie from the textures and lighting to sound design.
And almost all of the shaderpacks for Minecraft uses similar algorithms ?
@@Faramik2000 Raytracing is a near ancient technology, but only used in rendering software until recently. While the hype of the RTX GPUs wasn't that big of a game changer, being able to raytrace lightning and/or shadows in real time, while running an already demanding and complex computational task without having stability problems and unplayable performance is a technological achievement by itself. While rasterizaton can get you REALLY far, raytracing can always do it better. Just a matter of time.
I usually watch your videos every time I come home from school, and I love em.
I might say that it was really good for ray tracing on a TI-84 Calculator. I really enjoyed it.
Thanks for having detailed your experience. These kind of details is probably the most interesting aspect in such video.
you did a great job explaining this to laymen. I've never done any programming or any kind of 3d rendering beyond making basic shapes in blender, but despite that you made it easy to understand the concepts
This is a sick example of how good software optimization improves hardware performance. Nice job!
I did not understand most of the stuff but I appreciate your efforts and am impressed with the results.
This is such an excellent way to teach about the rendering concepts and process step by step. Thank you!
Weirdly this, calculator video, of all things, clearly distilled and explained succinctly various key Raytracing terms better than most any other video I've come across. Terms that I've heard for years defined really well. Really cool. I remember programming on my ti83+ back in the late 90s. Good times.
i've had to write a whole raytracing program (doing about everything you mentioned) on paper for my entrance exams last year. I did fairly well on that one and enjoyed writing it a lot, even though I ultimately failed the exams. I wish I could have tried running it
Very cool! I'm quite interested in graphics programming! I've been playing around with opengl recently.
oh my gosh!! i've been watching your stuff for a good while, since i was like 11 years old lol. good to see you're back!
This was fascinating! Super well done overall!
Never thought I'd see a graphics calculator being used for graphics haha
It makes my day when the science elf uploads something
Incredible work man, this was really insightful.
I've been obsessed with the cx calculators since they were announced I love this video
This was super cool! I never would’ve suspected such capability out of my calculator, but I suppose looking back on it that makes sense.
this is why I want to get into programming. This stuff is so cool
Great Video! The LUT part made me very happy. Great that you considered that :D
WAIT YOU CAME BACK??? I used to watch all of your videos religiously! Honestly really nice to see a new video.
Great video as always!
I think your videos may have inspired some of my teammates in Valorant to also see what they can run on their calculators.
Holy smokes, that Blender vs TI-84 side-by-side is beautiful. Nicely done.
Awesome, a little optimisation goes a long way and this is the next level. ;)
So cool! Gonna try out this fixed float trick =)
Laupok on est là !!
Mdrrr
This is a great video! Thank you very much for posting. I learned a lot!
thats awesome progress compared to the older program! awesome video
love it! Even though it's ancient tech, there is something about rendering color (or even mono) images using 8/16 bit (or 24 in this case) MCUs
I like it because it uses simple tools to make complex things. Not several gigs of code and 100 watt CPU.
Wow, very impressive results. Have you looked into using SIMD instead of/with fixed points? Like break down the 24 bit interface into 3x8bit.
Probably would like to keep them 12 bit to retain a bit of headroom for the gamma correction. But well that would probobly work sort of. of casue, the SIMD have to be made in software, making it a bit more complicated because overflow between the section have to be manage seperatly. Possibly eating up the advantage
Absolutely fantastic, I always wanted to know the power of those small calculators
Super impressive. I used to code games on my calculators back in the day. This is next level stuff here.
I did this with no tricks! The trick was to use C++ instead of the built in! Also I lied about the processor. But no tricks.
yeah i honestly don't get it. what's the purpose of saying it has a certain processor and then changing your mind after 5 minutes? it's not gonna make it look more impressive for more than those 5 minutes lmao.
It’s running on the calculator natively
@@baileyharrison1030 no one questioned that
For inverse square root, you can use quake 3's algo, it's a lot faster
Interesting. Can you give a reference, please ?
@@chrisdevsoft Sure, here you go : kzhead.info/sun/o5yuj89qg3uQrKc/bejne.html
Great Video mate ....i always though that hardware is already mature enough and only the software needs to be worked on....and you proved me right😁
Nice! Fun vid and really cool concept, keep it up!
Well you know what's next, Raytracing on a Game Boy!
Elle Woods called. She wants her calculator back 💕
This content is amazing! Why can’t I like a video more than once :)
Hey dude, loved this video, so cool. I'm a bit older than you (not sure how much, but im almost 40) and back in high school, having a TI loaded with games and stuff was pretty much one of the coolest things you could have. Back then, cell phones were very rare, and the games on them sucked for the most part. You also ran the risk of having your phone confiscated (you weren't supposed to have them in class) but that was rare. Because you needed your TI for Math class though, they were not able to be confiscated, and if you weren't obvious, you could play games in your math class all day. I remember programming in basic and wanting to do ASM, but it was too hard for me at the time (much different environment and times). That said though, TI calcs have a very soft spot in my heart, and I love seeing how far you guys have taken them. If you would have told me back in my high school years that something like this would eventually come out, I wouldn't have believed ya! Again, great video to see, loved it.
have you tried porting this program to your pc to see how fast it runs? I wonder if it could have fast enough frames per second to make a simple demo game
I'm curious how well this'd run on my TI Nspire CX CAS.
Gold channel. Can't wait to watch every other video
Props for using Romeo Knight's music!
Shouldn’t Int32’s smallest number be a negative value, aka the same value as the biggest but negative? Unless you mean unsigned, that way it’d be zero (and not one, anyway)
he couldn't've meant unsigned since it's largest value would've then been ~4.3 billion something also this is pedantic but I assume that's already the theme of your comment anyways... so assuming we're using two's complement the smallest value wouldn't've been the largest value but negative, instead It would've been the (largest value + 1) but negative :p u8: 0 -> 255 i8: -128 -> 127 Though I think by smallest he meant closest to zero since the point was to show the difference between floats and ints
@@genericuser1546 I was more curious to know if it was a calculator limitation or just a small mistake :)
@@Animadoria Oh well then later he mentions that the calculator uses a 24bit architecture so I don't think it supports 32 bit ints
Now add a function to render graphs and numbers in 3d space and make all your calculator's interface run in raytraced 3d.
Wow! I once wrote a hidden line removal 3D rendered tilting double gaussian curve on a TI-84. It took hours to plot each frame.
Just commenting so you get more views! Awesome video man, wish I had the time and strength needed
ceut qui sont fr et qui vienne de laupok lever la main
When a _calculator_ that's likely thousands of times less powerful as a mid-range (of the time) GPU, but costs the same amount (at the time), you're either getting a really good deal on the GPU or are being oversold the calculator.
are you being intentionally obtuse or do you really not know why gpus have trouble with rt
Probably the latter.
was literally doing my c++ homework trying to remember and understand fixed points for the program im wringing but distracted myself with your video and you made me understand float points and fixed points better than my professor has done for the past three weeks
Bome soux
This is some impressive results!
With the scarcity in GPUs nowadays, looks like I will be booting up my games on a TI-84 😂
LOL I agree with you on that one, gonna have to build a GPU from a bunch of graphing calculators.
Cool! Now do path tracing.
Cool explanation, I'm subscribed :)
Please make a sequel, this is one of those gems that have no reason grabbing my attention this much
Two uploads in less than 1 month time Very impressive Is this going to become a regular thing
Qui est là grâce à laupok???
it's good to see your back making KZhead videos
Good job! These hardware accelerations would definitely make graphics heavy games more accessible to hand-held devices.
He can code an entire raytraced engine but still can’t figure out how to upgrade from Blender 2.79.
Not sure how I got recommended this video but wow that is super impressive man!
this is amazing!! great job!
We missed you more than you can imagine. We’re glad you’re back
dev since doing asm z80 on my ti 83/84, did a raytracer, so let's say I'm loving the content!
surprisingly entertaining, I do 3D rendering professionally and seeing this on a calculator is mind blowing
Videos like this are fascinating ❤ I've no programming, coding, and barely math literate(jk), but I still GET it. I saw one earlier about ray tracing on a zx spectrum with only 15 colors 😮
Initially, I was skeptical - but now I'm a "believer". Great job! Nice presentation, too. Thx. [P.S. I started in 3D 30+ yrs ago in '3D Studio DOS', on an IBM 386SX! And, I even had a Sinclair 1000, which as you know, has a Z80!] Anyhow, keep up the great work!...
Groovy processor! I love the Mac OS 7 cat wallpaper 😆
Very interesting video and the ultimate flex. I am looking like a chump against you. 😂 Anyway terrific job and I will follow your work from now on.
absolutely powerful. it almost justifies the extortionate prices they sell these calculators for!!!
This is amazing! Clocked in at 8min and 48secs on my Ti-84 Plus CE-T Python ed, using FASTER for a slight overclock and resetting the entire thing beforehand to get rid of old junk. Looking forward to what you'll do with this project, maybe allow for custom scenes to be added?
There is a renderer for blender that implements similar techniques that you described, called POV-Ray. This scene with radiance would take a few seconds to render on my computer, although kudos for achieving the same thing on a calculator in minutes!
Who needs Blender? Just write POVRay SDL!
I can't believe you're back!
An 2nd upload before a year has passed? Has the Elf truly returned to us!?
i like the concept of this video!