How to make a 3D render system

are you planning on just having shapes be outlined rather than filled in?

2 Likes

For my non gimkit thing I can render image files in 3d. I just need a matrix to shift the points eith

2 Likes

Gimkit can’t use custom images.

2 Likes

I’m talking if about a different thing

But for gimkit I would need to use emojis to render images

2 Likes

Yes, these:


2 Likes

I was thinking just the colored emoji, so I can get multicolor images rendering. The question is how to translate the 3d pos to the 2d pos in the text drvicr

2 Likes

You can recolor the squares to be any color.

2 Likes

But then there all one color

2 Likes

Ok, but it’ll look a lot blockier and less clean. Also, do you plan on figuring out how to render lines in 3d before jumping straight into images?

2 Likes

But what is the matrix to shift the points to 2d

2 Likes

You need to write a formula to graph out each individual line.

2 Likes

What do you mean shift it to 2D? Gimkit is standardly in 2D.

2 Likes

He means to put 3d objects into 2d, i think.

1 Like

Well thats simple, just add a shadow, look at a chair prop its 3D beacuse it has legs that are technically shadows, you just need to add a face to the side, bottom, or top. And it will look 3D but 2D at the same time.

1 Like

He means literally 3D, as in having an X, Y, and Z plane, and having values for each, like creating a cube you can rotate. He wants to develop a Third plane.

1 Like

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

9 Likes

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

2 Likes