The Crystal Programming Language Forum

3D Rendering Engine (game engine)

I’ve been developing a 3D rendering engine Prism for some time now and would like to solicit some feedback from the community. The engine is functional with some basic defaults so you can quickly replicate the demo.

What this is/is not

A quick note about terminology. I’m officially calling this a 3D rendering engine, and not a game engine because I see more value in creating a solid platform for 3D development. This can be used to create games, but I don’t plan to turn Prism into a full featured game engine with sounds, physics, etc. What I hope will happen is other people in the community will use Prism to build game engines, desktop UI tool-kits, etc. I think so much more can be accomplished long term if Prism focuses on being really good at just rendering 3D so that others can use it’s tools. Ok that wasn’t so quick…

What I’m trying to accomplish with this post

I’d like to find out what people’s initial thoughts/questions/concerns are so I know how to better plan and approach documentation, api design, and features.
And it would be great if I could find some people to help build this into something amazing!

So please check out https://github.com/neutrinog/prism and let me know what you think. :slightly_smiling_face:

16 Likes

I just made a lot of updates to the engine. I’ve been picking through another 3D game engine tutorial and was able to fix a lot of bugs and add some more features. As a result the example app looks much more interesting.

I’m still not happy with how lighting is working. I’m trying to figure out a good paradigm that’s both flexible and simple.

I’ve decided to go back on my decision to make this “not a game engine” because I’m following tutorials for building a game engine, and it will be so much easier if I stay on that track.
Later, once this is mature enough, I’ll think about splitting it into a generic rendering engine and a game engine.

15 Likes

I tried different OpenGL crystal bindings to do sphere tracing using the GPU, but could not find any stable lib. Which OpenGL bindings do you use for your game engine ?

I use https://github.com/calebuharrison/LibGL. So far it’s worked pretty well. I only had to contribute a hand full of bindings to it.

Just published another version of the engine. You can read about the release here https://github.com/neutrinog/prism/releases/tag/v0.7.0. If you’ve had to wire up shaders to your code before I think you’ll like it. I’ve managed to abstract 99% of the busy work out of the way.

I’m taking a few days off from crystal to clear my head a little before starting on the next task. I was going to work on either using an existing entity-component-system libary or implement one myself. First however, I think I’m going to focus on cleaning up the rendering engine so you can add custom shaders to the renderer without having to hack the core. And add multiple light support back so the example doesn’t look bland.

4 Likes

I avoided the code for a few days to think about how I wanted to implement an entity framework, and I’m pleased with the results. The most recent release now has a slick entity-component-system framework at it’s heart. https://github.com/neutrinog/prism/releases/tag/v0.8.0.

Among other things, this finally opens up the core rendering logic so you can customize everything if you wanted to. It may not be the easiest just yet, but this was a HUGE step towards extensibility.

With that mostly out of the way I’ll be focusing on tidying up the entity framework, and getting back into the visuals.

4 Likes

Just showing off the current rendering performance.
I’m getting 60fps with 1000 randomly generated cubes plus the landscape. Later on things far away or out of view won’t be rendered, which will further improve performance.

Notice the frame rate in the bottom right corner. the gif was recorded at 10fps to keep the file small.
Peek 2020-04-28 22-19

11 Likes

This is all kinds of cool. You are updating this thing faster than I can even play around with it :slight_smile:

Great work!

2 Likes

This looks beautiful dude! Well done!

2 Likes

Made some more visual improvements in addition to refactoring a TON of the code. I’m working hard to get the API just right so it’s fun to use and not frustratingly convoluted.

Most recently I’ve been reworking the camera and adding in some built in view modes. The default is first person, and the third person view is almost finished. Here’s a demo of the third person view. It supports zooming onto whatever the camera is attached to, rotating around, and changing the camera tilt.

The new camera controls aren’t released yet. Still need to work out some bugs.

Peek 2020-05-02 20-22

6 Likes

I don’t know anything about 3d engines or anything, but this looks incredible! Nice work. So cool to see the kinds of things people are doing with Crystal

2 Likes

This is amazing! I love playing with 3D engines. I can’t wait to build something with this too :smile:

1 Like

Now to create a voxel world :wink:

1 Like

Easy! With voxels :laughing:
My first experience with voxels was in late 80’s, early 90’s it was lot of fun.

I definitely had to look that up. Lol.

I wasn’t able to get this to work on arch for whatever reason. Seems like sdl3 is having a hard time finding the intel iris driver (I don’t have a dedicated GPU). Still, very well done :)

Yeah, I’ve only been using this on popos.
Later on I’ll probably add a few different os’s to the unit tests. Including one day (I’m hoping) windows.

Right now the API is so volatile, it’s not worth the time. However, I’m hoping to stabilize the api in a month or two.

1 Like

Published another release. This time I decided to create a video to demo some of the main things. You can see it on YouTube https://youtu.be/22hVTIDaIrM.

I’m thinking of continuing making videos for each release. Sort of like a release blog. I’m hoping it will generate some more feedback, or just be a fun way for people to see what’s new without having to compile something.

I’ll probably slow down posting things in this forum post just to reduce noise. So if you want to stay up to date you can follow the new playlist I created on YouTube. https://www.youtube.com/playlist?list=PLf7IRQ2kP73lJp1wP-b0yszws8GLa_cR4

9 Likes

I don’t consider this noise. This is super interesting work you’re doing and by all means keep sharing if you’re willing!

3 Likes

Indeed! They are interesting. Looking at the gigs first, and trying it on my computer (a Mac) I thought it was running really slowly. But in the YouTube video you can see it runs smoothly. I tried using the mouse and the usual arrows or wasd keys tyi move the camera but it was still not working well, so maybe I’m doing something wrong.