Files
armorpaint/paint/assets/plugins/viewport_celshade.js
T

17 lines
478 B
JavaScript
Raw Normal View History

2020-12-30 16:26:16 +01:00
2024-04-02 15:45:49 +02:00
let plugin = plugin_create();
2020-12-30 16:26:16 +01:00
// Register custom viewport shader
2024-04-02 15:45:49 +02:00
context_set_viewport_shader(function(shader) {
2025-04-04 23:38:01 +02:00
// node_shader_add_constant(shader, "light_dir: float3", "_light_dir");
2025-04-02 22:52:04 +02:00
node_shader_write_frag(shader, " \
2025-04-03 21:29:51 +02:00
var light_dir: float3 = float3(0.5, 0.5, -0.5);\
2025-07-12 20:18:21 +02:00
var dotnl: float = max(dot(n, light_dir), 0.0); \
2024-09-26 21:55:27 +02:00
output_color = basecol * step(0.5, dotnl) + basecol; \
");
2020-12-30 16:26:16 +01:00
});
2024-08-22 23:07:22 +02:00
plugin_notify_on_delete(plugin, function() {
2024-04-02 15:45:49 +02:00
context_set_viewport_shader(null);
2024-08-22 23:07:22 +02:00
});