Wind Waker type of toon shading

I’m working on a cartoon-ish project, and I want to achieve a certain look using shaders, but I’m WAY over my head when it comes to shaders. Therefore, I’m looking for some help :slight_smile:

The problem I’m having with the Toon-Basic shader, is that the cubemap warps around the mesh according to the camera’s postion. Then, the Toon-Lighted shader doesn’t warp the cubemap at all. What I would like to do is either warp the cubemap according to light positions, sort of like this picture from Wind Waker.

I’ve looked over the included shaders but still don’t know where to start. If someone can give me some help, I’d be greatly appreciative.

I am also interested in something like this. It seems just like there is a 50% threshhold instead of actual… like… shading. I’m sure it can’t have much overhead cost and it would be fairly easy to do… but I have no idea how to do it… or how to start.

I don’t know the nitty gritty of writing pixel-shaders but the theory is fairly straightforward, and you’ve essentially written the algorithm in your post:

given the lighting strength (which I believe you get given), if it’s above some threshold, return the color map value, otherwise, return some fraction of the color map value.

If I understand correctly, you can only add custom shaders with a pro license though.

It seems like you should be able to tune one of the existing toon shaders to deliver this result though.

Not at all, you get ShaderLab with both. It’s clear here: https://secure.otee.dk/shop/

Oh so it is :slight_smile:

Regardless, it should be possible to use an existing toon shader to get this effect.

Actually, you don’t need Pro to write custom shaders. Pro users get: Windows Publishing, Full-screen image effects, and Render to Texture. People seem to have a lot of misconceptions about what you can’t do with Indie, but Indie users really get 95% of Unity’s functionality.

As far as looking at the other shaders, I’ve looked at the differences between the lit and non-lit toon shaders, and they both seem somewhat over my head. In looking at the Toon-Lighted shader behavior, it doesn’t seem to show direction of light like the diffuse shader does. Mostly, it just makes the entire mesh a little brighter as light gets closer to it. I had some fun with the spotlight and the toon-lighted shader, actually.

Well, warping the lighting when camera moves is not correct in a physical sense (diffuse lighting does not change when camera moves), but yes it’s done often and looks better.

Can’t you get the same effect by just adding a light that is parented to the camera and always illuminates the view at the constant angle?

So this looks like a user error. Unity is already capable of this, but I wasn’t using it correctly. For my experiments, I had been using a light that was set to Force Vertex, so I was getting all sorts of weird behaviors. But after setting the light to Force Pixel, I noticed that the Toon-Lighted shader DOES wrap the cubemap based on a directional light.

From there, it was just a matter of making a light map to convert to a cubemap, and voila!

14317--485--$nekotoonshade_173.jpg
14317–486–$windwakerlighting_458.zip (2.26 KB)

Thanks–I’ve been having fun today modifying the cubemaps in the standard toon package. I’ve been trying color variations and noise to make an “imperfectly inked” look and it’s not bad.

For some reason I can’t seem to get any outlines, but I’ll keep playing.

I take it that hardware that doesn’t support cubemaps will simply fail gracefully and show the solid color?

Is this a shadow or a clever trick ?
And this normal grub, did you figure out how to smooth it out ? My very much lores objects are showing the same artifacts, baking normal map from higher res might work but I’d have to UV the bugger.

66728--2471--$nekotoonshade_173_773.jpg

Wow, that’s an ooooold version of the Neko. The attached image shows how the cubemaps look with the current version of the object.

The shadow isn’t a real shadow or a clever trick, it’s simply the way the cubemap toon shading looks based on the curved surface of the face.

The “grubs” you’re talking about, which I assume you mean the graphical artifacts… those were being caused by the compression of the cubemap texture. If you turn off compression of your cubemap texture in the its import settings, it should look a lot cleaner for you.

There are still a few artifacts because of the mesh density, but the camera never really gets this close in the real game so it’s acceptable to me as the designer.

Awesome look!

Can you multiply that with baked vertex color ?
Or multiply it with another cubemap ?

Yes. The built-in Toon shaders do this look; but you can change them to multiply with vertex colors, with another cubemap, or whatever you like.

Is it the toon shader that provided the dark outlines, the cubemap or your model/texture?

AGhost

I know everything is possible but since pass is only additive I think it’s more involved than just copy and paste… example would help

Then say what exactly do you want :slight_smile:

  1. Multiply per-vertex color with the one produced by the current toon shader?
  2. Add additional cubemap? Or Multiply with additional cubemap? Something else?
  3. The additional cubemap - for what it would be used? Simulate reflection? Simulate lighting? Something else?
  4. Some combination of the three points above?

I want peace in the world.

In the meantime I’ll settle for 4) - the combination of the three points above :slight_smile:

how did you get those nice outlines?
the toon shader with “borders orthographic” gives me this effect

EDIT: i hope you didn’t use this
http://unity3d.com/support/documentation/Components/script-EdgeDetectEffect.html

DO you have this version of the shader still? This looks awesome! I hope I didn’t just bring this post back from the dead! :smile:

I would like to ask about the “Force Vertex” and “Force Pixel” …where do you change the setting??

I used Unity3