CanvasDraw - A powerful pixel-based graphics engine (Draw pixels, lines, triangles, read image data, and much more!)

Ok, thanks for telling me! It now works.

This game engine is awesome! Look what I made with it easily:


Can’t wait to make more with this.

5 Likes

How do i make the background transparent

I wonder if it’s possible to make half life in this(something similar)

1 Like

I mean I can work with 1024x1024 but it kinda would be cool to be able to scale to 720p or 1080p for stuff like game engines

Once roblox lifts the res limit of images, or someone contributes to the module by expanding the resolution through multiple EditableImages, I will be sure to add it!

Even though in my opion 1024x1024 is plenty big enough of a resolution for custom engines, it would still be cool to have 4k as an option.

Alright oh hey btw about the module I have autoupdate on and I’m using runservice to draw a triangle which causes lag what is the correct way to update that triangle each frame?

Canvas:Clear() is laggy with a 1024x1024 canvas

interesting to note is that canvas.new with the color 0,0,1 and then doing canvas.clear sets the color to 0,1,0

Wait really? That’s odd… canvas:clear should be the same colour as given background colour for the canvas.

1024x1024 is an incredibly high resolution for drawing of shapes and clearing in real-time. It’s very expensive for lua and your cpu to handle.

Try lowering the resolution until you’re not experiencing lag.

Most of my game engines are like 320x240 or 200x200. Usually never anywhere near 1024x1024

Is there anyway to optimize this what about checking if the pixel is not the same color as the background

Screenshot from 2024-02-06 18-44-47
Found the issue

Local R,G,B should be Colour.R,Colour.G,Colour.B

wait is that in my module? if so, thanks for pointing it out, ill be sure to fix it

Alr your welcome I might try getting :Clear() to be smooth

Screenshot from 2024-02-07 00-02-49
I’m right now coding a 3d game engine I’m using functions for meshes that contain dictionaries
Screenshot from 2024-02-07 00-04-43
Is using functions instead of types good?
Idk anything about c++ I’m just converting what I see to lua and also looking at the c++ manual a bit to see what a certain function does

While I was working with EditableImages, I noticed that creating too many Vector3, Vector2, or tables caused lag. So when I saw Vector2 being used in some of the function arguments, I had to tell you about it! It would be preferable if these were split into two numbers only, without using a container like {x, y}.

I basically never use those constructors in loops. I do keep them on outside of loops and keep them in some parameters as it makes coding simpler and less cluttered.

CanavsDraw 3.0 on the other hand, had this problem, since we didn’t have editable image which can take raw RGB values

Hey, I wanted to create a raycaster with a canvas module using triangles, but I don’t understand how I can get these points from an object (Roblox part)? Any script example or explanation about this?

You could try to get the size of the part and, from the position (which is the center), calculate the corners using half the size in each direction of x, y, and z. Something like this:

local Part = workspace.Part
local Corners = {
	Vector3.new(Part.Position.X + (Part.Size.X / 2), Part.Position.Y + (Part.Size.Y / 2), 0) -- Top Left Corner
}
1 Like