Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/shaders/node_anisotropic_bsdf.osl
- This file was moved from intern/cycles/kernel/shaders/node_ward_bsdf.osl.
| Show All 10 Lines | |||||
| * distributed under the License is distributed on an "AS IS" BASIS, | * distributed under the License is distributed on an "AS IS" BASIS, | ||||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| * 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 "stdosl.h" | #include "stdosl.h" | ||||
| shader node_ward_bsdf( | shader node_anisotropic_bsdf( | ||||
| color Color = 0.0, | color Color = 0.0, | ||||
| string distribution = "GGX", | |||||
| float Roughness = 0.0, | float Roughness = 0.0, | ||||
| float Anisotropy = 0.0, | float Anisotropy = 0.0, | ||||
| float Rotation = 0.0, | float Rotation = 0.0, | ||||
| normal Normal = N, | normal Normal = N, | ||||
| normal Tangent = normalize(dPdu), | normal Tangent = normalize(dPdu), | ||||
| output closure color BSDF = 0) | output closure color BSDF = 0) | ||||
| { | { | ||||
| /* rotate tangent around normal */ | /* rotate tangent around normal */ | ||||
| Show All 10 Lines | if (aniso < 0.0) { | ||||
| RoughnessU = Roughness / (1.0 + aniso); | RoughnessU = Roughness / (1.0 + aniso); | ||||
| RoughnessV = Roughness * (1.0 + aniso); | RoughnessV = Roughness * (1.0 + aniso); | ||||
| } | } | ||||
| else { | else { | ||||
| RoughnessU = Roughness * (1.0 - aniso); | RoughnessU = Roughness * (1.0 - aniso); | ||||
| RoughnessV = Roughness / (1.0 - aniso); | RoughnessV = Roughness / (1.0 - aniso); | ||||
| } | } | ||||
| BSDF = Color * ward(Normal, T, RoughnessU, RoughnessV); | if (distribution == "Sharp") | ||||
| BSDF = Color * reflection(Normal); | |||||
| else if (distribution == "Beckmann") | |||||
| BSDF = Color * microfacet_beckmann_aniso(Normal, T, RoughnessU, RoughnessV); | |||||
| else if (distribution == "GGX") | |||||
| BSDF = Color * microfacet_ggx_aniso(Normal, T, RoughnessU, RoughnessV); | |||||
| else | |||||
| BSDF = Color * ashikhmin_shirley(Normal, T, RoughnessU, RoughnessV); | |||||
| } | } | ||||