How to make a 3D render system

Oh, I already asked for a 360 degree rotaion of props, but josh said no that that wouldn’t be added beacuse it would take away the 2D from 2D. So you can’t make it have all the faces of a 3D prop, at least not any time soon.

1 Like

I don’t think you quite understand what he’s trying to achieve. Think about how a cube has 12 edges. Each of those edges is a line. Every line has its own formula that makes it up. He wants to create a program that lets him develop an entire game using these formulas. It’s difficult, because the only real tool we have are the logic blocks. Do you understand?

1 Like

Adding onto what cheese is saying, he’s not talking about built-in 3d. When someone says they want to make something, it doesn’t have to be in the base game. Gimkit is Turing complete, as Blackhole has already proven.

You said the same thing about the save file and you were completely wrong. Try not to be so quick to assume that–just because you don’t know how to do something–you can’t do it.

Wend0ver, first of all, you should ask bh. You know where to find him. Second of all, how much linear algebra do you know right now? Do you have any idea how to create 3d things in the first place?

1 Like

had to research quite a bit for this and i don’t usually work with 3 dimensions so take this with a grain of salt. this is just a basic explanation, if you wanted to add more complex stuff you’d have to mess around a bit lol.

so for the math stuff, you’d need a few matrices like a projection matrix which turns your 3d coordinates into 2d coordinates which are also affected by things like fov which would look similar to this (basic example)

(Orthographic) Projection Matrix -

note: since this is an orthographic projection, it doesn’t have perspective which is good for isometric rendering but can be a detriment to other styles

⸢ 2/(nr - lr), 0,                 0,              -(lr + nr) / (nr - lr)
  0,           2/(tp - bt),       0,              -(tp + bt) / (tp - bt)
  0,           0,                -2/(far - near), -(far + near) / (far - near)
  0,           0,                 0,               1                          ⸥

i’ll say how to apply this at the end and how it works since its one of the last things you apply.

(nr = near right, lr = left right, tp = top, bt = bottom, these variables essentially define the sides

near and far are the farthest points in your projections, so anything outside wont be visible when you project, things closer than your near wont be visible and things farther than your far wont be visible)

the other type matrices you’ll need are transformation matrices which well… transform, i’ll talk about how to translate, rotate, and scale, and obviously, with your system you’ll need to combine these in a series.

Translation Matrix -

⸢ 1, 0, 0, Tx
  0, 1, 0, Ty
  0, 0, 1, Tz
  0, 0, 0, 1 ⸥

Tx, Ty, and Tz are the amounts you translate by. lets say you have a point in homogeneous coordinates, [X0, Y0, Z0, 1] (1 as the scale factor), when you multiply that point by the matrix, the values Tx, Ty, and Tz will be added to X0, Y0, and Z0 which results in the coordinates being moved due to the nature of matrix multiplication.

Rotation Matrix -

⸢ cos(θ), -sin(θ), 0, 0
  sin(θ),  cos(θ), 0, 0
      0,       0,  1, 0
      0,       0,  0, 1 ⸥

theta represents how much you rotate by. this also rotates around the z-axis. since cosine represents the x-coordinate in the unit circle and sine represents the y-coordinate when you multiply your coordinate [X0, Y0, Z0, 1] and the rotation matrix, it combines them to make it look like something is rotating around the z-axis.

Scale Matrix -

⸢ Sx, 0,  0,  0
  0,  Sy, 0,  0
  0,  0,  Sz, 0
  0,  0,  0,  1 ⸥

Sx is the x-coordinate scaling factor, Sy is the y-coordinate scaling factor, and Sz is the z-coordinate scaling factor. This is kinda self-explanatory but when you multiply these, it scales the [X0, Y0, Z0, 1] coordinate in each respective axis.

Projection Matrix Again -

the matrix from the start flattens out the z dimension, and since its orthographic, it doesn’t account for perspective like farther objects are smaller (which can be good for isometric-styled games) but if you want your render system styled in a different way, you can find another way for projection. when you multiply the matrix and the ykw coordinate, you can keep the x and y values and then you can use the z value for depth calculations or ignore it.

ik i didn’t explain this very well so u can ask me if u have a question and ill try to answer it


if you want help actually implementing this you should probably ask blackhole like shdwy said


Ain’t no way u didn’t use ChatGPT to make that post. Anyway thx, I just need a matrix to shift the 3d points to 2d. Thx for the post it’s rly detailed

1 Like

I’m going to stay on this post and do some testing.

1 Like

Didn’t Cavaire 3d try to do it? Or am I mistaken?

1 Like

Maybe he tried to do it, but I don’t think he finished it.

1 Like

He’s still working on it.

I’ve tried to make one, but I really couldn’t get the concept of size when accounting for distance away, actual size of the thing, and the orientation of the object. So I tried to make a 2D renderer instead. It’s an ongoing project. You’d have to look into that to figure out 3D rendering.

What orientation of the second degree?

epic linear algebra moment, 10 stars

1 Like

Welcome to this funny place called the forums wendover! There was a Griffpatch tutorial on Scratch about 3D rendering, and how it basically worked was that it drew lines on the screen every tick, and it used raycasting. The farther the raycast projectile went, the shorter the wall that it hit will look like. Now, I’m not sure if raycasting happening within 1 tick is possible on Gimkit, but this helps, I guess.

would now be a good time to mention i made a 3d wireframe system a while ago (january or so), although I never got rotation working on it?

also that was my old secret project, I’ve found a new cooler one so i’m revealing this now lol


Anyway, the method I used was pretty simple.

I wrote some code for converting 3D points into 2D with the following equation:
(X, Y) = (X * 200/Z, Y * 200/Z)

Then, I implemented bresenham’s line drawing algorithm, to take two points and draw a line on a display between them.

Finally, I wrote code to take an X, Y, Z, and Side Length value set and turn it into the points of each corner of the cube, centered at the origin. I translated the cube to where it was supposed to be, then I turned each 3D point into a 2D point, and plugged pairs of points into bresenhams line drawing algorithm to render the cube.

The cube was moveable on the X, Y, and Z axis, by simply changing the coordinates plugged into the whole system and re-rendering.

The equations for rotating the 3D points I never quite figured out, trig is my weak point :(. But if you were to implement them, you would rotate the points before translating them to their xyz position in the world.

So uh yeah. 3D. That’s how. I have no clue what you all were going on about with linear algebra and whatnot.


coordinates are represented as vectors and to move these coordinates, you’d have to apply a linear transformation on them which is practically what you did without stating they were vectors

dang. thats pretty amazing, ngl. i’m honestly impressed that you managed to create a full 3d wireframe system just by yourself, that’s actually rly cool! and it’s fine that u still haven’t figured out the equations for rotating the 3d points; im sure u’ll figure it out eventually! and it’s great that u were able to find a new and more interesting secret project to focus on:)

I mean, this is a bunch of stuff of 3D builds, maybe this can help.

No they can’t. That’s a completely different thing.