Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/shader/nodes/node_shader_bsdf_principled.c
| Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | static bNodeSocketTemplate sh_node_bsdf_principled_out[] = { | ||||
| { -1, 0, "" } | { -1, 0, "" } | ||||
| }; | }; | ||||
| static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node) | static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| node->custom1 = SHD_GLOSSY_MULTI_GGX; | node->custom1 = SHD_GLOSSY_MULTI_GGX; | ||||
| } | } | ||||
| static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | static int node_shader_gpu_bsdf_principled(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out) | ||||
| { | { | ||||
| #if 0 /* Old 2.7 glsl viewport */ | /* Base Color */ | ||||
| // normal | GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_VEC4, 0); | ||||
| if (!in[17].link) | |||||
| in[17].link = GPU_builtin(GPU_VIEW_NORMAL); | |||||
| else | |||||
| GPU_link(mat, "direction_transform_m4v3", in[17].link, GPU_builtin(GPU_VIEW_MATRIX), &in[17].link); | |||||
| // clearcoat normal | /* Subsurface */ | ||||
| if (!in[18].link) | GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 1); | ||||
| in[18].link = GPU_builtin(GPU_VIEW_NORMAL); | |||||
| else | /* Subsurface Radius */ | ||||
| GPU_link(mat, "direction_transform_m4v3", in[18].link, GPU_builtin(GPU_VIEW_MATRIX), &in[18].link); | GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_VEC3, 2); | ||||
| #endif | |||||
| /* Subsurface Color */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_VEC4, 3); | |||||
| /* Metallic */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 4); | |||||
| /* Specular */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 5); | |||||
| /* Specular Tint */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 6); | |||||
| /* Roughness */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 7); | |||||
| /* Anisotropic */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 8); | |||||
| /* Anisotropic Rotation */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 9); | |||||
| /* Sheen */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 10); | |||||
| /* Sheen Tint */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 11); | |||||
| /* Clearcoat */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 12); | |||||
| /* Clearcoat Roughness */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 13); | |||||
| /* IOR */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 14); | |||||
| /* Transmission */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 15); | |||||
| /* Transmission Roughness */ | |||||
| GPU_uniformbuffer_link_in(mat, &node->inputs, in, GPU_FLOAT, 16); | |||||
| /* Normals */ | /* Normals */ | ||||
| if (!in[17].link) { | if (!in[17].link) { | ||||
| GPU_link(mat, "world_normals_get", &in[17].link); | GPU_link(mat, "world_normals_get", &in[17].link); | ||||
| } | } | ||||
| /* Clearcoat Normals */ | /* Clearcoat Normals */ | ||||
| if (!in[18].link) { | if (!in[18].link) { | ||||
| ▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines | |||||