Best way to handle 3D painting

Hello!

Recently, I’ve been working on a 3D drawing game that is contained in a relativly small area and that requires constantly moving the paint around (follows the player).

Currently, the biggest issue is the maximum amount of paint before the game would start to lag. The current limit is ~9500 - 10000 using ImageHandleAddornees. This may be enough but just to be sure (as the paint will UV wrap around the player) and allow lower end devices to run smoothly I wanted to find a more efficient way that allows more paint with less lag.

So far I’ve tried a lot of solutions:

  • Textures: Too Laggy (~300)

  • Beams: Too Laggy (~300)

  • Particles: Laggy + Render Limit (~500 - 1000)

  • Flat Meshes: OK (~6000 Static)

  • Image Addornees: Current (~9500 - 10000)

  • Skinned Mesh: Great (~17500 Triangle) *Unable to edit individual properties

Currently the best solution is the skinned mesh but it is impossible to change the color of individual triangles. So would anybody know anything better or a way to individually modify the triangles?

Thanks!

1 Like

couldn’t you use multiple skinned meshes for different colours? perhaps you could use one skinned mesh for each colour (if thats possible - i’ve never used skinned meshes before), or create a new mesh each time you change a colour (which would have some performance impact but hopefully less impact than the other options you’ve tried).

Can you post a screenshot to give a better idea of what you’re making?

Essentially, we have a drawing system that allows you to draw on the player. Currently, it uses addornees which aren’t that laggy but they still limit us to ~1050 per player until it starts to lag and so even with optimizations I’m not sure if this amount will be enough. So currently, I’m trying to find an alternative that allows us to have more paint per player whiteout laggying the game out.

RobloxScreenShot20221231_102403000

You could make a more complex system that uses fewer adornees. For example by using short line segments instead of dots, that way straight-ish lines can be made with just one part instead of 10-20, and curves can be made with just a few lines.

Yeah that was what I meant by optimisations. But I’m still unsure if it would be enough as the paint size will be smaller than what is in the picture.

Do you have some number in mind for how many parts you want to allow?

Well the limit before starting to loose fps is ~9500 - 10000. If there are 10 players per server that allows each player to have 950 parts. Or if we don’t allow the player to see paint that is on him (the game is in first person) that allows 1055 parts per player.

Yeah that’s a good idea.

You could also load and unload paint for each player depending on how far away they are. You’d still get FPS drops if all players meet at the same place, so it might not work at all if players are always close to each other in your specific case.

Another idea is to prevent overlapping “pixels”. E.g. every time you try painting a pixel at the mouse coords, round those coords to nearest 0.1 or w/e and use a 3D map to check if there’s already a pixel there. If there is, overwrite the old pixel with a new color. If we model the character model as a 3x3x3 box, that would make a (3/0.1 = 30)^3 box which has a surface area of 5400 (0.1 studs)^3. Real characters have curvature so you’d probably need 2 or 3 times as much to cover the entire character using such a system (I’m guessing). 0.1 is kinda small, you might be happy with even larger pixels.

EDIT: Okay they’re more like voxels

Yeah I was thinking about removing overlapping pixel but by using a different way. Essentially if a color is fully recovered (pixel) it would get removed and if there are a lot of small details in an area it would try to remake it using less parts but still trying to make it look similar. And for the player issue, I was thinking of doing the same thing as LOD meshes. Essentially if the player is far away it reduces the quality but it also does that if there are too many parts in a smaller area.

That would be easy to do if you used a voxel approach like I described, at least for integer scaling (2x, 3x, etc.), just sample every 2nd (or 3rd, etc.) coordinate and make each voxel correspondingly larger.

How would you detect overlapping pixels?

We are going to be using a UV map as a base to place the paint which will make it quite easy to detect overlapping paint.

1 Like

I’ve actually found a way better solution. Using unions. While you draw, it will be adornees but when you finish it will become unions. Those a way more efficient. You can have 100 000 wedges whiteout it lagging (but I’m looking into modifying the union file to only have 1 triangle).

1 Like

Roblox Devforum Challenge Week 1: Post your code!

By EvanPz

Challenges aren’t normally my thing, but I’m making an exception this time. I present to you, the first ever Roblox Devforum Challenge! The rules of this challenge are simple.

The only condition is that you must use Roblox Studio to create your project.

The challenge is to create an example of your code. It can be anything, but you must post the source code for others to use.

Why should you do this challenge?

Why not?

If you complete the challenge, you can get some helpful feedback on your code. This will probably help you to learn how to improve your code.

                </p>
            </div>
            <div>
                <h1>
                    <a href="https://devforum.roblox.com/t/need-help-with-the-hitbox-of-a-vehicle/114415/"></a>
                    Need help with the hit