Jump to content

How can I display wireframes ?


Recommended Posts

@blackrack

So I have it working, but it's kind of weird.  It seems that the wireframe depends on the distance from the camera, see this imgur album for what I'm seeing:

http://imgur.com/a/6gCWr

Ideally, I'd like the vessel to be wireframe and everything else normal.  Barring that, then everything to be wireframe

Ideas?

 

Link to comment
Share on other sites

19 minutes ago, linuxgurugamer said:

@blackrack

So I have it working, but it's kind of weird.  It seems that the wireframe depends on the distance from the camera, see this imgur album for what I'm seeing:

http://imgur.com/a/6gCWr

Ideally, I'd like the vessel to be wireframe and everything else normal.  Barring that, then everything to be wireframe

Ideas?

 

I found that by adjusting the Camera.main.farClipPlane, I can have the wireframes rendered further away.  But I would prefer to only have the vessel wireframe, not sure how to do that yet

Link to comment
Share on other sites

5 hours ago, linuxgurugamer said:

I found that by adjusting the Camera.main.farClipPlane, I can have the wireframes rendered further away.

Don't play with the render distances. You ll break the whole multicamera rendering.

Link to comment
Share on other sites

I'm a bit stumped.  I have code from Kerbal Object Inspector which can display a part as wireframe in the editor very nicely, you can see the code here: https://github.com/linuxgurugamer/KerbalObjectInspector/blob/master/Source/KerbalObjectInspector/WireFrame.cs

And this is where the component is added to the parts (code here: https://github.com/linuxgurugamer/KerbalObjectInspector/blob/master/Source/KerbalObjectInspector/Hierarchy.cs):

 void OnSelectionChanged()
        {
            for (int i = 0; i < selectionChain.Count; i++ )
            {
                // If the transform has some form of mesh renderer,
                if (selectionChain[i].GetComponent<MeshFilter>() || selectionChain[i].GetComponent<SkinnedMeshRenderer>())
                {
                    // Add a WireFrame object to it.
                    WireFrame added = selectionChain[i].gameObject.AddComponent<WireFrame>();

                    // If the current index doesn't point to the last in the chain,
                    if (i < selectionChain.Count - 1)
                    {
                        // Dim the color a bit.
                        added.lineColor = new Color(0.0f, 0.5f, 0.75f);
                    }
                }
            }
        }

 

So I've tried adapting it to the flight scene, and have not had a lot of success.  I am getting wireframes, but it looks wierd:

 var v = FlightGlobals.ActiveVessel;

                    foreach (var p in v.parts)
                    {
                        var mf = p.FindModelComponents<MeshFilter>();
                        var smr = p.FindModelComponents<SkinnedMeshRenderer>();

                      if ((mf != null && mf.Count > 0) || (smr != null && smr.Count > 0))
                        {
                            // Add a WireFrame object to it.
                            WireFrame added = p.gameObject.AddComponent<WireFrame>();                          
                        }

                    }
                }

What I am getting is the following.  Anybody have any ideas what's wrong?  :

c2qGuea.png

tJjofD6.png

Link to comment
Share on other sites

16 minutes ago, linuxgurugamer said:

So in the editor, only a single camera is being used, but in flight vthete are multiple cameras?

Ok, so it's a camera issue, I did a quick test and saw that there are 10 different cameras being used in the scene.

And rereading what @blackrack said earlier, I'm beginning to understand.

Is there any place which describes which cameras are used for what?

  • GalaxyCamera
  • ScaledSpace
  • Camera 01
  • Camera 00
  • UIMainCamera
  • UIVectorCamera
  • kerbalCam
  • KASCamItem4
  • KASCamItem6
  • KASCamItem8
  • KASCamItem10

I found the KASCam* in KerbalInventorySystem, so I'll ignore those.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...