I’ve developed a wireframe shader that will run on iOS (no geometry shader on ios) and for the past few days I’ve been working on it, all in the scene view, and it finally works great.
So I apply it to the material, comment out the ‘faking a wireframe by drawing lines around the objects’ code I wrote almost a year ago when I was first learning Unity development and shaders were scary, and I hit play.
In the game view, not only does it look “wrong” (the lines are too thin at the same camera distance) but there are also artifacts dotted along the edges of triangles that should not be showing any edges. In addition, when playing, if the camera gets too close, the objects disappear completely (I suspect this has to do with the ddx/ddy functions in the shader, however, this does not happen in Scene view. For anyone familiar with it, my code is based off The Amazing Wireframe shader. I looked at the demo and set out to make a version that fit my needs better. So if you’re familiar, it works somewhat similar to that).
I’ve messed with game camera settings, changing from Perspective to Orthographic, field of view, culling, clip planes and nothing seems to change it. Here’s an image. Scene view on the left, the game view on the right.
Because the image host resized the image and made it hard to see, here’s another of the game camera window:
Only the outer edges should be wireframed. And clearly they are, and look good in the scene window. The lines are solid, where in the game view they are thin and weak looking.
Why would the scene and game cameras render the same object so completely differently? And also, it looks that way in EVERY game camera. The image in the screenshots is a mesh I had been testing on, sitting in the scene for easy viewing. I moved it over so it was visible to the main screen camera and it had those issues. A different camera, which is the one shown in the screenshot above, also has the issues.
I’ve googled the heck out of this and cannot for the life of me even find a reference to why it would behave so differently in the scene or game camera.
Anyone?