0 votes

Hi there. So I'm trying to render some 3d models in a style similar to this, i.e., just the wireframe:
what I want

The best I've been able to achieve with spatialMaterials is the following (different model, obviously)
whatiget

Am I going about this the right way? I just want the wireframe, and while the effect I've got is okay, it's not exactly what I want. Any ideas?

I'm including my shader settings below. It's basically an unshaded material and then a second material pass that's unshaded, white, and uses 'grow' to make the outline.

    [gd_resource type="SpatialMaterial" load_steps=2 format=2]

[ext_resource path="res://materials/white.tres" type="Material" id=1]

[resource]

render_priority = 0
next_pass = ExtResource( 1 )
flags_transparent = true
flags_unshaded = true
flags_vertex_lighting = false
flags_no_depth_test = false
flags_use_point_size = false
flags_world_triplanar = false
flags_fixed_size = false
flags_albedo_tex_force_srgb = false
vertex_color_use_as_albedo = true
vertex_color_is_srgb = false
params_diffuse_mode = 0
params_specular_mode = 4
params_blend_mode = 0
params_cull_mode = 2
params_depth_draw_mode = 1
params_line_width = 1.0
params_point_size = 1.0
params_billboard_mode = 0
params_grow = false
params_use_alpha_scissor = false
albedo_color = Color( 0, 0, 0, 1 )
metallic = 0.0
metallic_specular = 0.5
metallic_texture_channel = 0
roughness = 0.0
roughness_texture_channel = 0
emission_enabled = false
normal_enabled = false
rim_enabled = false
clearcoat_enabled = false
anisotropy_enabled = false
ao_enabled = false
depth_enabled = false
subsurf_scatter_enabled = false
transmission_enabled = false
refraction_enabled = false
detail_enabled = false
uv1_scale = Vector3( 1, 1, 1 )
uv1_offset = Vector3( 0, 0, 0 )
uv1_triplanar = false
uv1_triplanar_sharpness = 1.0
uv2_scale = Vector3( 1, 1, 1 )
uv2_offset = Vector3( 0, 0, 0 )
uv2_triplanar = false
uv2_triplanar_sharpness = 1.0
proximity_fade_enable = false
distance_fade_enable = false
_sections_unfolded = [ "Albedo", "Ambient Occlusion", "Depth", "Emission", "Flags", "Metallic", "NormalMap", "Parameters", "Transmission", "Vertex Color" ]

And here's the 'white' material that one references:

[gd_resource type="SpatialMaterial" format=2]

[resource]

render_priority = 0
flags_transparent = false
flags_unshaded = true
flags_vertex_lighting = false
flags_no_depth_test = false
flags_use_point_size = false
flags_world_triplanar = false
flags_fixed_size = false
flags_albedo_tex_force_srgb = false
vertex_color_use_as_albedo = false
vertex_color_is_srgb = false
params_diffuse_mode = 0
params_specular_mode = 4
params_blend_mode = 0
params_cull_mode = 1
params_depth_draw_mode = 0
params_line_width = 1.0
params_point_size = 1.0
params_billboard_mode = 0
params_grow = true
params_grow_amount = 0.3
params_use_alpha_scissor = false
albedo_color = Color( 1, 1, 1, 1 )
metallic = 0.0
metallic_specular = 0.5
metallic_texture_channel = 0
roughness = 0.0
roughness_texture_channel = 0
emission_enabled = false
normal_enabled = false
rim_enabled = false
clearcoat_enabled = false
anisotropy_enabled = false
ao_enabled = false
depth_enabled = false
subsurf_scatter_enabled = false
transmission_enabled = false
refraction_enabled = false
detail_enabled = false
uv1_scale = Vector3( 1, 1, 1 )
uv1_offset = Vector3( 0, 0, 0 )
uv1_triplanar = false
uv1_triplanar_sharpness = 1.0
uv2_scale = Vector3( 1, 1, 1 )a
uv2_offset = Vector3( 0, 0, 0 )
uv2_triplanar = false
uv2_triplanar_sharpness = 1.0
proximity_fade_enable = false
distance_fade_enable = false
_sections_unfolded = [ "Albedo", "Ambient Occlusion", "Clearcoat", "Depth", "Detail", "Emission", "Flags", "Parameters", "Refraction", "Roughness", "Vertex Color" ]
asked Jan 25, 2018 in Engine by Jaybill McCarthy (21 points)

Hello, did you tried this addon? https://godotengine.org/asset-library/asset/13

2 Answers

+1 vote
Best answer

So after more research, I'll answer my own question: I haven't found a good way to do this with materials. The best thing I could come up with was to write a script to create the wireframe geometry by looping over the vertices in the model, but this is expensive.

What I ended up doing instead was actually making the actual model geometry a wireframe. This works fine for my purposes. If you're using blender and want to do this, it's very simple to achieve using the Wireframe Modifier

answered Jan 26, 2018 by Jaybill McCarthy (21 points)
+1 vote

I've written a bunch of scripts to generate wireframe geometries: https://gitlab.com/frankiezafe/godot-wireframe

Maybe it could help...

answered Feb 4, 2019 by frankiezafe (88 points)
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.