diff options
author | Lukas Stockner <lukas.stockner@freenet.de> | 2019-12-25 23:12:56 +0300 |
---|---|---|
committer | Lukas Stockner <lukas.stockner@freenet.de> | 2019-12-26 02:32:16 +0300 |
commit | fa5e28ab08c74bcb4971e71926deab695281ef78 (patch) | |
tree | 107852dfebff765fd28cc2116b5615a2e2aec9da /intern/cycles/kernel/shaders | |
parent | 6657fcc78375948ea04d860a015d146f2686a051 (diff) |
Cycles: Support UDIMs with OSL shading
Diffstat (limited to 'intern/cycles/kernel/shaders')
-rw-r--r-- | intern/cycles/kernel/shaders/node_image_texture.osl | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/intern/cycles/kernel/shaders/node_image_texture.osl b/intern/cycles/kernel/shaders/node_image_texture.osl index f78ca7ec0e8..96ce39a08c8 100644 --- a/intern/cycles/kernel/shaders/node_image_texture.osl +++ b/intern/cycles/kernel/shaders/node_image_texture.osl @@ -63,11 +63,21 @@ color image_texture_lookup(string filename, int ignore_alpha, int unassociate_alpha, int is_float, + int is_tiled, string interpolation, string extension) { + /* Flip the y coordinate, but preserve UDIM tiles. */ + float flip_v; + if (is_tiled) { + float v_i = (int) v; + flip_v = v_i + (1.0 - (v - v_i)); + } + else { + flip_v = 1.0 - v; + } color rgb = (color)texture( - filename, u, 1.0 - v, "wrap", extension, "interp", interpolation, "alpha", Alpha); + filename, u, flip_v, "wrap", extension, "interp", interpolation, "alpha", Alpha); if (ignore_alpha) { Alpha = 1.0; @@ -97,6 +107,7 @@ shader node_image_texture(int use_mapping = 0, int compress_as_srgb = 0, int ignore_alpha = 0, int unassociate_alpha = 0, + int is_tiled = 0, int is_float = 1, output color Color = 0.0, output float Alpha = 1.0) @@ -115,6 +126,7 @@ shader node_image_texture(int use_mapping = 0, ignore_alpha, unassociate_alpha, is_float, + is_tiled, interpolation, extension); } @@ -193,6 +205,7 @@ shader node_image_texture(int use_mapping = 0, ignore_alpha, unassociate_alpha, is_float, + 0, interpolation, extension); Alpha += weight[0] * tmp_alpha; @@ -206,6 +219,7 @@ shader node_image_texture(int use_mapping = 0, ignore_alpha, unassociate_alpha, is_float, + 0, interpolation, extension); Alpha += weight[1] * tmp_alpha; @@ -219,6 +233,7 @@ shader node_image_texture(int use_mapping = 0, ignore_alpha, unassociate_alpha, is_float, + 0, interpolation, extension); Alpha += weight[2] * tmp_alpha; @@ -234,6 +249,7 @@ shader node_image_texture(int use_mapping = 0, ignore_alpha, unassociate_alpha, is_float, + 0, interpolation, extension); } @@ -247,6 +263,7 @@ shader node_image_texture(int use_mapping = 0, ignore_alpha, unassociate_alpha, is_float, + 0, interpolation, extension); } |