I’ve created a module script that applies a vertex warping effect (inspired by retro console 3D graphics) using Roblox’s EditableMesh API. This creates a retro, distorted look to MeshParts and is designed to be easy to integrate into your projects!
You can get this module script here.
What It Does
-
Vertex Warping Effect:
The module distorts mesh vertices based on their distance from the camera, producing a retro warping/wobbly look reminiscent of early console games. -
Customizable Settings:
You can tweak parameters such as distortion intensity, minimum/maximum distortion size, and even set a custom framerate. -
Dynamic Mesh Management:
The script automatically scans for valid MeshParts in your workspace (or only those tagged with a specific tag) and applies the shader effect. It also listens for new objects added during runtime. -
custom framerate:
To help with performance, especially when updating many vertices, you can choose to update at a fixed framerate instead of every RenderStepped frame.
Video
Known Limitations
Permission Requirement:
The shader only works on meshes you have full permission over. This means:
- Meshes must be owned by the creator of the experience if the place is owned by an individual.
- If the experience is owned by a group, the meshes must be group-owned.
- For unsaved or unpublished places, the logged-in Studio user must have ownership.
Without the proper permissions, the module will be unable to modify the meshes.
Bulk Vertex Manipulation:
One major issue is that EditableMesh:SetPosition() only allows moving vertices one at a time. This means that each frame has to re-upload of the entire mesh to the GPU. As a result, if many meshes or high-vertex meshes are affected, you may experience lag or performance issues.
Currently, there’s no support for moving vertices in bulk, which would be far more efficient. For now, reducing the update frequency (via the fixed update interval) or limiting the number of meshes is the best way to manage performance.
Upcoming Features
I’m actively working on improvements, and here are a couple of features planned for future updates:
-
Regular Part Conversion:
I plan to add the ability to convert regular parts to MeshParts. This will allow you to use this effect on a broader range of objects. -
Additional Optimization Strategies:
While bulk vertex updates aren’t supported at the moment, I’m trying to find alternative approaches and potential optimizations that might reduce the performance hit on high vertex count meshes.
How to Use It
-
Setup:
Place the module script inside your project in ReplicatedStorage. -
Initialization:
Make sure you initialize the shader module from a LocalScript. For example:
local Shader = require(ReplicatedStorage.VertexWarpingShader)
Shader:Init()
-
Adding MeshParts:
The module can automatically scan the workspace for MeshParts. If you prefer to use tagged meshes only, simply tag your MeshParts with the tag specified in the Settings module (e.g., “Distort”) and enable the corresponding setting. You can also add and remove meshes manually with these methods:
Shader:AddMeshToEffect(MeshPart) -- Adds mesh to shader
Shader:RemoveMeshFromEffect(MeshPart) -- Removes mesh to shader
-
Pause & Resume:
You can pause the effect (which resets all affected meshs) or resume it as needed:
Shader:Pause() -- To pause and reset
Shader:Resume() -- To continue the effect
-
Performance Tips:
If you notice performance issues, consider lowering the framerate in the module settings or reducing the number of meshes affected.
Feedback & Recommendations
I’m still learning and am not the best at making module scripts, so I’d really appreciate any recommendations on how to further optimize, improve, and better organize this module.