Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

CAD-style orthographic line drawing

Discussion in 'High Definition Render Pipeline' started by dbillings_thehalseygroupllc, Jan 2, 2020.

  1. dbillings_thehalseygroupllc

    dbillings_thehalseygroupllc

    Joined:
    Feb 15, 2016
    Posts:
    23
    Hello,
    I am looking for assistance in creating a shader or rendering effect for HDRP where it creates a CAD line drawing effect, similar to this

    I have found a camera effect by Keijiro that works in HDRP and can be changed to white/black like I want (https://github.com/keijiro/HdrpAovTest) however I am running into issues where flat faces such as quads/flats and even the side edges of perfectly flat squares do not show up if they are perpendicular to the renderview, is there any way to fix/achieve this or do I have to change the mesh?

    any insight into achieving this effect in HDRP and overcoming hard to see edges is greatly appreciated
     
  2. laurent-h

    laurent-h

    Joined:
    Sep 29, 2016
    Posts:
    78
    Hi,
    The effect you're trying to achieve is not exactly what you saw in Keijiro's repository.
    I would recommend you to investigate into outline effect and/or edge detection effect like in this repository :
    https://octolinker-demo.now.sh/alelievr/HDRP-Custom-Passes

    You can test the TIPS effect : it runs an edge detection effect when the render is outside of a mesh attached to the camera. Four your test you can set a low value in the "size field" so all of your render is outside the mesh.
     
  3. dbillings_thehalseygroupllc

    dbillings_thehalseygroupllc

    Joined:
    Feb 15, 2016
    Posts:
    23
    Thank you for the reply! These effects look great, however I noticed that they are built in Unity 2020, are these types of effects available in 2019.2/2019.3? Would like to stay in official releases if possible. Thank you!
     
  4. laurent-h

    laurent-h

    Joined:
    Sep 29, 2016
    Posts:
    78
    You should be able to use these effects in a 2019.3 project (make sure you use HDRP 7.1.7 to get the latest bug fixes).
     
  5. syscrusher

    syscrusher

    Joined:
    Jul 4, 2015
    Posts:
    1,104
    Looking at the OP's example images, I concur with @laurenth-unity in suggesting edge detect rather than a true wireframe render. In CAD, a wireframe view typically does not occlude any edges and makes for a very dense visual (the idea in CAD is to be able to intentionally select edges or vertices that would be hidden in a textured view of the object). A true wireframe view might look overly cluttered to a nontechnical audience.

    That being said, if you decide you do want a true wireframe that works in HDRP, I have created one for my Magic Markers asset. The HDRP version of the tool is still under development, but I have the wireframe shader working. Because of the nature of the tool I've built, my "wireframe" view is a hybrid between the edge detection method and a CAD-like wireframe. Mine is like CAD in that it shows all the mesh triangle edges, even if they do not correspond to a visible edge on the object, but my shader does occlude edges that would be hidden from a textured render. (The occlusion can be easily disabled with a one-line code change in the shader.)

    If the solution from @laurenth-unity (which, again, is the method I recommend as well, because it's probably closer to what you want visually) doesn't work, contact me with a personal message and I may be able to help.

    Another option would be to contact Davit Naskidashvili, the creator of The Amazing Wireframe Shader (https://assetstore.unity.com/packag...ame-shader-the-amazing-wireframe-shader-18794). I've used The Amazing Wireframe Shader in my own projects (because Davit's product has options and features my own tool-specific shader doesn't need), and I can heartily recommend it. It currently does not support Scriptable Render Pipelines, but the author has posted on the product's forum thread that SRP support is under development (I don't recall the developer giving a planned timeline).

    Hopefully the previously-posted solution is what you need, but if not, you now have a couple of other options. :)