This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Creator's profile picture

What is the math related to 3D graphics?

Started by Creator, 20 April 2015 - 05:29 PM
Creator #1
Posted 20 April 2015 - 07:29 PM
I want to make a 3d game, but first I have to learn how to render 3d graphics to a 2d surface. Does anyone know how to do it? You can also post links.

Thanks in advance,

Creator
KingofGamesYami #2
Posted 20 April 2015 - 07:35 PM
Well, I found this on stack overflow. Please don't ask me to explain it, I don't understand half of it.
Creator #3
Posted 20 April 2015 - 07:45 PM
Thanks. You are almost always first to answer. Do you spend the whole day in front of the forums to help noobs like me? ;)/>
KingofGamesYami #4
Posted 20 April 2015 - 07:48 PM
Well, I have lots of free time in school… So I check the forums a lot. Usually I get on around 8:20 or so, when I get dropped off, then check in again after first period, again after second, and again after third, then after fourth I'm on during lunch, then study hall (I was in study hall when I posted that). Then I'm on a bit in 6th (right now) and pretty much gone during 7th. I check them again when I get home (3 something). So yes, pretty much the whole day ;)/>.
Creator #5
Posted 20 April 2015 - 07:54 PM
Which grade are you in? I am 9th.
CrazedProgrammer #6
Posted 20 April 2015 - 08:13 PM
You can certainly try, but I've been stuck on the algorithms for more than 2 months :P/>
I recommend you read the WikiPedia article on perspective projection it because it explains everything and has all the maths.
You can make a top-down perspective with:
x = p.x / p.z
y = p.y / p.z
The z-axis is the depth (smaller = closer to the camera)
And you have to do the transformations yourself :P/>
Here are a couple examples of 3D in ComputerCraft:
3D Maze
A little 3D demo in CC
Wolf3d-style 3d engine
Creator #7
Posted 20 April 2015 - 08:19 PM
Thanks, community crazedProgrammer
Lignum #8
Posted 20 April 2015 - 08:43 PM
The easiest way to do 3D graphics is raycasting, which is also what the wolf3d demo uses.
Creator #9
Posted 20 April 2015 - 09:36 PM
What is raycasting?

What bothers me most is how to take the camera angle and position into account. Moreover, I have no idea how to transform from 3d to 2d.
Edited on 20 April 2015 - 07:37 PM
flaghacker #10
Posted 20 April 2015 - 09:45 PM
What is raycasting?

What bothers me most is how to take the camera angle and position into account. Moreover, I have no idea how to transform from 3d to 2d.

1) really? http://lmgtfy.com/?q=raycasting

2) reading the posted links would definitely be a good start
Creator #11
Posted 20 April 2015 - 09:53 PM
Well,I've actually read them and maybe I was not smart enough to understand them. :)/>
CrazedProgrammer #12
Posted 20 April 2015 - 09:59 PM
Well,I've actually read them and maybe I was not smart enough to understand them. :)/>
Then you probably aren't smart enough to understand how 3d perspective projection works,
and then you're out of luck, because there aren't any simple tutorials for it.
Sorry, but that's the problem that I ran into.
Edited on 20 April 2015 - 07:59 PM
Creator #13
Posted 20 April 2015 - 10:02 PM
I was joking. Thruth was that I read them but was too lazy to try myself to undestand them
Creator #14
Posted 21 April 2015 - 06:40 AM
I kind of get it now. Thanks

PS: http://lmgtfy.com/?q=9gag
Edited on 21 April 2015 - 04:49 AM
Creator #15
Posted 21 April 2015 - 01:12 PM
This is a good site.
This one too.
And this one.
LeDark Lua #16
Posted 16 June 2015 - 07:11 PM
Ok, this is awesome! But there is a problem with light. I know there are no lights in this game, but I feel like im playing a 2D game. If there would be "fog" ( I know its possible with colors.merge ), this would change everything, and ou would feel somehwere in a room…. ( to be honset I dont know if I explained this well… welp here goes nothing. )
Creator #17
Posted 16 June 2015 - 08:05 PM
Well, I was talking about basic 3d