Fix cycles OSL wrong reflection texture coordinate.

This commit is contained in:
Brecht Van Lommel 2012-11-22 22:24:34 +00:00
parent ff94827965
commit a72c03bc1c
2 changed files with 5 additions and 3 deletions

@ -19,14 +19,16 @@
#include "stdosl.h"
#include "node_color.h"
vector environment_texture_direction_to_equirectangular(vector dir) {
vector environment_texture_direction_to_equirectangular(vector dir)
{
float u = -atan2(dir[1], dir[0])/(2.0*M_PI) + 0.5;
float v = atan2(dir[2], hypot(dir[0], dir[1]))/M_PI + 0.5;
return vector(u, v, 0.0);
}
vector environment_texture_direction_to_mirrorball(vector dir) {
vector environment_texture_direction_to_mirrorball(vector dir)
{
dir[1] -= 1.0;
float div = 2.0*sqrt(max(-0.5*dir[1], 0.0));

@ -56,7 +56,7 @@ shader node_texture_coordinate(
Camera = transform("camera", P);
Window = transform("NDC", P);
Normal = transform("world", "object", NormalIn);
Reflection = reflect(I, NormalIn);
Reflection = -reflect(I, NormalIn);
}
if (bump_offset == "dx") {