Log In  

Cart #amateur_3d-0 | 2024-03-19 | Embed ▽ | License: CC4-BY-NC-SA
8

Hi! I've been working on trying to get something 3D for a while now, and in my first attempt, I wrote my own matrix functions, and I didn't even realize that userdata had built in support for matrix operations!! Well fortunately picotron crashed and I had to rewrite the whole thing!! :sob:

So anyway the cartridge above is my attempt at 3D rendering. This is my second ever attempt so there are probably some inefficiencies in there; so let me know if you have ways to make it run faster!! I've got 3 models included in comments in the code (no fancy gui yet, sorry, just paste the link from the comment to the "parse_obj()" function) so you can see how it performs with different size models.

The main reason I'm posting this is because I spent a really long time figuring out how userdata stuff works and using matrix operations with them, so hopefully this could be a good reference for anyone who is planning to use them?

Welp, thanks for checking this out! Later!

P#143804 2024-03-19 05:09 ( Edited 2024-04-06 06:45)

oop! totally forgot! you can rotate the model!

Here's the controls

-Rotate: wasd
-translate: arrow keys

rotate about z axis is broken but it's the z and x buttons (aka o and x)

P#143805 2024-03-19 05:12

Yo! just wanted to bump this post, I've been pretty stumped as far as why the z axis rotation isn't working... if anyone could give me some tips on how to fix it, that would be super helpful!! again, push z and x buttons to see what it's doing wrong. If you want to see a better representation, you could go into the main.lua code and switch the model to the cube.

It seems like the x and y rotations are working fine, but then when I look at them from the x or y axis instead of the z axis, it's also quite messed up. Is it possibly my rotation matrix?? do I need a proper projection in order for it to actually work? am i mistreating the z-axis as a whole?

I dunno, I've been stumped basically. any help is welcome :>

P#145879 2024-04-06 06:44
1

it looks awesome, but can you color it?

P#146029 2024-04-08 05:47

I'm planning on building on this quite a bit, yea! I wanna get it as far as I can as a functional (albeit jenky) 3d rendering framework. There's some significant issues I'm facing rn (namely the z-axis it seems) which I wanna fix before adding new features. Sadly I haven't had a lotta time to troubleshoot and debug it lately what with uni and all that. Thanks for checkin it out tho :)

P#146030 2024-04-08 06:00

[Please log in to post a comment]