- Home /
How do I shade something for edge-rendering?
My application requires a very simple renderer, akin to BattleZone, vector graphics, or similar. Basically, semi-transparent faces, and thick lines for all edges. Bonus points for extra-thick lines at the outline of the object. In SketchUp, this style is easily available... see attached render.
I have explored 90% of the material shader menu, and can't find much close, aside from "Unlit / Transparent" with a edged texture that needs manually re-scaled for each and every asset.
PLEASE HELP, becuase this is a cool title for Oculus Rift!
Answer by Jeff-Kesselman · Nov 18, 2014 at 08:55 PM
What it seems to me you are looking for is a vector or edge renderer. This is actually a non-trivial problem as a GPU program, but there are quite a few solutions out there if you google for them.
To my knowledge though it will have to be a custom renderer, Unity does not come with one.
Jeff, this is a trivial problem from a compute perspective... it takes a lot less render calcs than many more complex shaders. There is no concept of "lighting" or "shadows" here, simply edges and faces. The question is, if this shader style is not natively supported in Unity, is it perhaps available via the asset store?
Its nontrivial to do on the GPU. If you want to understand why, read some of the articles I linked below.
Not a trivial matter. Don't just see the ready made results as you'd want a shader that culls the backfaces, doesn't overlap, and does edge detection. Each of these on their own is easy. Have you checked the asset store? i think there are packs available.
screenname_taken: I have checked the asset store extensively. perhaps i'm typing the wrong keywords. any suggestions? exploring Vectrosity now as per second response.
Jeff : the only reason I say "trivial" is that a proper implementation is far more straightforward to calculate than lighting / shadows / reflection or more "common" pseudo-raytrace solutions. We've intentionally engineered the entire scene to be extremely low poly count; the final target is mobile VR, so we're running on mobile GPUs with limited battery / heat... low poly elegance is key.
Answer by tanoshimi · Nov 18, 2014 at 09:38 PM
Vectosity is really a vector drawing package. You could use it to do a battle zone sort of thing, maybe, but that wasn't really what I understood he a asking for.
he wanted a shader that made it look wireframe. such things do exist.
http://strattonbrazil.blogspot.com/2011/09/single-pass-wireframe-rendering_10.html
http://codeflow.org/entries/2012/aug/02/easy-wireframe-display-with-barycentric-coordinates/
You may be right, but I interpreted the question as "I want to achieve this end result - what method should I be using?" - the OP doesn't actually explicitly mention that they want a shader - they state they want "a very simple renderer, akin to BattleZone, vector graphics, or similar.", and I think vectrosity pretty much meets that description ;)
I guess it depends on what your scale of your scene is.
I'd be hesitant to try to draw an entire typical scene in wireframe with vectrosity.
I agree you could probably literally do battlezone with it-- thats very few lines.
Jeff, as a researcher, I genuinely appreciate those technical links. $$anonymous$$y current research focuses on Rift and other VR hardware. You may enjoy it: http://dsky9.com/rift/