Zylann / godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
Other
1.74k stars 159 forks source link

allowing multipass shader #259

Open mnkylord opened 3 years ago

mnkylord commented 3 years ago

This is a feature request.

I am working on a stylized game where outline is a necessary visual element. It would be very helpful if the plugin and allow multiple passes of shaders.

Zylann commented 3 years ago

You refer to the next_pass property?

Exposing it is very easy and could be added.

Using it like you seem to want is a whole different story. next_pass pretty much render the object a second time using a different material, and that cannot be a SpatialMaterial for the same reasons there is currently not just a "material" property. If you do that, you will pretty much see a flat plane without textures. It must use a specific shader with the same displacement and splatting logic as the base one in it, with the grow+invert logic that makes outlines work (and the plugin must also assign the same special properties). It might be a little simpler than the base shader though since a black outline using the grow method wouldn't need texturing. Another note though, this technique of outlines on a terrain sounds very expensive, considering the amount of drawing a terrain takes.

Currently the node could expose a second shader section that starts null, and if a new empty shader is assigned it could pre-fill it with a copy of the currently used base shader.

mnkylord commented 3 years ago

I understand that it will double the draw calls. If you don't think it adds value to the plugin, then it is not worth the efforts. I am working with both the plugin and the heavy poly plane right now. (the draw cost will eventually add up and cost render time at some point in my dev). But I am trying to keep the visual style for now.

Thanks for the response!