fix T40375 Glossy shader bakes different than render
Comments from Brecht Van Lommel: """ Currently the viewing direction for each pixel is set to the normal, so at every pixel glossy is evaluated as if you're looking straight at it. Blender Internal works the same. """ This patch makes baking glossy as viewed from the camera. Reviewers: brecht CC: zanqdo Differential Revision: https://developer.blender.org/D555
This commit is contained in:
@@ -175,12 +175,21 @@ ccl_device void kernel_bake_evaluate(KernelGlobals *kg, ccl_global uint4 *input,
|
||||
float time = TIME_INVALID;
|
||||
int bounce = 0;
|
||||
int transparent_bounce = 0;
|
||||
Transform cameratoworld = kernel_data.cam.cameratoworld;
|
||||
|
||||
/* light passes */
|
||||
PathRadiance L;
|
||||
|
||||
shader_setup_from_sample(kg, &sd, P, Ng, I, shader, object, prim, u, v, t, time, bounce, transparent_bounce);
|
||||
sd.I = sd.N;
|
||||
|
||||
if(kernel_data.cam.type == CAMERA_ORTHOGRAPHIC) {
|
||||
float3 camD = make_float3(cameratoworld.x.z, cameratoworld.y.z, cameratoworld.z.z);
|
||||
sd.I = -camD;
|
||||
}
|
||||
else {
|
||||
float3 camP = make_float3(cameratoworld.x.w, cameratoworld.y.w, cameratoworld.z.w);
|
||||
sd.I = normalize(camP - sd.P);
|
||||
}
|
||||
|
||||
/* update differentials */
|
||||
sd.dP.dx = sd.dPdu * dudx + sd.dPdv * dvdx;
|
||||
|
Reference in New Issue
Block a user