Blender V5.3
stdcycles.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009-2010 Sony Pictures Imageworks Inc., et al. All Rights Reserved.
2 * SPDX-FileCopyrightText: 2011-2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 *
6 * Adapted code from Open Shading Language. */
7
8#ifndef CCL_STDCYCLESOSL_H
9#define CCL_STDCYCLESOSL_H
10
11#include "stdosl.h"
12
13// Constants
14#define FLT_MAX 3.402823466e+38 // max value
15
16/* Default offset of coordinates for evaluating bump node. Unit in pixel. */
17#define BUMP_FILTER_WIDTH 0.1
18
19// Declaration of built-in functions and closures, stdosl.h does not make
20// these available so we have to redefine them.
21#define BUILTIN [[int builtin = 1]]
22#define BUILTIN_DERIV [[ int builtin = 1, int deriv = 1 ]]
23
24closure color diffuse_ramp(normal N, color colors[8]) BUILTIN;
25closure color phong_ramp(normal N, float exponent, color colors[8]) BUILTIN;
26closure color diffuse_toon(normal N, float size, float smooth) BUILTIN;
27closure color glossy_toon(normal N, float size, float smooth) BUILTIN;
28closure color ashikhmin_velvet(normal N, float sigma) BUILTIN;
29
30closure color microfacet_f82_tint(
31 string distribution, vector N, vector T, float ax, float ay, color f0, color f82) BUILTIN;
32
33/* Needed to pass along the color for multi-scattering saturation adjustment,
34 * otherwise could be replaced by microfacet() */
35closure color microfacet_multi_ggx_glass(normal N, float ag, float eta, color C) BUILTIN;
36closure color microfacet_multi_ggx_aniso(normal N, vector T, float ax, float ay, color C) BUILTIN;
37closure color thin_glass(normal N,
38 vector T,
39 color reflection,
40 color transmission,
41 float ior,
42 float alpha,
44 float thinfilm_ior) BUILTIN;
45closure color
46thin_subsurface(normal N, vector T, color C, float anisotropy, float roughness) BUILTIN;
47
48closure color coat_bsdf(color C, float ior, float roughness, normal N) BUILTIN;
49
50// BSSRDF
51closure color bssrdf(string method, normal N, vector radius, color albedo) BUILTIN;
52
53// Hair
54closure color
55hair_reflection(normal N, float roughnessu, float roughnessv, vector T, float offset) BUILTIN;
56closure color
57hair_transmission(normal N, float roughnessu, float roughnessv, vector T, float offset) BUILTIN;
58closure color hair_chiang(normal N,
59 color sigma,
60 float roughnessu,
61 float roughnessv,
62 float coat,
63 float alpha,
64 float eta) BUILTIN;
65closure color hair_huang(normal N,
66 color sigma,
67 float roughness,
68 float tilt,
69 float eta,
70 float aspect_ratio,
71 float r_lobe,
72 float tt_lobe,
73 float trt_lobe) BUILTIN;
74
75// Volume
76closure color henyey_greenstein(float g) BUILTIN;
77closure color fournier_forand(float B, float IOR) BUILTIN;
78closure color draine(float g, float alpha) BUILTIN;
79closure color rayleigh() BUILTIN;
80closure color absorption() BUILTIN;
81
82// Ray Portal
83closure color ray_portal_bsdf(vector position, vector direction) BUILTIN;
84
86{
87 return P;
88}
89
94
95/* Deprecated, should use `sheen_bsdf()` instead. Can remove in 6.0. */
96closure color sheen(normal N, float roughness)
97{
98 return sheen_bsdf(N, color(1.0), roughness);
99}
100
101#endif /* CCL_STDOSL_H */
#define C
Definition RandGen.cpp:29
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
nullptr thinfilm_thickness
#define position
#define smooth
#define N
#define T
#define B
closure color absorption() BUILTIN
closure color fournier_forand(float B, float IOR) BUILTIN
closure color phong_ramp(normal N, float exponent, color colors[8]) BUILTIN
closure color microfacet_multi_ggx_glass(normal N, float ag, float eta, color C) BUILTIN
closure color ray_portal_bsdf(vector position, vector direction) BUILTIN
closure color hair_chiang(normal N, color sigma, float roughnessu, float roughnessv, float coat, float alpha, float eta) BUILTIN
vector camera_shader_random_sample()
Definition stdcycles.h:90
closure color diffuse_toon(normal N, float size, float smooth) BUILTIN
closure color henyey_greenstein(float g) BUILTIN
#define BUILTIN
Definition stdcycles.h:21
closure color microfacet_multi_ggx_aniso(normal N, vector T, float ax, float ay, color C) BUILTIN
closure color hair_transmission(normal N, float roughnessu, float roughnessv, vector T, float offset) BUILTIN
closure color ashikhmin_velvet(normal N, float sigma) BUILTIN
closure color diffuse_ramp(normal N, color colors[8]) BUILTIN
closure color thin_glass(normal N, vector T, color reflection, color transmission, float ior, float alpha, float thinfilm_thickness, float thinfilm_ior) BUILTIN
closure color bssrdf(string method, normal N, vector radius, color albedo) BUILTIN
closure color hair_huang(normal N, color sigma, float roughness, float tilt, float eta, float aspect_ratio, float r_lobe, float tt_lobe, float trt_lobe) BUILTIN
point camera_shader_raster_position()
Definition stdcycles.h:85
closure color hair_reflection(normal N, float roughnessu, float roughnessv, vector T, float offset) BUILTIN
closure color microfacet_f82_tint(string distribution, vector N, vector T, float ax, float ay, color f0, color f82) BUILTIN
closure color coat_bsdf(color C, float ior, float roughness, normal N) BUILTIN
closure color thin_subsurface(normal N, vector T, color C, float anisotropy, float roughness) BUILTIN
closure color rayleigh() BUILTIN
closure color draine(float g, float alpha) BUILTIN
closure color sheen(normal N, float roughness)
Definition stdcycles.h:96
closure color glossy_toon(normal N, float size, float smooth) BUILTIN