is this possible inside Unity?

I want to display the selected object in my current project with it’s visible (straight) edges picked out - preferably in a gently pulsing laser-ish light. I can’t even figure out how to do it with a boring old white line. I could do it as an animation in my 3D app I suppose but that would probably generate a lot of redundant geometry. it’s essentially a rendering fx animation I’m looking for so that would seem to be a shame. Any ideas?

Do you mean that you want the edges of the box in lazers? If so, maybe you could use a particle effect. Or maybe you could make a wireframe cube in your 3d app, place it over an ordinary cube in unity, and use one of the self-illuminated shaders. Never tried it, but it could work.

You could also possibly use a Line Renderer and get all sorts of snazzy glowing effects.

hey tom
the line renderer looks promising. I assume i would attach a child object, feed it a point array and then render with the line renderer. Once I’ve figured out all the potential point arrays it should be fairly straightforward. One Question. Would it deal with hidden line removal?

-rod

Lines out of view may cause issues with z-depth sorting so you’ll want to test around that to be sure.

Hehe, seems like it’s not only possible but as if there were quite a few possible solutions. One thing you might want to look into if you have Unity Pro is using Shader Replacement. There’s a demo project available at:

One of the effects in that project is

Might be a little overkill and I’m not sure how well this approach would be suited for just a single object - but it might be an option :wink:

jashan thanks for pointing me at that, it seems like just the ticket - how could i have missed that example. I’ll check it out in the morning.

tom. I spent ages with the line renderer today and it can definitely do the job but i do find it frustrating to use. In fact with ‘use world space off’ it seems impossible to use. I know I risk sounding like a plonker here but it really does. I place my parent object at the world space origin, draw a line half a mile long and set the transform position of the Line Renderer at zero. Click ‘use world space off’ and bingo it’s nowhere to be seen. Assuming that’s overcome it still means working out all the vertices which could be a long and boring job. Nevermind at least i have some options.
-rod

came back to same project/scene this morning and the line renderer still disappears when ‘use world space’ off. I created the exact same game object again with a different name and surprise, surprise it works as expected. I strongly suspect there is a bug somewhere in the line renderer code - i noticed as well that the ‘end width’ parameter was different for one of the line segments (I presume this should be the same for all segments in any given instance).

This thread deals with using GL Lines to draw wireframes, but the scripts in that thread could easily be modified to use Line Renderers instead of GL.Line.

http://forum.unity3d.com/viewtopic.php?p=65483

HTH,
Ethan

LINE RENDERER.
If you accidentally delete element 2 and add it back again the instance of the line renderer disappears in local view and is no longer usable. I don’t know if that classes as a bug or not. the width parameter does some weird stuff too.

I’ve done it with the line renderer but i find it kinda looks a bit odd. I think it’s because the version of OpenGL used by the iPhone won’t render quads so each line is made of 2 triangles.

Oh … you were talking about an iPhone project? In that case, your possibilities are somewhat more limited. Shader Replacement won’t work on the iPhone and neither will using GL.lines.

In that case, I guess line renderer or particles will probably be the only options (with the limitations you pointed already out). Possibly, with the iPhone your original idea of creating this effect directly in your modelling software (maybe with some nice “glow-textures” … or maybe even with simply replacing the texture) might end up being the best solution; might be that the best approach is actually changing the texture when you want to switch that effect on/off.

jashan

I’m not convinced it’s completely down to OpenGL ES because the very first line segment works as expected but all subsequent ones are screwed up. On the first both triangles rotate in sync but on the rest they’re out of sync giving the ‘eccentric’ effect. I could make arrays of the vertex pairs and instantiate a separate line renderer for each one but i’m not sure i want to spend the time on it. What would be the approach be for particles? How would i map them to a path?