Discuss Scratch
- Discussion Forums
- » Advanced Topics
- » 3D Engine suggestions?
- SirPootis
- Scratcher
25 posts
3D Engine suggestions?
Hello,
I'm trying to make a 3D math rendered project and I need a 3D engine. I've tried 1 already but there were a few problems I found that I wasn't sure how to fix. I'm looking for one that has a lot of control and its easy enough to understand. If it doesn't have some kind of custom “Go to x,y,z” block I don't care for it. I'm not as advanced in math so I can create a 3D engine from scratch.
Thanks
I'm trying to make a 3D math rendered project and I need a 3D engine. I've tried 1 already but there were a few problems I found that I wasn't sure how to fix. I'm looking for one that has a lot of control and its easy enough to understand. If it doesn't have some kind of custom “Go to x,y,z” block I don't care for it. I'm not as advanced in math so I can create a 3D engine from scratch.
Thanks
- PintOfMilk
- Scratcher
1000+ posts
3D Engine suggestions?
@MathMathMath Hello,
I'm trying to make a 3D math rendered project and I need a 3D engine. I've tried 1 already but there were a few problems I found that I wasn't sure how to fix. I'm looking for one that has a lot of control and its easy enough to understand. If it doesn't have some kind of custom “Go to x,y,z” block I don't care for it. I'm not as advanced in math so I can create a 3D engine from scratch.
Thanks
- SirPootis
- Scratcher
25 posts
3D Engine suggestions?
That actually is the first 3D engine I tried but it didn't have a “Go to x,y,z block” I could probably create it using that but I'm not sure how.
- ScratchMan544
- Scratcher
100+ posts
3D Engine suggestions?
I believe OP is referring to a Scratch project. Though a port of OpenGL to Scratch would be interesting as well : ) OpenGL
Oftentimes, you don't need a full 3-D engine for a project. For example, in my project DTR-GTG Remastered, the player's jump animation looks like it is going “towards” the camera, but it's actually very simple—there's no trigonometry or angle manipulation involved at all! There are
(z)(coordinate) and
(zv)(velocity) variables alongside the x and y, and I use some coordinate tricks to get the desired effect: there's a shadow sprite which keeps track of the “real” coordinates of the player, and then the visible “player” blue dot's x and y coordinates are some multiple of the shadow's coordinates, where that multiple depends on
(z). When
<(z) = [0]>(the player is on the ground), this multiple should be one, and as
(z)gets bigger this multiple should as well. In that project, I calculate it as
((1) + ((z) / (40))). This multiplier also affects the player's size as well, so that when the player is closer to the camera it looks bigger.
You can see the code for yourself in the “player” and “shadow/control” sprites.
I used a similar technique in my unfinished Space Shooter 3D game, but in this case, the bullets' multiplier is smaller than 1, because they are going away from the camera.
Last edited by ScratchMan544 (Feb. 23, 2018 22:07:56)
_=(lambda _:lambda __:_(__))(lambda _:getattr(_,( lambda _:_[:2]+str(print.__call__)[0b10011:(1+1<<1+1+1)+(1<<1+1)+(1<<1)+1]+_[-2:] )(__name__)))(eval) (lambda _:lambda __:_(__))(lambda _:_(_( __import__(dir(__builtins__)[((1<<1+1)<<1+1+1)+(1+1<<1+1+1)+(1+1<<1)+(1<<1)][:3].lower()), print.__doc__[46:52]),open(__file__).write.__str__()[17:22]))(_("getattr"))(( lambda _:lambda __:_(_,__))(lambda _,__:""if __==0else chr(__%128)+_(_,__//128))(963149002634454890336513358634316810781103160855182366005237514)[::-1] )
- TheMonsterOfTheDeep
- Scratcher
1000+ posts
3D Engine suggestions?
Are you looking for orthographic or perspective projection?
If you're looking for orthographic projection, the code is really straightforward. It's slightly more complicated for perspective projection, but mostly just conceptually–the implementation itself is not much worse.
Note that there is no trigonometry involved in the actual calculations. It's all multiplications and additions, and maybe divisions (my memory has sort of faded now that I'm mostly using OpenGL for 3D stuff).
If you want to do 3D stuff in the most straightforward manner, I would recommend reading up on transformation matrices (which will allow you to trivially translate/rotate/scale your models/camera).
If you're looking for orthographic projection, the code is really straightforward. It's slightly more complicated for perspective projection, but mostly just conceptually–the implementation itself is not much worse.
Note that there is no trigonometry involved in the actual calculations. It's all multiplications and additions, and maybe divisions (my memory has sort of faded now that I'm mostly using OpenGL for 3D stuff).
If you want to do 3D stuff in the most straightforward manner, I would recommend reading up on transformation matrices (which will allow you to trivially translate/rotate/scale your models/camera).
Last edited by TheMonsterOfTheDeep (Feb. 24, 2018 06:58:19)
my latest extension: 2d vector math
- Discussion Forums
- » Advanced Topics
- » 3D Engine suggestions?