Wireframe Generator for Godot (C# + Shader source in thread)

novaleafnovaleaf Posts: 83Member

Had help from cybereality on how to do this.

If you want to see a brief overview video:

Video outlines the features of the Wireframe shader I made. It took about 7 days.

Source code and test scene here: https://github.com/jasonswearingen/godot-csharp-tech/tree/dev/demo-projects/scratch/demos/WireframeMeshDemo but you will probably want to copy/paste to your own project.

Adding wireframes takes to parts: pre-processing your mesh with the MeshDataTool and then a shader that can read the data it encodes into the vertex color.

The MeshDataTool processing is done in WireframeMeshDemo.cs and I did my best to comment the code. I ended up using 5 color channels for vertex ID's, and 1 channel to hint what side is longest (for interrior edge removal). I was able to have these 6 channels by encoding 5 choices into red (20% each) and 1 into green. The shader reads this encoded data and generates the barycentric coords for the rest of the shader to use. The shader is in WireframeMeshDemo.shader

If you have any questions, just ask.


Tags :

Comments

  • cyberealitycybereality Posts: 927Moderator

    Awesome! So glad you figured it out and happy to have been of help.

Sign In or Register to comment.