A 3D Engine in Roblox

Since this is getting a lot of attention, I’ve updated the github repository with new fixes and modules to play with! Release 3D Engine v2.0 · OrangeCash090/Roblox-3D-Engine (github.com)

5 Likes

The things you are running with your module can run a lot faster if you do them more explicitly without using method calls, they’d easily run 60 fps at 200x200. I could help with that if you really wanna make that happen.

2 Likes

By the way I’ve already been testing with DynamicImage but it recently stopped working for me, did you have any issues with it?

2 Likes

Are you on the LIVE channel in studio? They removed it from zintegration and I had to switch to LIVE as well.

4 Likes

Well, if i didn’t use method calls, nothing would be rendering at all, and CanvasDraw uses UIGradients + compression which has a lot of math functions doing work per pixel and to create the strips of UIGradient data.

But with DynamicImage, it seems like it should be much faster anyways.

Also my projects actually do run well above 60 FPS at 200x200 or even 300x300 internally without drawing the pixels. It’s just the custom roblox canvas is the bottleneck and brings that down to an alternating framerate of around 40-60 at 100x100 depending on the scene and the colour density

2 Likes

Oh you misunderstood, I was talking about more specifically using the method calls of your Canvas object.

3 Likes

ah, that makes more sense. Yeah, I was dissapointed when I found out my fast UIGradient canvas was still impacting about 70% of the performance on my projects.

I have been developing CanvasDraw for almost 2 years now, and it’s gotten to the point where I physically don’t think I could get it running any faster.

I am proud of what I have made, but man roblox finally adding the DynamicImage class is just over-powered.

Also how are you guys experimenting with DynamicImage? It’s disabled in studio, im assuming that’s what this LIVE program is?

3 Likes

LIVE is a development channel that has beta features in roblox studio. You can use a program like Roblox Studio Mod Manager to switch channels and get these features. You do have to set some FFlags first to get DynamicImage working. The flag you need to edit is DynamicImageEnabled, which should be set to true.

4 Likes

You can use the Roblox Studio Mod Manager to change some fflags and get access to it.

I really wish Roblox added a new method to DynamicImage which lets me update specific pixels instead of updating the whole thing using WritePixels, it’d really be a lot better since most of the time you just have a black background that doesn’t even need coloring.

2 Likes

Yeah. I did notice the :DrawLine and :DrawCircle methods, so i don’t understand why there isn’t a :DrawPixel method yet.

But who knows, maybe they are working on adding a method like that

2 Likes

no more like a function that takes PixelIndexes and PixelColors and bulk updates all of them, a DrawPixel function would kinda just be a waste if you’d have a method like I described here.

3 Likes

Ohh i see.

Yeah that would probably be better in practice tbh.

2 Likes

That is multithreading! Instead if doing Heartbeat:Connect() for updating the Engine3D you’d do Heartbeat:ConnectParallel and it would run the script in a separate thread instead of the main thread.

You’d first need to put the entire localscript (or whatever updates the Engine3D via RunService) inside of an Actor Instance to be able to use ConnectParallel. The only function right now that can’t be multithreaded is the WritePixels function (and some more that would be deemed “unsafe” via error output) so you’d need to synchronize it to the main thread then going back to multithreading

task.synchronize() 
dynamic:WritePixels()
task.desynchronize()

Tada! Multithreading 101

4 Likes

That’s all you have to do? Just desync the update function and sync the function with writepixels? This works amazingly and there’s a very noticeable improvement! I can’t believe I haven’t been using this before.

4 Likes

Hell yeah! You should definitely look into using desyncing more for mathematical functions as they give a noticeable improvement.

5 Likes

I was trying to do this myself but I couldn’t. Could it be possible to add support to the player’s current screen size rather than a square?

I spent hours trying to add support for it but to no avail. What’s your stance on it? :pleading_face:

2 Likes

You mean change the DynamicImage size? If you know your screensize you can just set it here in the third value of the Engine3D.new function. If you don’t then just grab the frame’s absolute size and floor it. (This is using the 2.0 release)

local World = Engine3D.new(script.Parent.Parent.Screen, Camera, Vector2.new(512, 340), 70, 1000, false)
3 Likes

AWESOME! This makes it incredibly viable to make a fully fledged game with a ‘custom’ shader. I’m excited to see how far this can be pushed more! :,D

3 Likes

BTW. Have you considered making it so that we focus more on using the Roblox Engine to do all of the collision and CFrame work for us? that way we can primarily focus on the rendering aspect of the plugin

EG: (this is using v1)

2 Likes

Well, I mean you could just do that by making a lot of cubes in the engine from Roblox’s engine, but the reason I made this was to just have a bit of fun with a custom engine and to also get experience with the challenges that are faced. Things like custom projection, textures, physics are pretty cool. You can do whatever you want with it, it works either way!

4 Likes