Fun stuff upcoming…
What is a render priority?
A render priority is basically a statement that states when something should be rendered. The image above renders the normal Roblox world first, then the red blender money mesh, then the green one, and then finally, the blue one. Render priority, not to be confused with Enum.RenderPriority
can do some cool stuff. In the gif above, I changed the size of the red mesh (which was rendered first) to 120%, the green one to 110%, and I left the blue one alone. The result? An outline effect.
Now, people have done this using inverted meshes which is not as elegant, nor as clean as the method I am going to show you. You can go much further than just outlines using this system.
The basics
Let’s break the illusion! The way this was done was by using layered ViewportFrame
instances. Here’s the basic instance layout:
Yup, that’s right, it’s just viewport frames! The way this works is that you set ViewportFrame.CurrentCamera
to game.Workspace.CurrentCamera
. This lets the viewport pretend to be a part of the workspace environment as the camera retains the properties for all the viewports (fov, position, orientation, etc.).
Using it: distance exaggeration
By anchoring the viewports in the center by setting the AnchorPoint
to 0.5, 0.5
, and setting the Position
to 0.5, 0, 0.5, 0
, we ensure that the viewport will always be in the center. Now, we can apply the UIScale
instance to the viewport to get a bigger render. And when layered behind each other with different colors, you get something like this:
And when you repeat that… a *cough* 255 *cough* times, you get funky stuff like this:
Using it: outlines
This is the best implementation of this method. Instead of adding UIScale
instances, you can just scale the first rendering layer to create an outline. In this case, the red blender monkey is 120% of its original size. The green is 110%, and blue is left alone. This results in a very clean method of outlining that does not pollute your game.Workspace
and can be easily grouped and disabled at once. One downside to this method is that the outline will be visible even behind walls.
Using it: always visible meshes
By simply using this method, you can let the meshes/parts render even behind walls as nothing is blocking it in the viewport and the viewport is rendering after the Roblox workspace has. This can be used to do stuff like track players in a game.
Anyways…
I hope you guys keep this technique in mind and utilize it when you need to. I hope you enjoyed reading this
- TrèsAbhi (yeah, my website’s abandoned…)