How do I achieve this effect?


Any ideas on how to achieve that outline effect without effecting the color below it?

4 Likes

One method that works is having a second part with a slightly bigger mesh size, but having the scale in the negatives, like (-1,-1,-1).

2 Likes

Note: The neon effect only works on MeshParts, not regular Parts with SpecialMeshes.

To get this effect, you can achieve it by:

  1. Duplicating the MeshPart and scaling it in all directions by a little bit. Also set its Material to Neon.
  2. Fudging with its CFrame so that its normals point inwards instead of outwards.

image

To get the CFrame of the neon part (let’s call it purplePart) I run this in the command bar:

local cf = purplePart.CFrame
purplePart.CFrame = CFrame.fromMatrix(cf.p, cf.rightVector, cf.upVector, cf.lookVector)

NOTE: This technique doesn’t work too well when the mesh is composed of multiple pieces which are far away from its center. You’ll need to export it and offset the faces in blender (or some other 3D modelling program) manually.

10 Likes

That is going to double your geometry, and relies on unsupported behavior that could change (or having to upload 2 copies, one inverted, also yuck). The standard way to make what’s shown in the example is just to make a neon MeshPart that’s the color of the outline, UV map all the “leaves” on the tail to the same UV space, and apply a texture that is black but with a transparent border. You could also model the item with extra geometry on the edges, and break it up into 2 meshes: solid color inner tail, neon outer edge. This will be less geometry overall than 2 full copies of the mesh, and will not have the glitchy look of an inside-out part.

3 Likes

Applying a decal over a mesh duplicates the geometry anyway. You’ll see the triangle count double when you apply a decal.

You’re right about the weird CFrame being unintended behavior, though.

1 Like

Not a decal, a texture made for the mesh and applied by TextureID. Decals will always be cube mapped, you need to use the meshes UV mapping to do this.

2 Likes

But texture transparency doesn’t work for MeshParts. The alpha gets stripped.

1 Like

The minimum required transparency is anything strictly greater than 0.01. You can see in the example image that the black areas of the tail are ever so slightly transparent. This is likely the cause. In practice, it’s not a huge deal. This is how many people have been doing trees since forever.

1 Like

Fair enough, but using that technique will cause the same issues that the OP in the thread I linked had w/ transparency + rendering transparent stuff can be costly. Using a texture also doesn’t work for all angles (this technique can’t be applied to the mesh in my first reply, for example.)

1 Like

Yeah, it’s a different effect too. The inside-out outline technique is best for when you want to highlight the overall outline of the part, rather than all the visible edges of the geometry. You can’t do the latter with a simple scaled copy of the mesh, it has to be a thicker copy of the part (i.e. an offset surface part, rather than a scaled part).

1 Like

Yeah, my technique really only works for meshes which are relatively “whole” (can’t pin down the exact term, basically it should be relatively convex). I did sorta note that in my original reply, though.

2 Likes

Convex is exactly the condition required, because concavity is where you get the offset surface flowing towards itself.

1 Like