Adding a Toon Shader

Hi fellow developers :wave:. I wanted to ask that is there any way possible to create a toon shader in your roblox game using scripting ? I have found only one way so far and that is to duplicate the object , make one object bigger than the other and change its colour to black but that is really time consuming and difficult for complex builds. I will really appreciate all the help I receive.

Btw , this is what a toon shader does. It makes a cartoonish like outline on all the objects of your game.
image

4 Likes

Do you mean something like the new Highlight instance? Try putting it on a part and seeing if it’s what you want.

Picture of highlight on a part:


(The outline)

Yeah , I want that thing only but I would then have to put the highlight individually on each and every part. Is there any script I can put in the server script service that may do the job?

You can run this script in the command line:

for _, part in pairs(workspace:GetDescendants()) do
	if part:IsA("BasePart") or part:IsA("UnionOperation") then
		local highlight = Instance.new("Highlight")
		highlight.Parent = part
		highlight.Adornee = part
		highlight.FillTransparency = 1
		highlight.OutlineColor = Color3.fromRGB(0,0,0)
	end
end

It might take a while though if you have a lot of parts. Could even crash. Make sure to save lol.

Sadly, there’s a strict limit of 31 Highlights allowed, anything after won’t render, so you can’t add a highlight to every part in the game.

1 Like

Wow, thats tuff, their all there just not rendered. Is there a way to make them render. What about using a SelectionBox?

1 Like

Okay, so the selection box works but the problem is on meshes and weird shapes it doesnt just highlight the part but it only makes it well, a box.

SelectionBox would work on regular parts, but it won’t morph around anything like a Highlight would, it’ll always be a box.

The only thing you can do is limit the number of Highlights by putting them in groups, but it probably wouldn’t be enough for a full game still.

This post from a Roblox admin talks about the limit
https://devforum.roblox.com/t/proposed-studio-selection-ui-change/1794846/20

1 Like

Oh shoot, I didn’t know you could highlight groups. In that case, OP can try:

for _, group in pairs(workspace:GetDescendants()) do
	if group:IsA("Model") then
		local highlight = Instance.new("Highlight")
		highlight.Parent = group
		highlight.FillTransparency = 1
		highlight.OutlineColor = Color3.fromRGB(0,0,0)
	end
end

Wait, actually you dont need a script at all. All you have to do is just group everything that you want highlighted into 1 group, then just put 1 singular highlight in it and it will highlight everything (or you can put it in the workspace but it works better in a group and you can also filter out the basplate and only highlight what you want)

1 Like

Looks like you’re looking for something called a cel shading.

There was a discussion about it too!
https://devforum.roblox.com/t/how-would-you-approach-cel-shading-in-roblox/1790336?u=operatik

5 Likes

I’m sorry, but cel shading is more about the shadows being sharp instead of having a smooth gradient rather than having a:

1 Like

But it is what it says, the alternate name is also toon shading. Please read carefully before you throw out a statement.

I guess it’s a little bit of both. I only saw the first half of it and it was all about shading

You can also import the model into blender, duplicate the model, scale it larger and reverse the normals

you can always try parenting the highlight to workspace I think it works