Highlighting a single model

Hey everyone,



I’m trying to highlight with an outline and/or a faint color over a single model in my world.

I briefly looked at some of the Cartoon filters but they do it for everything on the screen. Should I be able to modify it to only affect a single model? or is there any other ideas that I can try to achieve this?



Similar effect is on League of Legends when you mouse over a unit, it outlines them with a color.



I’m not asking for the full solution (although if you want to give the full solution that will be fine as I’ll read the code and learn from reimplementing and modifying it) but rather a shove in the right direction.



Thanks,

Nyfinscyf

I personally go this way: on mouseover i attach a new spatial ( Basically the corners of a box ) which is surrounding the model. Trough this way i get a nice visual feedback.

Another way could be modifiying the color of the used materials. (Make them brighter)

Rim Light Shader may be along the lines your looking for.



Or you will probably be find something handy in the awesome LightBlow Shader.



A true outline will require post processing, and pulling out individual objects for this can be tricky, although some work is currently going into making it a bit easier.



Outlines can also be achieved by duplicating your geometry, scaling it up slightly then flipping the normals, not sure what this technique is called but it’s good to be aware of, however its not suitable for most applications.



Good Luck!

James

Note: the last trick @thetoucher mentions (and it’s a good one) is actually about rendering the opposite sides of the shape… so inside instead of outside. This is settable as an additional render state on that material: RenderState.FaceCullMode. Flipping normals may also help it render right if it’s lit but you’d probably actually want to use an unshaded material for the highlighting and it won’t really care about normals.

Thanks for the help. I’ve taken a look at doing the Rim Lighting, it works on decent poly models and roundness, sadly the models I’m using are extremely low poly (yay for free 3d animated models) so it looks a bit strange.



How would I do the duplicating and scaling by code properly though? because when I do it the scaled one doesn’t match, it’s like I need to scale each vertex along its normal, I know that will look right, so I might go look into accessing the model data through code. Though, wouldn’t there be an issue with animation on the duplicated model?



I’ve taken a look around at other things, and currently the closest thing to what I need is a Cartoon Edge Shader, however, I only want to apply the edge to one model at a time and be able to toggle it on and off.

@thetoucher I looked at your shader library and the ToonBlow example helped me out a lot. I’ve now got a fairly decent effect of what I wanted and it works how I need it to.



Thanks for the help.

@nyfinscyf no worries mate, glad I could help :slight_smile: looking forward to seeing what you come up with

If its just for seeing the selected one, and a contur like the cartoon shader does is not the only way you can imagine.



How about attaching a red

Ambientlight directly to the model in question?



That way the model would be righter than the rest and slightly redish