Brohann's 3D devlog

Looks nice! Gravity is a bit much but otherwise movement feels good. (depending on how this renderer is made) It may run a lot better if you combined some of the polygons, though this would make it not possible to make it look very cubic as it is right now and will likely require extra code or manually positioning the corners. Overall, great project!

4 Likes

We’re getting closer to getting full blown 3D games in makecode

4 Likes

Yeah, most of the slowdown is actually from calculating the vertices and right now there is way too many that are not needed

3 Likes

@Brohann . isn’t the polygon function (single color) already in makecode arcade?

helpers.imageFillTriangle(img, x0, y0, x1, y1, x2, y2, col)
1 Like

This function was added after Brohann worked on this.

3 Likes

i see, that makes sense.

2 Likes

Hmm… :eyes: I see that you forgot to close the first bracket. I’ll give you a C in grammar. Not to forget the missing full stop… :memo:

Hmm… interesting…

:memo: :memo: :memo:

C-. Final grade.

(this is a joke btw)

10 Likes

And I’m allowing it, because I know @Sarge can get it as good as they give it! :wink:

10 Likes

Did you just drop me from an A to a C because of a missing bracket :sob:

On a second note, I completely forgot I ever made this post. I still get a teeny tiny bit annoyed when someone says Java, but I don’t point it out because it really doesn’t matter that much

11 Likes

Why am I just seeing this project now?

1 Like

for anyone who wants the code in english english, around 24 triangles are connected to different vertexes, making an illusion of a 3D tilemap, how the camera works is beyond my iq

1 Like

my obj to makecode arcade converter is in working order, but it might be a while until it is usable. I might make a tutorial on how to do it sometime idk. Anyways, I needed a 3D model to test it out but they all have huge amounts of triangles so I ended up using a low-poly pikachu thingy.

it runs at around 2-6 fps on my super super fast mac so I estimate it will run at 1-4 fps on your computer, so around 0.25-1 SPF(seconds per frame)

as you can see, the model has to be extremely low-poly to get a decent framerate with my current engine.

if you want me to try it with another model, feel free to ask and provide a link to it!

edit: I’ve made a huge breakthrough! I just had to implement quicksort and now I got this same pikachu model to run at 200fps!

7 Likes

This looks amazing!
(But also 6fps on my phone lol)

2 Likes

HUGE UPDATE
I optimised the engine to literally be 50 times faster.
@Kiwiphoenix364 the problem was not calculating the vertices, the slowdown was from sorting the triangles with the sortarray thingy, so I used a different way of sorting the triangles array.

14 Likes

@Brohann could you share your obj to makecode converter? I’d be curious to play around with it.

13 Likes

WOW that’s awesome!! You’re litterally one of the best makecoders ever, this is a BREAKTHROUGH!!! We really are in the future now…

7 Likes

I’m assuming this will become an extension soon? (how will you encode the vertices and triangles in a block friendly way :thinking: ) This looks super cool, and viable for games now that it has good performance!

4 Likes

Happy cakeday! :partying_face: :dancer: :tada: :confetti_ball:

5 Likes

Cool! I like where this is going. Depth sorting and vertice manipulation are the most difficult part of 3d graphics. The depth sorting is why I haven’t got around to finishing my renderer yet. Glad to see you coding 3d in Arcade. Ever since triangle fill was added (thanks to @AqeeAqee , I’ve been waiting for a cool 3d renderer, and you’ve done it! Excited to see more full 3d games!

For things like 3d racing games, collision is going to be difficult though, that will be a big task…

6 Likes

sure! here are the steps

  1. find your model
  2. make a tinkercad account
  3. create a new 3d model thingy
  4. upload your model into the editor
  5. scale it to a normal size, you might want to hold shift while scaling
  6. center your model on all axises
  7. export your model as a .obj
  8. unzip the file
  9. double click on the .obj or open it as a text file
  10. copy all of the vertice thingies to your clipboard. The vertices are the lines that start with a “v”
  11. go to this scratch project (It’s in scratch I didn’t really have a choice)
  12. you can customise what color(s) the triangles are going to be
  13. click the green flag if the project is not already running
  14. paste the vertice data into the answer box and press enter
  15. go back to your .obj file and find out how many vertices there are. The number should be right under the vertice data
  16. put the number of vertices into the answer box and press enter
  17. copy the data for the triangles in your .obj file similar to what you did in step 10. the triangle data should all start with an “f”
  18. paste the triangle data into the answer box and press enter
  19. find how many triangles there are in the .obj file. the number should be at the bottom of the triangle data
  20. put the number of triangles (or faces) into the answer box and press enter
  21. by now both of the lists (vertices and triangles) should have something in it
  22. right click on the “vertices” list and export it. do the same thing with the “triangles” list
  23. go to any of my super fast fps demos above and edit the code.
  24. open the vertices.txt file and copy it contents
  25. replace the vertice array in the makecode project with the code you just copied
  26. open the triangles.txt file you just downloaded and copy its contents
  27. replace the triangles array in the makecode project with the code you just copied
  28. change the color pallete to whatever. keep in mind that this converter does not keep the colors of the original model
  29. enjoy!

this is totally unconventional sorry
if anyone has any issues or gets an error feel free to let me know!

16 Likes