3D Rendering Discussion

Orthographic rendering should be pretty simple, you just plot a point (or many points) and just get rid of the Z value.

3 Likes

How do I make 3D that renders efficiently? Like, least-amount-of-lag efficient? Also, is it possible to make it render at 60fps every frame?

4 Likes

That’s some suuuuper complicated maths, I have no clue how that works. And I don’t think any polygon 3D things will hit 60fps from a first person view, it’s just too many objects running so many calculations.

2 Likes

Well, if THT release the deobfuscated HS code at any point, we can gain some insight into what makes HS tick and how to optimize our code in the right way to make it smooth 60fps.

3 Likes

It really depends on how many objects you have, like this pyramid looking thing (see link below) runs quite smoothly.

https://c.gethopscotch.com/p/1155iheww9

4 Likes

Good idea, why don’t you ask?

Perhaps it’ll make the code of blocks, like for example In string, replace something with something, when it is added, easier to understand, since “e” is not a very good name for parameters.

2 Likes

Annnnnd no new messages :confused:

3 Likes

Anything I can answer?

2 Likes

nope, apparently not :/

1 Like

Could someone assist me in filling in my cube 3d rendering? Thanks

2 Likes

What’s that?

1 Like

I can probably help you with that. The general idea is to stretch a triangle over 3 points of your cube using width, height, and rotation. You already have the points, so all that’s left is to stretch a triangle over them.
*there might be an easier way and I’m just doing everything the hard way

Here’s how I did it:
Step 1: Calculate the sides of the triangle
Step 2: Calculate the height of the triangle using Heron’s formula
Step 3: Find the longest side of the triangle
Step 4: Figure out whether or not the height is positive or negative
Step 5: Figure out wether or not the width is positive or negative
Step 6: Here’s the tricky part, using your knowledge of the longest side, you need to rearrange the point the calculations are based off of. So, you essentially have 2 sets of points. One of them, is the original, and the second set is the original, but the points are scrambled a bit depending on which side is longest. For example, if side 3 is longest, the points stay the same. If side 2 is longest, the first point of the triangle will connect to the second point, the second point of the triangle will connect to the first point, and the third point stays the same. (side note: the only calculations based off of the original points are the longest side ones)
Step 7: Pretty simple, calculate the angle of the triangle using arctan.

8 Likes

why can’t you just use a square for a cube?

1 Like

if you look at https://c.gethopscotch.com/p/117uaqvued
you can see that the sides of the rectangle bend all over the place

3 Likes

I found a simpler way using triangles. I just published v2.1 (https://c.gethopscotch.com/p/118cautgry) and the only problem now is it doesn’t rotate 360°. If you (or anyone) knows a fix this issue, that would be great

1 Like

That’s pretty good! (might want to fix the clone index).

3 Likes

Thanks! What do you mean?

1 Like

Oops, I meant Z index, the sides are stacking a bit oddly. Like how you can always see the white side.

3 Likes

Yeah, that’s what the problem is right now. Any idea on how to fix that?

1 Like

You can probably use the last touch X and last touch Y to figure it out? I’m not too sure

3 Likes