mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Fix T103615: OSL image box mapping has flipped textures
This breaks backwards compatibility some in that 3 sides will be mapped differently now, but difficult to avoid and can be considered a bugfix. Similar to rBdd8016f7081f. Maniphest Tasks: T103615 Differential Revision: https://developer.blender.org/D16910
This commit is contained in:
parent
6aacbdd716
commit
6191b726aa
1 changed files with 10 additions and 6 deletions
|
|
@ -122,6 +122,7 @@ shader node_image_texture(int use_mapping = 0,
|
|||
vector Nob = transform("world", "object", N);
|
||||
|
||||
/* project from direction vector to barycentric coordinates in triangles */
|
||||
vector signed_Nob = Nob;
|
||||
Nob = vector(fabs(Nob[0]), fabs(Nob[1]), fabs(Nob[2]));
|
||||
Nob /= (Nob[0] + Nob[1] + Nob[2]);
|
||||
|
||||
|
|
@ -184,9 +185,10 @@ shader node_image_texture(int use_mapping = 0,
|
|||
float tmp_alpha;
|
||||
|
||||
if (weight[0] > 0.0) {
|
||||
point UV = point((signed_Nob[0] < 0.0) ? 1.0 - p[1] : p[1], p[2], 0.0);
|
||||
Color += weight[0] * image_texture_lookup(filename,
|
||||
p[1],
|
||||
p[2],
|
||||
UV[0],
|
||||
UV[1],
|
||||
tmp_alpha,
|
||||
compress_as_srgb,
|
||||
ignore_alpha,
|
||||
|
|
@ -198,9 +200,10 @@ shader node_image_texture(int use_mapping = 0,
|
|||
Alpha += weight[0] * tmp_alpha;
|
||||
}
|
||||
if (weight[1] > 0.0) {
|
||||
point UV = point((signed_Nob[1] > 0.0) ? 1.0 - p[0] : p[0], p[2], 0.0);
|
||||
Color += weight[1] * image_texture_lookup(filename,
|
||||
p[0],
|
||||
p[2],
|
||||
UV[0],
|
||||
UV[1],
|
||||
tmp_alpha,
|
||||
compress_as_srgb,
|
||||
ignore_alpha,
|
||||
|
|
@ -212,9 +215,10 @@ shader node_image_texture(int use_mapping = 0,
|
|||
Alpha += weight[1] * tmp_alpha;
|
||||
}
|
||||
if (weight[2] > 0.0) {
|
||||
point UV = point((signed_Nob[2] > 0.0) ? 1.0 - p[1] : p[1], p[0], 0.0);
|
||||
Color += weight[2] * image_texture_lookup(filename,
|
||||
p[1],
|
||||
p[0],
|
||||
UV[0],
|
||||
UV[1],
|
||||
tmp_alpha,
|
||||
compress_as_srgb,
|
||||
ignore_alpha,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue