I’m thinking of doing a smaller video where I respond to your guys’ fantastic comments. Let me know if your interested. Many people have given feedback and ways to improve the performance of my triangle renderer. Let me know if I should go over them in a video. :) Edit: I will do this AFTER the next video
YES also I did comment this but I will say it again Lol I have seen you when you first started and get this video on my recommended also how do you have 2k subs with like 3 videos also remember me when you get a play button and super popular and become the new griff patch
remember 2 things: a - level is not the only thing to render, there are coins, stars, enemies, NPCs, and even the player! b - scratch has something called turbo mode.
@@goomygaming980not sure what you mean by this, Turbo mode’s purpose is removing scratch’s inbuilt delay between each block. So I don’t see what you mean that it effects wait blocks
I made some improvements to your math. The radius of the incenter of a triangle is equal to its area over its semiperimeter (half its perimeter). Its area can be calculated by evaluating |x1(y2 - y3) + x2(y3 - y1) + x3(y1 - y2)| / 2. Assuming a, b, c are the distance between x2-x3, x1-x3, and x1-x2, in respective order, The semiperimeter is (a + b + c) / 2. Dividing the area and the semiperimeter, both sides are divided by 2 so we take multiply both sides by 2, to get the final form: |x1(y2 - y3) + x2(y3 - y1) + x3(y1 - y2)| / (a + b + c) Also something you seem to do often is finding the point on a line that's closest to another point, here's how you can do that. Start with the line defined by points p1, p2 and outside point p which you want to find the closest point on the line to define t = p2 - p1 find the value (p dot t) / (t dot t) interpolate between p1 and p2 using that value and you have your closest point :) Sidenote: t dot t is the same as the square of the magnitude of t or t.x² + t.y² Also, in the part where you're moving along the line between the incenter and a point of the triangle by distance r0, you can get around the problem of vertical lines by doing this: incenter + normalize(point - incenter) * r0, where normalize means giving a vector a magnitude of 1 by dividing by its own magnitude. Links: www.desmos.com/calculator/arjw17vu1i www.desmos.com/calculator/vnioqsqfjj www.desmos.com/calculator/jto271dcja
I remember when pen used to be a default part of scratch and not an extension lol. Seriously though, this is kind of insane. I myself have just started to go into opengl rendering, and you've used math to make a software renderer in scratch. Seriously cool stuff
The radius of the inner circle is known as the inradius and has a simple formula: r = K/s where K is the area and s is the semiperimeter (a+b+c)/2 (quoted from wikibooks). If you apply this formula, I think you'll see some performance improvements since the square root won't be needed anymore!
@@Henrix1998 no, the area is pretty simple and cheap to get, if one of the sides is horizontal (it's base * height / 2, it's a rectangle cut in half). Making one of the sides horizontal isn't particularly hard either, if you know what vectors and cross multiplication are
You need to be a math teacher. This isnt even meant to be a math learning video but this SERIOUSLY helped me with my struggle in math. We need teachers like you, make the class have one common goal (in this case, making sm64 in scratch) and guiding the class through it while asking questions. Thats the supreme way of teaching
man i love when you get some basic, unconventional logic system, like minecraft redstone or scratch, and apply complex, low-level mathematics to achieve something 'simple' really makes you appreciate the genius on which our normal everyday programs are built upon
This seems like it's gonna be an awesome project! I think the 3D engine programming will take you a lot longer than it took to make this video though (ESPECIALLY in Scratch), and I imagine you're gonna have to do an insane amount of optimizing the code. One thing it looks like you overlooked is that you won't actually need to render 1000 triangles at once, because you likely won't be rendering the whole level at once, only the parts you can see.
@@Randmguy48 This is definitely going to be important to remember. Especially when getting into camera programming, as even in original N64 games, anything off camera isn’t rendered. You’re going to need every trick there is.
Dude that is fricking insane! I would’ve proudly uploaded a triangle renderer project if I came up with this, but this is just your starting point!!! All the luck in the world for your project!
This reminds me *so much* of when I was first figuring out 3D rendering when I was younger! It's pretty satisfying to figure out the math yourself and get the triangles on screen and (eventually) rotating around in 3D, even if it's not making full use of all the fancy GPU hardware that's built into every device these days. It also gives you a much greater understanding and appreciation for the hardware accelerated APIs if you ever do use them. I recall distinctly feeling like using OpenGL was "cheating" when I first learned it, because it handled so much of the triangle math for you! 😁 Best of luck! There's some serious challenges ahead but I feel like you're well equipped to tackle them!
Super cool project idea! I'm not much into Scratch anymore, but I was a huge fan of it back in 2009-2013ish. Its quite nostalgic to see that people are still trying to push the bounds of what Scratch can do. A suggestion that might help in the long run: check out vector operations like the dot product. You can avoid all of these if statements to check verticality using vector math instead. Also, its valuable to have a good idea of what kind of code is fast or slow. The best way to do this is benchmark your code, but as a rule of thumb: drawing is snail's pace, if statements are very slow, square roots and division are pretty slow, multiplication and addition are very fast. If you wanna find out why that's true, I recommend getting a computer science degree, or doing a LOT of googling ;P Good luck fam
I like your work, but I feel you make your music too loud. I can't really hear your explanations that well. Ignoring that though, that's Insane! Those parts where you showed random triangles with random colors, it looked straight out of an old PZ game. That is SO COOL!
This is great! thanks for making it approachable while packed with knowledge!! my young nephew is starting to learn scratch, thinking i might show him your videos!! (also appreciate you keeping it clean for that reason =] )
This is so amazing! I love the way how you optimize. I would've never found such a way to optimize it. Amazing content, keep going. I am already excited to se more! 👀👀
9:35 you seem smart so I do wonder why they didn't teach you this in high school, cause this was definitely part of my final exam. Great video man I was thoroughly entertained.
Awesome video! I'm very excited to watch the rest of this series. Also, here's the way I took to draw the triangles in my project that supports textures, but it is much slower. You can loop through every pixel in the triangle and decide whether that pixel is in the triangle so you can draw it or it's outside of the triangle and you should skip to the next one. To figure that out, you can calculate the area of the triangles ABC, PAB, PBC and PAC (A, B and C being the triangle points and P the pixel you're trying to figure out if it's in the triangle) using the formula ((a.x * b.y) + (b.x * c.y) + (c.x * a.y)) - ((a.y * b.x) + (b.y * c.x) + (c.y * a.x)) (I hope I typed it right) and if PAB + PBC + PAC > ABC then the pixel is outside otherwise it's inside. Lastly, when comparing distances, you don't need to calculate the square roots on both sides, for example instead of it being sqrt(x1 * x1 + y1 * y1) > sqrt(x2 * x2 + y1 * y1), it can just be (x1 * x1 + y1 * y1) > (x2 * x2 + y2 * y2). That'll make it a little faster. I hope you enjoy these tips!
Thank you! As you said, your method is much slower for higher resolutions. I may go back to triangles in the future to figure out textures but for now I’m leaving them untextured.Your comment about square roots is super helpful though! I will definitely go in to change that.
As a BS in CS who gave up near the end of his Minor in Math, I completely understood this video even though I didn't want to and now want to defenestrate myself. Oh, but really cool video btw, take my sub! Looking forward to the next painful video.
I think you should be using vectors instead. To move along a line, you subtract the start from the end, and you normalize it, multiply it by the unit length, and then add it to a point.
2:35 You can set the pen color with 3 parameters, you can even do 4 if you'd like. The way to do it is by settings 3 or 4 parameters of: R - red G - green B - blue A - alpha (transparency) (these all have to be set between 0 - 255) You can use these parameters to change the pen color by using this method: Set pen color to = A * 16777216 + R * 65536 + G * 256 + B Note that the "set pen color" has to be the one without the drop down menu. I feel like this coloring method will be easier to use if you eventually add a simple lighting system and it also makes it a little more user friendly. Hope this helps!
Madlad. I have no clue how you're going to do this, I never would have considered doing something insane like this. I wouldn't have known where to start with the triangles, but this is a very elegant solution. I'm surprised that scratch is able to handle this many triangles so well, because I tend to have lots of lag issues in scratch. Good luck making the 3d engine, I hope your computer will be able to handle it :)
I think this should be a world record for most complex way to rasterize a triangle. This is what software engineering is all about. Finding unique ways to solve problems that have very weird and specific restrictions.
@@OKF. well if we're talking about doing it in Scratch, this video would probably be it. Otherwise, there are a ton of methods you could use. I'm not experienced enough to point to one in particular as the best though.
This is a great video and im looking forward to this series, my only criticism is that your music is very loud at some parts but otherwise it was very well made.
I don't want to know the amount of work that this video would have taken to produce. I would have given up halfway through if I were you. I admire your determination and you have considerably impressed me with this video!
As someone who has *tried* making a Triangle based 3D Engine, I will tell you that the main problem I encountered and what eventually caused me to cancel the project was depth sorting the triangles
Holy shit this video is insane, ever since the first video popped up in my home page I knew this wasn't just a random channel and I've got to say, I'm not disappointed at all! Your videos are amazing and this entire project is fascinating to watch. Looking forward for the next video in the series, keep up the good work man!!!
It is a pretty smart aproach to rendering triangles but I do want to note that with this aproach you wont be able to render texured triangles, only flat coloured ones. Secondly using this method, lighting can only be calculated on a triangle basis, so there wont be any smooth edges. For specific models in sm64 lighting would be calculated on vertices by vertices basis which then would be interpolated across the entire triangle on a pixel by pixel basis which is very usefull to hide lowpolyness that these old models had. This is called Gouraud shading (heres a great video explaining the concept of it pretty well th-cam.com/video/PMgjVJogIbc/w-d-xo.htmlsi=KdT7_uv1Vj04T5KQ). Again this is not achievable using your method. But its still up to you if take your aproach and safe a lot of performance or use the original one and get closer to the original look. (Sorry for bad english)
You just saved a problem I had with the fps when trying to make a 3d game! That’s impressive! Do you have a discord server? I’m in a discord with a other game developers and I impressed them with what I have built in scratch, but you just impressed me!
You should add an option to allow people to fill in less of the triangle if they want better performance. Also you might run into some issues when you make billboard sprites because sometimes they're supposed to render under 3D geometry, which you can't do with the pen tool in scratch
Your idea about performance is actually very good, thank you! I may come back to triangles in the future but right now I have no idea how to make textures work efficiently.
@@Randmguy48 yeah, that's another thing I was thinking about. Given how low res the textures are though, you might be able to just... Not have them at all
@@kimgkomg Yeah, but pen lines in Scratch render under all sprites. So that would only work for the billboards, but all the billboards would render over all the polygons
Hey man, I just wanted to say I’m a developer with nearly 25 years industry experience now and I freaking loved this video. It reminded me of first learning to code in QBasic and writing my own crappy wireframe 3d graphics engine while in high school. I love that you are writing yours in scratch, working out optimisations for the most basic of primitives, and showing your math - really cool stuff. This was an excellent video and I look forward to following your progress! No pressure though, life is hectic!
I find it funny that you use desmos (a graphing calculator) to figure out math equations for scratch, when I use scratch to fivure out equations for my graphing calculator and the c# programming language
Great video, I highly recommend you revisit and optimize the rasterized triangles since if you're going be drawing textures on triangles (which sm64 uses on almost every mesh) you cannot use your existing triangle method
Dont give up on this man, i beg of you. ive been waiting for someone to do this since ive joined scratch as well. we all believe in you. you can do it!!!
...Hes never coming back, the triangles got him. 😭😭 The polygons were too much. (after you SOMEHOW have success with this project, you should try making Sunshine in scratch (this will never happen)).
I've done some experimentation with trying to make a 3-d engine in scratch and have always had this same problem of "filling in the triangles is too slow", so I've just used either very simple geometry or wireframe models. Glad you've figured out a good way of solving this issue
This is so awesome! Hope all goes well with the Super Mario 64 in Scratch Project and the Scriptwriting, Artwork, and Editing for these TH-cam Videos. Have fun and relax because both are really cool to see. You're doing great!
I am so incredibly impressed by your dedication and skill! I was 25 years old when I realized that math is important for everything that is fun. I hope to see many more amazing videos from you, no pressure though! Remember to take time for yourself. ☺️
Just a small suggestion. When making these videos. Make sure the music is about half the volume of the narration. Because when I listen to you talking I can hear the music overcomes your voice a lot and it distracts from what you are trying to explain
@@ZaaryJust because you're little doesn't mean you can't do research to the point that you are better than most adults at it. Practicing make you better and you shouldn't be criticized for age about your job.
This is very ambitious & I know not many people have conquered this kind of territory before, but I trust that you know what you’re doing. Best of luck.
Boy, you're videos are really great, but I have to say that at 1.3x the speed it is 5x better. So I suggest you to do something about that! Also your volume is a bit low and I am sure that makes a lot of people click off instead of turning their volume up...
that is INSANE [positive] i did some simple programming in scratch in elementary school, the teacher in compsci class wanted us to recreate a specific simple game, and of course she did not want us to figure that out based on some info, she told us the specific steps we should take because she is evil. and i was a naughty brat and after a few minutes of following the steps i just started working on my own, then i had to backtrack to figure out what i did wrong cuz some stuff did not work even remotely right what kind of lunatic teaches kids to program by spoonfeeding them code they need. if she told us some basic stuff and told us to mess around and maybe ask for help, the vast majority of the class would learn so much more.
Thats so cool if you consider all the math that went into this! I apreciate the whole project so much! If you would be able to make a such complex game as SM64 in scratch it would be revolutionary. Keep the good work up! :D
i love it when ppl get overly ambitious and use highly sophisticated math concepts for a stupid project, this is the type of content i love, keep going at it man
I’m thinking of doing a smaller video where I respond to your guys’ fantastic comments. Let me know if your interested. Many people have given feedback and ways to improve the performance of my triangle renderer. Let me know if I should go over them in a video. :)
Edit: I will do this AFTER the next video
YES also I did comment this but I will say it again Lol I have seen you when you first started and get this video on my recommended also how do you have 2k subs with like 3 videos also remember me when you get a play button and super popular and become the new griff patch
Sure! More updates are always nice!
When will part 2 come?
I wanted to invite you to something, but youtube keeps deleting my comments, can I contact you somehow? (about scratch and 3D)
youu really could have plagia- *borrowed* on off the scratch community
When the world needed him most, he left
On his scratch account, he added sometthing to his sm64 studio a month ago.
@@giohappy he just posted a community post less than a day ago
@@retroboi128thegamedev oh nice i’ll check it out
such large gaps between update videos is normal especially on a project of this scale
>comes to scratch
>decides to recreate sm64 in it
>makes a trangle
>refuses to elaborate
>leaves
He is working on the part 2
@@mekaindo Does he have a twitter where he mentioned that? Just curious!
@@BlueHarvey i don't know, but check his scratch account.
@@mekaindo I understand
i don't know man
remember 2 things:
a - level is not the only thing to render, there are coins, stars, enemies, NPCs, and even the player!
b - scratch has something called turbo mode.
Turbo mode also affects wait commands.
@@goomygaming980 you could use the time from 2000 ig
he mentioned both of these in the video
@@goomygaming980not sure what you mean by this, Turbo mode’s purpose is removing scratch’s inbuilt delay between each block. So I don’t see what you mean that it effects wait blocks
turbo mode isnt a feature i think
I made some improvements to your math.
The radius of the incenter of a triangle is equal to its area over its semiperimeter (half its perimeter).
Its area can be calculated by evaluating |x1(y2 - y3) + x2(y3 - y1) + x3(y1 - y2)| / 2.
Assuming a, b, c are the distance between x2-x3, x1-x3, and x1-x2, in respective order,
The semiperimeter is (a + b + c) / 2.
Dividing the area and the semiperimeter, both sides are divided by 2 so we take multiply both sides by 2, to get the final form:
|x1(y2 - y3) + x2(y3 - y1) + x3(y1 - y2)| / (a + b + c)
Also something you seem to do often is finding the point on a line that's closest to another point, here's how you can do that.
Start with the line defined by points p1, p2 and outside point p which you want to find the closest point on the line to
define t = p2 - p1
find the value (p dot t) / (t dot t)
interpolate between p1 and p2 using that value and you have your closest point :)
Sidenote: t dot t is the same as the square of the magnitude of t or t.x² + t.y²
Also, in the part where you're moving along the line between the incenter and a point of the triangle by distance r0, you can get around the problem of vertical lines by doing this:
incenter + normalize(point - incenter) * r0, where normalize means giving a vector a magnitude of 1 by dividing by its own magnitude.
Links:
www.desmos.com/calculator/arjw17vu1i
www.desmos.com/calculator/vnioqsqfjj
www.desmos.com/calculator/jto271dcja
OMG PROGRESS EVERYONE CALM DOWN
THATS MY ARM BOYS
Me too😊
me too❤❤❤❤
Dude, I'm a huge fan of your arm. Can I get an autograph?
Guys guys don’t worry i gotchu. Here you go (arm)
@@bobbosslot1236* thanks, your a real nice guy for letting us have your arm.
I remember when pen used to be a default part of scratch and not an extension lol. Seriously though, this is kind of insane. I myself have just started to go into opengl rendering, and you've used math to make a software renderer in scratch. Seriously cool stuff
Yeah same, it's weird having it be an extension.
ikr, haven't used scratch in a year, basically years considering last year I just did some small stuff and dipped
same
wait, its an extension now? also scratch looks different from what i remember
@@blabbilizer
Scratch released 3.0 and changed them from the smaller blocks to bug thicker blocks if thats what you see
The radius of the inner circle is known as the inradius and has a simple formula: r = K/s where K is the area and s is the semiperimeter (a+b+c)/2 (quoted from wikibooks). If you apply this formula, I think you'll see some performance improvements since the square root won't be needed anymore!
I think working out the area still needs square root, not that it is the limiting factor by any means
@@Henrix1998 no, the area is pretty simple and cheap to get, if one of the sides is horizontal (it's base * height / 2, it's a rectangle cut in half). Making one of the sides horizontal isn't particularly hard either, if you know what vectors and cross multiplication are
💀 what do these words mean
Props to this man for somehow making math entertaining
Wow
I know
yes
@@realirist yeah
@@1personithink yeah
Gives me flashbacks to the computer graphics course I followed last year, amazing!!! Love how you explain everything in a fun way like this.
I'm pretty sure sm64's polygons aren't rendered all at once, but the amount of calculations you did to optimize it was very impressive regardless
@@TheIndigoShine idk what u mean cause all 3d engine come from 2d he just applying the same thing 3d engine do but to scratch
You need to be a math teacher. This isnt even meant to be a math learning video but this SERIOUSLY helped me with my struggle in math. We need teachers like you, make the class have one common goal (in this case, making sm64 in scratch) and guiding the class through it while asking questions. Thats the supreme way of teaching
man i love when you get some basic, unconventional logic system, like minecraft redstone or scratch, and apply complex, low-level mathematics to achieve something 'simple'
really makes you appreciate the genius on which our normal everyday programs are built upon
This has strong "i'm gonna build a house with Fischer price plastic tools" vibes and honestly i love it.
You are seriously talented and smart man. Good luck with school, and good luck with this project. Can't wait to see where it goes!
Man. Being a small TH-cam creator, i know you put a LOT of effort into this.
You'd be correct
@@Randmguy48yo any updates
This seems like it's gonna be an awesome project! I think the 3D engine programming will take you a lot longer than it took to make this video though (ESPECIALLY in Scratch), and I imagine you're gonna have to do an insane amount of optimizing the code. One thing it looks like you overlooked is that you won't actually need to render 1000 triangles at once, because you likely won't be rendering the whole level at once, only the parts you can see.
That is true but it is still a possibility. Also just good to have a good triangle renderer.
Occlusion culling is super slow, he needs to use backface culling
@@Randmguy48
This is definitely going to be important to remember. Especially when getting into camera programming, as even in original N64 games, anything off camera isn’t rendered. You’re going to need every trick there is.
Dude that is fricking insane! I would’ve proudly uploaded a triangle renderer project if I came up with this, but this is just your starting point!!! All the luck in the world for your project!
Right? This is fucking awesome
Who knew there was so much going into drawing a triangle. This is incredible!
There actually isn't that much. This is super overcomplicated.
@@ChuckSploder ok, let's see you do it.
@@ChuckSploderok, let’s see you do it.
@@ChuckSploder ok, let’s see you do it.
@@ChuckSploder ok, let's see you do it.
This reminds me *so much* of when I was first figuring out 3D rendering when I was younger! It's pretty satisfying to figure out the math yourself and get the triangles on screen and (eventually) rotating around in 3D, even if it's not making full use of all the fancy GPU hardware that's built into every device these days. It also gives you a much greater understanding and appreciation for the hardware accelerated APIs if you ever do use them. I recall distinctly feeling like using OpenGL was "cheating" when I first learned it, because it handled so much of the triangle math for you! 😁
Best of luck! There's some serious challenges ahead but I feel like you're well equipped to tackle them!
You don't understand how long I've been waiting for this video you are really underrated!
“alright boss, trianglemaker’s up and running”
“Management says we need to start making circles”
“I hate this job”
pen down…
pen up….
circle
man, this project journey is going to be amazing. can't wait to see this project!
Man, you can create your own 3D render engine and you made it in scratch.... You are one of the reasons I'm still in this community after so much time
Oh my god man, good work! i can't wait for the final product. It's going to be really cool.
Dang this is impressive! I haven't used Scratch in a few years and it seems the community is getting more and more ambitious haha
Super cool project idea! I'm not much into Scratch anymore, but I was a huge fan of it back in 2009-2013ish. Its quite nostalgic to see that people are still trying to push the bounds of what Scratch can do. A suggestion that might help in the long run: check out vector operations like the dot product. You can avoid all of these if statements to check verticality using vector math instead. Also, its valuable to have a good idea of what kind of code is fast or slow. The best way to do this is benchmark your code, but as a rule of thumb: drawing is snail's pace, if statements are very slow, square roots and division are pretty slow, multiplication and addition are very fast. If you wanna find out why that's true, I recommend getting a computer science degree, or doing a LOT of googling ;P Good luck fam
Thank you! I will keep that in mind for the future, and if I come back to optimize my triangles.
I like your work, but I feel you make your music too loud. I can't really hear your explanations that well.
Ignoring that though, that's Insane! Those parts where you showed random triangles with random colors, it looked straight out of an old PZ game. That is SO COOL!
4 MONTHS.
1 TRIANGLE.
LETS GOOOOOOOOO
This is great! thanks for making it approachable while packed with knowledge!! my young nephew is starting to learn scratch, thinking i might show him your videos!! (also appreciate you keeping it clean for that reason =] )
Thank you!
This is so amazing! I love the way how you optimize. I would've never found such a way to optimize it. Amazing content, keep going. I am already excited to se more! 👀👀
pls part 2 its been a year
He said he's planning to release it this month
@@edemaiscomtheovieira2718he hasn’t done it yet :/
its gonna take a bit, especially since scratch is pretty limited
YES PLS PART 2 IT'S BEEN A YEAR!
@@edemaiscomtheovieira2718 false it's been 3 months
Awesome stuff! Love how you go into detail with the math.
9:35 you seem smart so I do wonder why they didn't teach you this in high school, cause this was definitely part of my final exam. Great video man I was thoroughly entertained.
Awesome video! I'm very excited to watch the rest of this series. Also, here's the way I took to draw the triangles in my project that supports textures, but it is much slower. You can loop through every pixel in the triangle and decide whether that pixel is in the triangle so you can draw it or it's outside of the triangle and you should skip to the next one. To figure that out, you can calculate the area of the triangles ABC, PAB, PBC and PAC (A, B and C being the triangle points and P the pixel you're trying to figure out if it's in the triangle) using the formula ((a.x * b.y) + (b.x * c.y) + (c.x * a.y)) - ((a.y * b.x) + (b.y * c.x) + (c.y * a.x)) (I hope I typed it right) and if PAB + PBC + PAC > ABC then the pixel is outside otherwise it's inside. Lastly, when comparing distances, you don't need to calculate the square roots on both sides, for example instead of it being sqrt(x1 * x1 + y1 * y1) > sqrt(x2 * x2 + y1 * y1), it can just be (x1 * x1 + y1 * y1) > (x2 * x2 + y2 * y2). That'll make it a little faster. I hope you enjoy these tips!
Thank you! As you said, your method is much slower for higher resolutions. I may go back to triangles in the future to figure out textures but for now I’m leaving them untextured.Your comment about square roots is super helpful though! I will definitely go in to change that.
As a BS in CS who gave up near the end of his Minor in Math, I completely understood this video even though I didn't want to and now want to defenestrate myself.
Oh, but really cool video btw, take my sub! Looking forward to the next painful video.
I think you should be using vectors instead. To move along a line, you subtract the start from the end, and you normalize it, multiply it by the unit length, and then add it to a point.
2:35 You can set the pen color with 3 parameters, you can even do 4 if you'd like.
The way to do it is by settings 3 or 4 parameters of:
R - red
G - green
B - blue
A - alpha (transparency)
(these all have to be set between 0 - 255)
You can use these parameters to change the pen color by using this method:
Set pen color to = A * 16777216 + R * 65536 + G * 256 + B
Note that the "set pen color" has to be the one without the drop down menu.
I feel like this coloring method will be easier to use if you eventually add a simple lighting system and it also makes it a little more user friendly.
Hope this helps!
Madlad. I have no clue how you're going to do this, I never would have considered doing something insane like this. I wouldn't have known where to start with the triangles, but this is a very elegant solution. I'm surprised that scratch is able to handle this many triangles so well, because I tend to have lots of lag issues in scratch. Good luck making the 3d engine, I hope your computer will be able to handle it :)
Thank you!
W*
@@Randmguy48
E
e
I think this should be a world record for most complex way to rasterize a triangle.
This is what software engineering is all about. Finding unique ways to solve problems that have very weird and specific restrictions.
What would be the easiest or fastest way to rasterize?
And how would I go about learning it
@@OKF. well if we're talking about doing it in Scratch, this video would probably be it.
Otherwise, there are a ton of methods you could use. I'm not experienced enough to point to one in particular as the best though.
legends say he's still making a 2nd triangle
actually im making a 3d triangle 👀🤯
@@Randmguy48 NO WAY
@@Randmguy48 im making 1 still(
@@Randmguy48 pls upload :(
This is a great video and im looking forward to this series, my only criticism is that your music is very loud at some parts but otherwise it was very well made.
i come back every few months to see if you uploaded the next part... i wish you have all the motivation you need
Underrated.. like your scratch projects!
Off topic but your hair is majestic
Thank you
I don't want to know the amount of work that this video would have taken to produce. I would have given up halfway through if I were you.
I admire your determination and you have considerably impressed me with this video!
this is a greater and more drawn-out tragedy than even shakespear could come up with
drawn-out tragedy
Shakespear probably couldn't even write his own game engine in C 🥱
Can’t wait, I’d love to try make ocarina of time once you have a full graphics engine :3
As someone who has *tried* making a Triangle based 3D Engine, I will tell you that the main problem I encountered and what eventually caused me to cancel the project was depth sorting the triangles
I still have not a clue
“The first step is to make a triangle, this challenge is going to be super hard” is everything to me, that is what programming is
Holy shit this video is insane, ever since the first video popped up in my home page I knew this wasn't just a random channel and I've got to say, I'm not disappointed at all! Your videos are amazing and this entire project is fascinating to watch. Looking forward for the next video in the series, keep up the good work man!!!
Thanks!!
i really enjoyed this, i understand that making these takes a long time, but we have been waiting longer than we waited for this episode to come out!
It is a pretty smart aproach to rendering triangles but I do want to note that with this aproach you wont be able to render texured triangles, only flat coloured ones. Secondly using this method, lighting can only be calculated on a triangle basis, so there wont be any smooth edges. For specific models in sm64 lighting would be calculated on vertices by vertices basis which then would be interpolated across the entire triangle on a pixel by pixel basis which is very usefull to hide lowpolyness that these old models had. This is called Gouraud shading (heres a great video explaining the concept of it pretty well th-cam.com/video/PMgjVJogIbc/w-d-xo.htmlsi=KdT7_uv1Vj04T5KQ). Again this is not achievable using your method.
But its still up to you if take your aproach and safe a lot of performance or use the original one and get closer to the original look.
(Sorry for bad english)
interesting. I'll take a look
this is EXTREMELY impressive for scratch, congratulations for this amazing achievement.
You just saved a problem I had with the fps when trying to make a 3d game! That’s impressive! Do you have a discord server? I’m in a discord with a other game developers and I impressed them with what I have built in scratch, but you just impressed me!
I don't have a Discord server but I am thinking of making one if enough people request it!
Can't wait for the next vid bro! amazing work
Great video!
Of course that's a great video! He put a lot of effort!
BROOOOOO, your idea that you make SM64 in scratch, is awesome! KEEP UP THE GOOD WORD BRO
You should add an option to allow people to fill in less of the triangle if they want better performance. Also you might run into some issues when you make billboard sprites because sometimes they're supposed to render under 3D geometry, which you can't do with the pen tool in scratch
Your idea about performance is actually very good, thank you! I may come back to triangles in the future but right now I have no idea how to make textures work efficiently.
@@Randmguy48 yeah, that's another thing I was thinking about. Given how low res the textures are though, you might be able to just... Not have them at all
He could just give each billboarded sprite a priority no? I'm pretty sure the real sm64 does that
@@kimgkomg Yeah, but pen lines in Scratch render under all sprites. So that would only work for the billboards, but all the billboards would render over all the polygons
@@owencmyk can't you stamp the sprites then and then hide it
this is the best content ive seen in a while. youre awesome!
*starts making sm64 in scratch**
**Makes triangle**
**Leaves**
**Refuses to ellaborate**
i love stealing jokes from other people
Hey man, I just wanted to say I’m a developer with nearly 25 years industry experience now and I freaking loved this video. It reminded me of first learning to code in QBasic and writing my own crappy wireframe 3d graphics engine while in high school. I love that you are writing yours in scratch, working out optimisations for the most basic of primitives, and showing your math - really cool stuff. This was an excellent video and I look forward to following your progress! No pressure though, life is hectic!
You: talking about advanced math
The background music: ‼️‼️🔥🔥🔥⚠️⚠️🗣🏃🏃🏃🆙🆙🆙🆙🆙🫵🫵🫵🪩🪩🪩❌❌❌❌⭕️⭕️📛📛
I find it funny that you use desmos (a graphing calculator) to figure out math equations for scratch, when I use scratch to fivure out equations for my graphing calculator and the c# programming language
This guy is underrated.
Great video, I highly recommend you revisit and optimize the rasterized triangles since if you're going be drawing textures on triangles (which sm64 uses on almost every mesh) you cannot use your existing triangle method
this is what the teacher means by "you will need to know the pythagorean theorem later in you life"
Dont give up on this man, i beg of you. ive been waiting for someone to do this since ive joined scratch as well. we all believe in you. you can do it!!!
...Hes never coming back, the triangles got him. 😭😭
The polygons were too much. (after you SOMEHOW have success with this project, you should try making Sunshine in scratch (this will never happen)).
that would be an action packed blockbuster film
I've done some experimentation with trying to make a 3-d engine in scratch and have always had this same problem of "filling in the triangles is too slow", so I've just used either very simple geometry or wireframe models. Glad you've figured out a good way of solving this issue
and then he was never seen again..
yeah :(
hes awesome at this tho
This is so awesome! Hope all goes well with the Super Mario 64 in Scratch Project and the Scriptwriting, Artwork, and Editing for these TH-cam Videos. Have fun and relax because both are really cool to see. You're doing great!
Is there any Discord or anything we can join? Would add the community to it, who could give you nice ideas ;)
There isn't right now but if enough people really want it I could make one.
i wouldn't have thought something like mario 64 in scatch would be ever possible, great work!
After i watched this video i sent it to my algebra teacher to see her reaction.
What he said?
@@mekaindo she was completely stumped and didnt understand anything
@@BTDlegand101 lmao
@@mekaindo yeah. i cant wait for Randomguy48 to remember he still has to add the 4th side to each triangle!
I am so incredibly impressed by your dedication and skill! I was 25 years old when I realized that math is important for everything that is fun.
I hope to see many more amazing videos from you, no pressure though! Remember to take time for yourself. ☺️
I’m sure this is a great video, but I _cannot_ hear him above the music
We want you to complete this serie as fast as possible, because we're enjoying it so much! KEEP GOING!!! 💪💪💪🔥🔥🔥
Just a small suggestion. When making these videos. Make sure the music is about half the volume of the narration. Because when I listen to you talking I can hear the music overcomes your voice a lot and it distracts from what you are trying to explain
Good to know. Thanks!
I'm seeing a channel that could possibly be the vsauce of the next generation on TH-cam. Keep it up man amazing video
As a games developer, this hurts my soul in every single possible way and I love it
ur probably like 15 year old, not a game developer
@@Zaary oh yes because people need to be 90 years old to be considere game developers
@@ZaaryAge doesn’t really matter that much here
@@TotalDramaHarold it does, with age comes experience, and in gamedev without lots of experience you are a really bad at it
@@ZaaryJust because you're little doesn't mean you can't do research to the point that you are better than most adults at it. Practicing make you better and you shouldn't be criticized for age about your job.
this is gonna be legendary, holy hell
good luck!
Me: still waiting for part 2 for almost 1 jear...
This is very ambitious & I know not many people have conquered this kind of territory before, but I trust that you know what you’re doing. Best of luck.
wow you made a trinagle
Boy, you're videos are really great, but I have to say that at 1.3x the speed it is 5x better. So I suggest you to do something about that! Also your volume is a bit low and I am sure that makes a lot of people click off instead of turning their volume up...
I hope that this all goes well
I commend you for not giving up on this. I'd love to see the finished project!
that is INSANE [positive]
i did some simple programming in scratch in elementary school, the teacher in compsci class wanted us to recreate a specific simple game, and of course she did not want us to figure that out based on some info, she told us the specific steps we should take because she is evil. and i was a naughty brat and after a few minutes of following the steps i just started working on my own, then i had to backtrack to figure out what i did wrong cuz some stuff did not work even remotely right
what kind of lunatic teaches kids to program by spoonfeeding them code they need. if she told us some basic stuff and told us to mess around and maybe ask for help, the vast majority of the class would learn so much more.
The rendering of the triangle was interesting, but even more shocking was how beautiful you look
Where is the next video?
Great video man, I was entertained the entire time. You also have no idea how happy it makes me that you’re in marching
Bro are you going to upload
Thats so cool if you consider all the math that went into this! I apreciate the whole project so much! If you would be able to make a such complex game as SM64 in scratch it would be revolutionary. Keep the good work up! :D
Bro is smarter than griffpatch 😯
Bro I thought someone with like a million subs would have made this. You are so underrated great job 👍
Bro cooked and then dropped out
i love it when ppl get overly ambitious and use highly sophisticated math concepts for a stupid project, this is the type of content i love, keep going at it man
I HOPE IT GOES WELL
Bro the wait was worth it. Hope you finish bob omb battlefield within the next year or 2