0 votes

I notice that there is a create outline tool for mesh instances nodes. Is there a way to access it through scripting during runtime? if not is there a way to invert the normal on a mesh because that's really all the editor tool does is create a copy of the mesh and invert the normals on it.

in Engine by (255 points)

Wow, although I understand how it works, I would have expected this to be made with a material/shader. Making a copy of every single mesh in a game sounds impractical :/

Which tool are you talking about?

Yea, using a shader would be ideal but I haven't gotten around shader programming yet so the next best thing is to cheat. Although for my use only one object would ever have an outline made at a time and my game being a turn base style game helps a lot with management of such an effect. Is the current shader model in godot allow for complex shaders like the highlight shader?

To implement the technique you described (which is the cheapest) I don't think shaders on their own can do that. It depends on the engine. For example, Unity has a material system in which you can specify passes in a custom shader language, so you can actually tell Unity to draw twice a model with a single shader file, and when in the drawing process.
Thanks to this you can implement basic fur or polygon-based outline by just assigning a material.
In Godot, shaders don't go beyond being shaders. They cannot create geometry or tell Godot to draw more. That's why it forces you to clone MeshInstances if you want that.
In the future this could change though, for tessellation or newer things.

You can use my Wireframe Tool plugin. It works in editor but you can delete tool keyword and call functions from the game. The source is released under MIT license so I'm sure you can generate outline mesh at runtime with few code modifications.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.