Highlighted Enemies... Is the culling mask the only way to do it?

http://www.cheatmasters.com/blog/wp-content/uploads/2012/10/torchlight2-2012-10-10-22-03-09-03-1024x576.jpg

So, if you take a look at this picture you’ll see what i’m kinda aiming for. it looks like it’s using a sort of dynamic light and doing some research it does seem like i’d be able to use the culling mask… but, since i’m already using the layers to control and filter the raycasts i’m using in the scene, this might pose a bit of a problem to me (and also the raycasts are what i’m using to determine what it is that i’m trying to target so i can see this going a bit wonky if i’m not careful.)

Also, given that i’m using the lighted toon outline shader in the standard assets (unless someone has a tweak to it that will allow it to use a normal and/or specular map to control this) It seems that using a light might not be the most ideal option in my own case.

Still, the effect is what i’m hoping to learn how to do and aside from using a light and setting the layer of the object dynamically as the game goes (and hopefully setting up some error catching to prevent it glitching out because of these changes in layers) are there any other ways you can suggest i look into to address this and get something like this or similar?

This effect can be achieved in shader by using rim lighting. Basically you would blend in your highlight color based on the facing angle of the object’s normals. So as the normals face further away from the camera the the object would take on more of the highlight color thus giving you the look you are trying to achieve. You could also pass a range say from 0-1 to control how strong the effect is or turn it off completely. If you want the highlight to appear when your object is occluded from other objects then things will get a little more complicated but still not to bad if you are familiar with writing your own shaders.

Yeah, writing my own shaders is probably a tall order since i will admit i’m not the best (i’m using Playmaker for the coding.)

How much do you think it’d cost to contract someone out to make a shader that would be able to do that “still show while it’s occluded” effect?

Reason being is that if it can be broken down to a matter of just hot-swapping the shaders or turning the effect on/off with a property or variable, that opens up many avenues for me that would otherwise be limited given my level of programming knowledge.

Pricing can vary a lot depending how complex the final shader will be and the platform(s) you want the shader for. Will you only need one variant or multiple for different objects or platforms. And as always pricing will vary between from freelancer to freelancer and the time constraints you are under. If you like to discuss it more specific details feel free to pm me.

There’s a rim light shader in the surface shader examples. I’m willing to bet if you asked somebody in the ShaderLab forums they’d be able to point you in the right direction of having the shader show up on top of things.

If you have Unity Pro, in the asset store look for the Highlighting System in Scripting/Effects section. I think It is the best solution for that effect.

Since I was bored thought it be fun to play with this a little bit and modify Unity’s toon shaders to include rim lighting effects. Here’s what I’ve got so far.

  • Set highlight color
  • Control the tightness of the highlight from the edge
  • Control the blend between highlight color or material color
  • Turn off highlighting

Doesn’t display over occluding objects yet but that would be a relatively simple matter moving the rim lighting to a separate render pass that draws above the other objects.

Edit:

The downsides to that asset is that it is more of a glowing highlight which requires Unity Pro, doesn’t give the same type of effect as shown in the op, and doesn’t look to work with toon shaders. It does look like an excellent off the shelf solution if you want glow based highlights.

That’s actually pretty good for what i’d need… If i may, would you be interested in helping out?

After a little more playing it is now possible to show the highlighted object’s highlight from behind an occluding object just like Diablo 3. :slight_smile:

I’m open to the idea, shoot me a pm.

Edit:

Another test with some dungeon assets.

This is a really nice looking shader! is it a pro-only thing or would this work in the indie version?

Thanks, glad you like it and since it is based on Unity’s original toon shaders it should run everywhere they do which means it should work on the indie version and mobile, though I have yet to test that.

BTW there should be a response from me in your pm box.

Well, if you’re interested in helping out on the project i’d need these for, they’re going to be tested on an indie license (though, i do have plans on upgrading… but it is a rather expensive product to be completely honest so i’m hoping that my share of the profits will cover that.)

Further, if you’re interested, i’m sure i’m not the only one that would be interested in these shaders as well… especially if they could be given a lot of robust options to them (such as normal maps, emission maps, falloff controll for the edge lighting, overlay for the edge lighting for things like a shimmering, static, noisy look.)

So many options and if they are all indie-friendly, i’m sure you’d have something quite marketable

To the forum… would you be willing to buy a full set of shaders like what we’re discussing here if they were priced fairly in the asset store? :wink:

Kenny Lammers did a video tutorial on writing an advanced rim lighting shader. Fast forward to about 18:00.

He’s got some other really good videos on other shaders as well.

The shaders look great, so it would be definitely worth considering.

Edit: I looked around on the net, and though they don’t look as good as what chronos78 proposed, these free shaders seem like a good basis to play with Toon + Rim Lighting: http://jeanmoreno.tumblr.com/post/28050060606/free-toon-shaders-for-unity