Search Unity

Specific cutting plane

Discussion in 'General Discussion' started by oLDo, Mar 21, 2018.

  1. oLDo

    oLDo

    Joined:
    Mar 14, 2017
    Posts:
    55
    Hello.

    I'm trying to create cutting plane like CAD system with surfaces (no solid). Make sense, because Unity is working with meshes. My goal is to have a movable plane to create line segments from meshes in that plane. For better understanding I have some pictures from modeling sw.

    rez_Surf_shaded.jpg rez_Surf_rez-only.jpg

    Important thing is to keep clipped mesh materials and shaders without touch. Usually clipping scripts working with custom materials on those meshes.

    I tried few options. One of them was to create second camera with outline script to renderTexture and use it on plane. That camera has near 0 and far 0.01 clipping planes. Outline script https://github.com/cakeslice/Outline-Effect. But I had issue to saw mesh from side (upright). Because the mesh thickness is actually zero.

    Another option was going through mesh structures, calculating intersect points and use LineRenderer to get result. But I didn't figured out how to keep order of this points. Because going through mesh triangles is a little tricky.

    Do anybody have some thoughts?
    Thanks in advance
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
  3. oLDo

    oLDo

    Joined:
    Mar 14, 2017
    Posts:
    55
    Hi. Thanks for response. I found it before when I was looking for solution. But this is what I'm not expecting. And also this solution need custom shader on target mesh.
     
    Last edited: Mar 22, 2018