Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/shaders/node_principled_bsdf.osl
| Show All 12 Lines | |||||
| * See the License for the specific language governing permissions and | * See the License for the specific language governing permissions and | ||||
| * limitations under the License. | * limitations under the License. | ||||
| */ | */ | ||||
| #include "node_fresnel.h" | #include "node_fresnel.h" | ||||
| #include "stdcycles.h" | #include "stdcycles.h" | ||||
| shader node_principled_bsdf(string distribution = "Multiscatter GGX", | shader node_principled_bsdf(string distribution = "Multiscatter GGX", | ||||
| string subsurface_method = "burley", | string subsurface_method = "random_walk", | ||||
| color BaseColor = color(0.8, 0.8, 0.8), | color BaseColor = color(0.8, 0.8, 0.8), | ||||
| float Subsurface = 0.0, | float Subsurface = 0.0, | ||||
| vector SubsurfaceRadius = vector(1.0, 1.0, 1.0), | vector SubsurfaceRadius = vector(1.0, 1.0, 1.0), | ||||
| color SubsurfaceColor = color(0.7, 0.1, 0.1), | color SubsurfaceColor = color(0.7, 0.1, 0.1), | ||||
| float SubsurfaceIOR = 1.4, | |||||
| float SubsurfaceAnisotropy = 0.0, | |||||
| float Metallic = 0.0, | float Metallic = 0.0, | ||||
| float Specular = 0.5, | float Specular = 0.5, | ||||
| float SpecularTint = 0.0, | float SpecularTint = 0.0, | ||||
| float Roughness = 0.5, | float Roughness = 0.5, | ||||
| float Anisotropic = 0.0, | float Anisotropic = 0.0, | ||||
| float AnisotropicRotation = 0.0, | float AnisotropicRotation = 0.0, | ||||
| float Sheen = 0.0, | float Sheen = 0.0, | ||||
| float SheenTint = 0.5, | float SheenTint = 0.5, | ||||
| Show All 20 Lines | shader node_principled_bsdf(string distribution = "Multiscatter GGX", | ||||
| /* rotate tangent */ | /* rotate tangent */ | ||||
| if (AnisotropicRotation != 0.0) | if (AnisotropicRotation != 0.0) | ||||
| T = rotate(T, AnisotropicRotation * M_2PI, point(0.0, 0.0, 0.0), Normal); | T = rotate(T, AnisotropicRotation * M_2PI, point(0.0, 0.0, 0.0), Normal); | ||||
| if (diffuse_weight > 1e-5) { | if (diffuse_weight > 1e-5) { | ||||
| if (Subsurface > 1e-5) { | if (Subsurface > 1e-5) { | ||||
| color mixed_ss_base_color = SubsurfaceColor * Subsurface + BaseColor * (1.0 - Subsurface); | color mixed_ss_base_color = SubsurfaceColor * Subsurface + BaseColor * (1.0 - Subsurface); | ||||
| if (subsurface_method == "burley") { | |||||
| BSDF = mixed_ss_base_color * bssrdf("principled", | BSDF = mixed_ss_base_color * bssrdf(subsurface_method, | ||||
| Normal, | |||||
| Subsurface * SubsurfaceRadius, | |||||
| SubsurfaceColor, | |||||
| "roughness", | |||||
| Roughness); | |||||
| } | |||||
| else { | |||||
| BSDF = mixed_ss_base_color * bssrdf("principled_random_walk", | |||||
| Normal, | Normal, | ||||
| Subsurface * SubsurfaceRadius, | Subsurface * SubsurfaceRadius, | ||||
| mixed_ss_base_color, | mixed_ss_base_color, | ||||
| "roughness", | "roughness", | ||||
| Roughness); | Roughness, | ||||
| } | "ior", | ||||
| SubsurfaceIOR, | |||||
| "anisotropy", | |||||
| SubsurfaceAnisotropy); | |||||
| } | } | ||||
| else { | else { | ||||
| BSDF = BaseColor * principled_diffuse(Normal, Roughness); | BSDF = BaseColor * principled_diffuse(Normal, Roughness); | ||||
| } | } | ||||
| if (Sheen > 1e-5) { | if (Sheen > 1e-5) { | ||||
| color sheen_color = color(1.0, 1.0, 1.0) * (1.0 - SheenTint) + m_ctint * SheenTint; | color sheen_color = color(1.0, 1.0, 1.0) * (1.0 - SheenTint) + m_ctint * SheenTint; | ||||
| ▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines | |||||