Ive made a 3d engine before. Im calculus level. Like I said, I made a 3d engine in scratch. Sorry, I meant scratch mod. But all I added was arrays and a polygon pen.Nnot a good 3d engine, because I stopped. It has no specified textures. there was no need for painters algorithm because there is one color. and one object. Point is it loads 3d in a plane you can run around in and jump. Im no newbie.UnixRoot wrote: ↑Fri Jun 21, 2024 5:56 am Nice idea. He could later also write a software renderer to learn how a 3D engine works.
Write an Obj parser, the file format is human readable and pretty easy to understand and to parse. Write a vec3 and a mat4 lib to transform your vertices. This way you learn about the math behind all the 3D transformations needed.
Write a framebuffer and a depth buffer with the help of imageData and byteData objects and FFI pointers to the data. Write a backface culling, a occlusion culling and a frustum culling function.
Write a triangle rasterizer that can fill your polygons. Add perspective correct texture mapping. Try to handle all the edge cases.
I did the same thing some weeks ago, and it's completely possible in Love2D. Even with good performance. I'm not a big fan of 3rd party libs. I try to learn from them but always code my own stuff to get better.
speed
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 30
- Joined: Mon May 13, 2024 4:05 pm
Re: speed
-
- Prole
- Posts: 30
- Joined: Mon May 13, 2024 4:05 pm
Re: speed
I dont see why not.RNavega wrote: ↑Fri Jun 21, 2024 3:21 am You want to make a 3D engine?
In order to do that, you need to know what makes a good 3D engine. The only way to investigate that is by trying someone else's engine and taking notes of the things you like and dislike about it.
So to expand on what UnixRoot said above with "Try simple things first", I want to give you a challenge:
1) Download Groverburger's G3D engine for LÖVE: https://github.com/groverburger/g3d
2) Run one example, tweak the parameters and things a bit to get a feel for it.
3) After that, using that same engine, start a new project to implement a Pong 3D game. The game looks like this and is very simple:
images.jpg
It's just two boxes for paddles (yours and the CPU's), one sphere as the ball and 4 boxes forming the corridor that's the playing field.
After you finish this challenge then you can confidently begin working on your own 3D engine.
-
- Prole
- Posts: 30
- Joined: Mon May 13, 2024 4:05 pm
Re: speed
Making my own programing laugauge? No that wont be hard, just a bit long. Why would you say that?UnixRoot wrote: ↑Thu Jun 20, 2024 7:26 amAnd how do you imagine writing your own programming language? It's much more difficult than reading the Love2D documentation or understanding the concept of a depth buffer.1Minus2P1Stringer2 wrote: ↑Wed Jun 19, 2024 1:50 am Im really really avoidant of making my own language, but i may have to.
Just read the Love2D documentation. The logic of programming is actually always the same, regardless of whether you use tools like Scratch or Construct or a real language.
I had no clue of LUA or any other languages when I started using Love2D. I just read the documentation and tried things out, or tried to port existing code to Love2D to understand how everything works.
Try simple things first and don't start with a 3D engine.
Re: speed
It is much more difficult, @UnixRoot is right. In what (existing) language are you going to write it, anyway?
My boat driving game demo: https://dusoft.itch.io/captain-bradley- ... itius-demo
-
- Prole
- Posts: 30
- Joined: Mon May 13, 2024 4:05 pm
Re: speed
Not if the language you were using was confusing you. Which, right now, lua is kinda confusing me. Love2d is fine, but lua's framework confuses me. like how does lua render slower then scratch? Scratch can render an image from an image scanner in 3 seconds. Why is lua rendering at 2 minutes per frame, at real time? I get love2d has a function to load multiple pixels at once, which speeds it up by alot but still?
Re: speed
I'm positive if it's taking your program 2 minutes to render a frame that it's your code at fault. I suspect the issue is you're applying scratch idioms to a lua program. If you have any more problems with your code we can definitely help you understand how to fix them if you show us.
As others have said, you're seriously underestimating the complexity of making your own language. I wouldn't discourage someone from learning how to do that, it's definitely worthwhile, but you're not going to make something better than what's already out there with no experience in that field, especially if you're easily confused by trivial parts of the existing ones.
As others have said, you're seriously underestimating the complexity of making your own language. I wouldn't discourage someone from learning how to do that, it's definitely worthwhile, but you're not going to make something better than what's already out there with no experience in that field, especially if you're easily confused by trivial parts of the existing ones.
Re: speed
Graphically speaking, Love2D could be defined as a fancy wrapper around OpenGL using Lua. The important takeaway of that definition is that if you use Löve, you have to play by the rules of using the GPU. In particular, if you're rendering pixel by pixel and not using either ImageData:mapPixel or ImageData:getFFIPointer to draw the pixels, and (Image):replacePixels to put these pixels into an intermediate Image object to draw to the screen, then you're doing it wrong, in the sense that you can't expect the speed to be reasonable. See for example this thread for someone using FFI to draw into a framebuffer at over 60 FPS.
Of course, the fact that Löve uses OpenGL under the hood means that it's capable of using GPU acceleration, meaning you don't need to bother writing a full 3D engine, at least not the rendering part. I understand it can be fun to do that, but you won't get the full advantage of GPU acceleration, and even if it's written in assembly, bandwidth issues will prevent it from working fast enough for anything complex (CPUs can't draw nearly as many triangles per frame as GPUs), not to mention you would lose one of the salient point of using Löve: cross-platform compatibility.
Of course, the fact that Löve uses OpenGL under the hood means that it's capable of using GPU acceleration, meaning you don't need to bother writing a full 3D engine, at least not the rendering part. I understand it can be fun to do that, but you won't get the full advantage of GPU acceleration, and even if it's written in assembly, bandwidth issues will prevent it from working fast enough for anything complex (CPUs can't draw nearly as many triangles per frame as GPUs), not to mention you would lose one of the salient point of using Löve: cross-platform compatibility.
Re: speed
I don't know what you're doing wrong. I can easily render a world, consisting of multiple 4096x4096 height maps with raw 32 bit floating point data and textures of the same resolution on top. Even on my Potato PC, I get hundreds or even thousand of FPS in my CPU based software renderer. Love2D is FAST, if you optimize your code.1Minus2P1Stringer2 wrote: ↑Sat Jun 22, 2024 11:07 pmNot if the language you were using was confusing you. Which, right now, lua is kinda confusing me. Love2d is fine, but lua's framework confuses me. like how does lua render slower then scratch? Scratch can render an image from an image scanner in 3 seconds. Why is lua rendering at 2 minutes per frame, at real time? I get love2d has a function to load multiple pixels at once, which speeds it up by alot but still?
Edit:
Even with thousands of sprites, checked against a depth buffer, the performace is great. Note, thats an old shot with pretty unoptimized code. It's around two times faster by now. As is said before, thats without using GPU features. It would be even faster with GPU.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 8 guests