added vessel for disney diffuse shader
This commit is contained in:
@@ -539,6 +539,9 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
||||
else if(string_iequals(node.name(), "diffuse_bsdf")) {
|
||||
snode = new DiffuseBsdfNode();
|
||||
}
|
||||
/*else if(string_iequals(node.name(), "disney_bsdf")) {
|
||||
snode = new DisneyBsdfNode();
|
||||
}*/
|
||||
else if(string_iequals(node.name(), "translucent_bsdf")) {
|
||||
snode = new TranslucentBsdfNode();
|
||||
}
|
||||
|
||||
@@ -527,6 +527,9 @@ static ShaderNode *add_node(Scene *scene,
|
||||
}
|
||||
node = hair;
|
||||
}
|
||||
/*else if(b_node.is_a(&RNA_ShaderNodeBsdfDisney)) {
|
||||
node = new DisneyBsdfNode();
|
||||
}*/
|
||||
else if(b_node.is_a(&RNA_ShaderNodeBsdfTranslucent)) {
|
||||
node = new TranslucentBsdfNode();
|
||||
}
|
||||
|
||||
@@ -87,6 +87,7 @@ set(SRC_CLOSURE_HEADERS
|
||||
closure/bssrdf.h
|
||||
closure/emissive.h
|
||||
closure/volume.h
|
||||
closure/bsdf_disney_diffuse.h
|
||||
)
|
||||
|
||||
set(SRC_SVM_HEADERS
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include "../closure/bsdf_ashikhmin_shirley.h"
|
||||
#include "../closure/bsdf_toon.h"
|
||||
#include "../closure/bsdf_hair.h"
|
||||
#include "../closure/bsdf_disney_diffuse.h"
|
||||
#ifdef __SUBSURFACE__
|
||||
# include "../closure/bssrdf.h"
|
||||
#endif
|
||||
|
||||
89
intern/cycles/kernel/closure/bsdf_disney_diffuse.h
Normal file
89
intern/cycles/kernel/closure/bsdf_disney_diffuse.h
Normal file
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Adapted from Open Shading Language with this license:
|
||||
*
|
||||
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Modifications Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Sony Pictures Imageworks nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __BSDF_DISNEY_DIFFUSE_
|
||||
#define __BSDF_DISNEY_DIFFUSE_H__
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
/* DIFFUSE */
|
||||
|
||||
ccl_device int bsdf_disney_diffuse_setup(ShaderClosure *sc)
|
||||
{
|
||||
sc->type = CLOSURE_BSDF_DISNEY_DIFFUSE_ID;
|
||||
return SD_BSDF|SD_BSDF_HAS_EVAL;
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_disney_diffuse_eval_reflect(const ShaderClosure *sc,
|
||||
float3 color, const float3 I, const float3 omega_in, float *pdf)
|
||||
{
|
||||
float3 N = sc->N;
|
||||
|
||||
float cos_pi = fmaxf(dot(N, omega_in), 0.0f) * M_1_PI_F;
|
||||
*pdf = cos_pi;
|
||||
return make_float3(cos_pi * color[0], cos_pi * color[1], cos_pi * color[2]);
|
||||
}
|
||||
|
||||
ccl_device float3 bsdf_disney_diffuse_eval_transmit(const ShaderClosure *sc,
|
||||
float3 color, const float3 I, const float3 omega_in, float *pdf)
|
||||
{
|
||||
return make_float3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
ccl_device int bsdf_disney_diffuse_sample(const ShaderClosure *sc, float3 color,
|
||||
float3 Ng, float3 I, float3 dIdx, float3 dIdy, float randu, float randv,
|
||||
float3 *eval, float3 *omega_in, float3 *domega_in_dx,
|
||||
float3 *domega_in_dy, float *pdf)
|
||||
{
|
||||
float3 N = sc->N;
|
||||
|
||||
// distribution over the hemisphere
|
||||
sample_cos_hemisphere(N, randu, randv, omega_in, pdf);
|
||||
|
||||
if(dot(Ng, *omega_in) > 0.0f) {
|
||||
*eval = make_float3(*pdf * color[0], *pdf * color[1], *pdf * color[2]);
|
||||
#ifdef __RAY_DIFFERENTIALS__
|
||||
// TODO: find a better approximation for the diffuse bounce
|
||||
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
|
||||
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
*pdf = 0.0f;
|
||||
|
||||
return LABEL_REFLECT|LABEL_DIFFUSE;
|
||||
}
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
#endif /* __BSDF_DISNEY_DIFFUSE_H__ */
|
||||
|
||||
@@ -21,6 +21,7 @@ set(SRC
|
||||
osl_closures.cpp
|
||||
osl_services.cpp
|
||||
osl_shader.cpp
|
||||
bsdf_disney_diffuse.cpp
|
||||
)
|
||||
|
||||
set(HEADER_SRC
|
||||
|
||||
101
intern/cycles/kernel/osl/bsdf_disney_diffuse.cpp
Normal file
101
intern/cycles/kernel/osl/bsdf_disney_diffuse.cpp
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Adapted from Open Shading Language with this license:
|
||||
*
|
||||
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Modifications Copyright 2011, Blender Foundation.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Sony Pictures Imageworks nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <OpenImageIO/fmath.h>
|
||||
|
||||
#include <OSL/genclosure.h>
|
||||
|
||||
#include "kernel_compat_cpu.h"
|
||||
#include "osl_closures.h"
|
||||
|
||||
#include "kernel_types.h"
|
||||
#include "kernel_montecarlo.h"
|
||||
#include "closure/bsdf_disney_diffuse.h"
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
using namespace OSL;
|
||||
|
||||
class DisneyDiffuseClosure : public CBSDFClosure {
|
||||
public:
|
||||
float3 color;
|
||||
|
||||
DisneyDiffuseClosure() : CBSDFClosure(LABEL_DIFFUSE)
|
||||
{}
|
||||
|
||||
void setup()
|
||||
{
|
||||
sc.prim = this;
|
||||
m_shaderdata_flag = bsdf_disney_diffuse_setup(&sc);
|
||||
}
|
||||
|
||||
void blur(float roughness)
|
||||
{
|
||||
//bsdf_disney_diffuse_blur(&sc, roughness);
|
||||
}
|
||||
|
||||
float3 eval_reflect(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
{
|
||||
return bsdf_disney_diffuse_eval_reflect(&sc, color, omega_out, omega_in, &pdf);
|
||||
}
|
||||
|
||||
float3 eval_transmit(const float3 &omega_out, const float3 &omega_in, float& pdf) const
|
||||
{
|
||||
return bsdf_disney_diffuse_eval_transmit(&sc, color, omega_out, omega_in, &pdf);
|
||||
}
|
||||
|
||||
int sample(const float3 &Ng,
|
||||
const float3 &omega_out, const float3 &domega_out_dx, const float3 &domega_out_dy,
|
||||
float randu, float randv,
|
||||
float3 &omega_in, float3 &domega_in_dx, float3 &domega_in_dy,
|
||||
float &pdf, float3 &eval) const
|
||||
{
|
||||
return bsdf_disney_diffuse_sample(&sc, color, Ng, omega_out, domega_out_dx, domega_out_dy,
|
||||
randu, randv, &eval, &omega_in, &domega_in_dx, &domega_in_dy, &pdf);
|
||||
}
|
||||
};
|
||||
|
||||
ClosureParam *closure_bsdf_disney_diffuse_params()
|
||||
{
|
||||
static ClosureParam params[] = {
|
||||
CLOSURE_FLOAT3_PARAM(DisneyDiffuseClosure, sc.N),
|
||||
CLOSURE_FLOAT3_PARAM(DisneyDiffuseClosure, color),
|
||||
CLOSURE_STRING_KEYPARAM(DisneyDiffuseClosure, label, "label"),
|
||||
CLOSURE_FINISH_PARAM(DisneyDiffuseClosure)
|
||||
};
|
||||
return params;
|
||||
}
|
||||
|
||||
CCLOSURE_PREPARE(closure_bsdf_disney_diffuse_prepare, DisneyDiffuseClosure)
|
||||
|
||||
CCL_NAMESPACE_END
|
||||
|
||||
@@ -238,6 +238,8 @@ void OSLShader::register_closures(OSLShadingSystem *ss_)
|
||||
closure_bssrdf_gaussian_params(), closure_bssrdf_gaussian_prepare);
|
||||
register_closure(ss, "bssrdf_burley", id++,
|
||||
closure_bssrdf_burley_params(), closure_bssrdf_burley_prepare);
|
||||
register_closure(ss, "disney_diffuse", id++,
|
||||
closure_bsdf_disney_diffuse_params(), closure_bsdf_disney_diffuse_prepare);
|
||||
|
||||
register_closure(ss, "hair_reflection", id++,
|
||||
bsdf_hair_reflection_params(), bsdf_hair_reflection_prepare);
|
||||
|
||||
@@ -52,6 +52,7 @@ OSL::ClosureParam *closure_bssrdf_cubic_params();
|
||||
OSL::ClosureParam *closure_bssrdf_gaussian_params();
|
||||
OSL::ClosureParam *closure_bssrdf_burley_params();
|
||||
OSL::ClosureParam *closure_henyey_greenstein_volume_params();
|
||||
OSL::ClosureParam *closure_bsdf_disney_diffuse_params();
|
||||
|
||||
void closure_emission_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_background_prepare(OSL::RendererServices *, int id, void *data);
|
||||
@@ -63,6 +64,7 @@ void closure_bssrdf_cubic_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bssrdf_gaussian_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bssrdf_burley_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_henyey_greenstein_volume_prepare(OSL::RendererServices *, int id, void *data);
|
||||
void closure_bsdf_disney_diffuse_prepare(OSL::RendererServices *, int id, void *data);
|
||||
|
||||
#define CCLOSURE_PREPARE(name, classname) \
|
||||
void name(RendererServices *, int id, void *data) \
|
||||
|
||||
@@ -81,6 +81,7 @@ set(SRC_OSL
|
||||
node_wireframe.osl
|
||||
node_hair_bsdf.osl
|
||||
node_uv_map.osl
|
||||
#node_disney_bsdf.osl
|
||||
)
|
||||
|
||||
set(SRC_OSL_HEADERS
|
||||
|
||||
38
intern/cycles/kernel/shaders/node_disney_bsdf.osl
Normal file
38
intern/cycles/kernel/shaders/node_disney_bsdf.osl
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2011-2013 Blender Foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "stdosl.h"
|
||||
|
||||
shader node_disney_bsdf(
|
||||
color BaseColor = color(0.64555527, 0.41514809, 0.01698805),
|
||||
float Metallic = 0.0,
|
||||
float Subsurface = 0.0,
|
||||
float Specular = 0.5,
|
||||
float Roughness = 0.5,
|
||||
float SpecularTint = 0.0,
|
||||
float Anisotropic = 0.0,
|
||||
float Sheen = 0.0,
|
||||
float SheenTint = 0.5,
|
||||
float Clearcoat = 0.0,
|
||||
float ClearcoatGloss = 1.0,
|
||||
normal Normal = N,
|
||||
normal Tangent = normalize(dPdu),
|
||||
normal AnisotropicRotation = normal(0, 0, 0),
|
||||
output closure color BSDF = 0)
|
||||
{
|
||||
BSDF = disney_diffuse(Normal, BaseColor);
|
||||
}
|
||||
|
||||
@@ -536,6 +536,7 @@ closure color emission() BUILTIN;
|
||||
closure color background() BUILTIN;
|
||||
closure color holdout() BUILTIN;
|
||||
closure color ambient_occlusion() BUILTIN;
|
||||
closure color disney_diffuse(normal N, color c) BUILTIN;
|
||||
|
||||
// BSSRDF
|
||||
closure color bssrdf_cubic(normal N, vector radius, float texture_blur, float sharpness) BUILTIN;
|
||||
|
||||
@@ -377,6 +377,7 @@ typedef enum ClosureType {
|
||||
CLOSURE_BSDF_OREN_NAYAR_ID,
|
||||
CLOSURE_BSDF_DIFFUSE_RAMP_ID,
|
||||
CLOSURE_BSDF_DIFFUSE_TOON_ID,
|
||||
CLOSURE_BSDF_DISNEY_DIFFUSE_ID,
|
||||
|
||||
/* Glossy */
|
||||
CLOSURE_BSDF_GLOSSY_ID,
|
||||
|
||||
@@ -2067,6 +2067,12 @@ void DiffuseBsdfNode::compile(OSLCompiler& compiler)
|
||||
compiler.add(this, "node_diffuse_bsdf");
|
||||
}
|
||||
|
||||
/* Disney BSDF Closure */
|
||||
/*DisneyBsdfNode::DisneyBsdfNode()
|
||||
{
|
||||
closure = CLOSURE_BSDF_DISNEY_DIFFUSE_ID;
|
||||
}*/
|
||||
|
||||
/* Translucent BSDF Closure */
|
||||
|
||||
TranslucentBsdfNode::TranslucentBsdfNode()
|
||||
|
||||
@@ -410,6 +410,11 @@ public:
|
||||
SHADER_NODE_CLASS(DiffuseBsdfNode)
|
||||
};
|
||||
|
||||
/*class DisneyBsdfNode : public BsdfNode {
|
||||
public:
|
||||
SHADER_NODE_CLASS(DisneyBsdfNode)
|
||||
};*/
|
||||
|
||||
class TranslucentBsdfNode : public BsdfNode {
|
||||
public:
|
||||
SHADER_NODE_CLASS(TranslucentBsdfNode)
|
||||
|
||||
@@ -218,6 +218,7 @@ shader_node_categories = [
|
||||
NodeItem("ShaderNodeMixShader"),
|
||||
NodeItem("ShaderNodeAddShader"),
|
||||
NodeItem("ShaderNodeBsdfDiffuse", poll=object_shader_nodes_poll),
|
||||
#NodeItem("ShaderNodeBsdfDisney", poll=object_shader_nodes_poll),
|
||||
NodeItem("ShaderNodeBsdfGlossy", poll=object_shader_nodes_poll),
|
||||
NodeItem("ShaderNodeBsdfTransparent", poll=object_shader_nodes_poll),
|
||||
NodeItem("ShaderNodeBsdfRefraction", poll=object_shader_nodes_poll),
|
||||
|
||||
@@ -787,6 +787,7 @@ struct ShadeResult;
|
||||
#define SH_NODE_OUTPUT_LINESTYLE 190
|
||||
#define SH_NODE_UVALONGSTROKE 191
|
||||
#define SH_NODE_TEX_POINTDENSITY 192
|
||||
//#define SH_NODE_BSDF_DISNEY 193
|
||||
|
||||
/* custom defines options for Material node */
|
||||
#define SH_NODE_MAT_DIFF 1
|
||||
|
||||
@@ -3672,6 +3672,7 @@ static void registerShaderNodes(void)
|
||||
register_node_type_sh_background();
|
||||
register_node_type_sh_bsdf_anisotropic();
|
||||
register_node_type_sh_bsdf_diffuse();
|
||||
//register_node_type_sh_bsdf_disney();
|
||||
register_node_type_sh_bsdf_glossy();
|
||||
register_node_type_sh_bsdf_glass();
|
||||
register_node_type_sh_bsdf_translucent();
|
||||
|
||||
@@ -2369,6 +2369,13 @@ void node_bsdf_toon(vec4 color, float size, float tsmooth, vec3 N, out vec4 resu
|
||||
node_bsdf_diffuse(color, 0.0, N, result);
|
||||
}
|
||||
|
||||
/*void node_bsdf_disney(vec4 baseColor, float metallic, float subsurface, float specular, float roughness,
|
||||
float specularTint, float anisotropic, float sheen, float sheenTint, float clearcoat,
|
||||
float clearcoatGloss, vec3 N, vec3 T, vec3 anisotropicRotation, out vec4 result)
|
||||
{
|
||||
node_bsdf_diffuse(baseColor, roughness, N, result);
|
||||
}*/
|
||||
|
||||
void node_bsdf_translucent(vec4 color, vec3 N, out vec4 result)
|
||||
{
|
||||
node_bsdf_diffuse(color, 0.0, N, result);
|
||||
|
||||
@@ -163,6 +163,7 @@ set(SRC
|
||||
shader/nodes/node_shader_background.c
|
||||
shader/nodes/node_shader_bsdf_anisotropic.c
|
||||
shader/nodes/node_shader_bsdf_diffuse.c
|
||||
#shader/nodes/node_shader_bsdf_disney.c
|
||||
shader/nodes/node_shader_bsdf_glass.c
|
||||
shader/nodes/node_shader_bsdf_glossy.c
|
||||
shader/nodes/node_shader_bsdf_toon.c
|
||||
|
||||
@@ -106,6 +106,7 @@ void register_node_type_sh_bsdf_transparent(void);
|
||||
void register_node_type_sh_bsdf_velvet(void);
|
||||
void register_node_type_sh_bsdf_toon(void);
|
||||
void register_node_type_sh_bsdf_anisotropic(void);
|
||||
//void register_node_type_sh_bsdf_disney(void);
|
||||
void register_node_type_sh_emission(void);
|
||||
void register_node_type_sh_holdout(void);
|
||||
void register_node_type_sh_volume_absorption(void);
|
||||
|
||||
@@ -80,6 +80,7 @@ DefNode( ShaderNode, SH_NODE_BACKGROUND, 0, "BA
|
||||
DefNode( ShaderNode, SH_NODE_HOLDOUT, 0, "HOLDOUT", Holdout, "Holdout", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_ANISOTROPIC, def_anisotropic, "BSDF_ANISOTROPIC", BsdfAnisotropic, "Anisotropic BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_DIFFUSE, 0, "BSDF_DIFFUSE", BsdfDiffuse, "Diffuse BSDF", "" )
|
||||
//DefNode( ShaderNode, SH_NODE_BSDF_DISNEY, 0, "BSDF_DISNEY", BsdfDisney, "Disney BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_GLOSSY, def_glossy, "BSDF_GLOSSY", BsdfGlossy, "Glossy BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glass, "BSDF_GLASS", BsdfGlass, "Glass BSDF", "" )
|
||||
DefNode( ShaderNode, SH_NODE_BSDF_REFRACTION, def_glass, "BSDF_REFRACTION", BsdfRefraction, "Refraction BSDF", "" )
|
||||
|
||||
78
source/blender/nodes/shader/nodes/node_shader_bsdf_disney.c
Normal file
78
source/blender/nodes/shader/nodes/node_shader_bsdf_disney.c
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* ***** BEGIN GPL LICENSE BLOCK *****
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* The Original Code is Copyright (C) 2005 Blender Foundation.
|
||||
* All rights reserved.
|
||||
*
|
||||
* The Original Code is: all of this file.
|
||||
*
|
||||
* Contributor(s): none yet.
|
||||
*
|
||||
* ***** END GPL LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
#include "../node_shader_util.h"
|
||||
|
||||
/* **************** OUTPUT ******************** */
|
||||
|
||||
static bNodeSocketTemplate sh_node_bsdf_disney_in[] = {
|
||||
{ SOCK_RGBA, 1, N_("BaseColor"), 0.64555527f, 0.41514809f, 0.01698805f, 1.0f, 0.0f, 1.0f},
|
||||
{ SOCK_FLOAT, 1, N_("Metallic"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_FLOAT, 1, N_("Subsurface"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_FLOAT, 1, N_("Specular"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_FLOAT, 1, N_("Roughness"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_FLOAT, 1, N_("SpecularTint"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_FLOAT, 1, N_("Anisotropic"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_FLOAT, 1, N_("Sheen"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_FLOAT, 1, N_("SheenTint"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_FLOAT, 1, N_("Clearcoat"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_FLOAT, 1, N_("ClearcoatGloss"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
|
||||
{ SOCK_VECTOR, 1, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
|
||||
{ SOCK_VECTOR, 1, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
|
||||
{ SOCK_VECTOR, 1, N_("AnisotropicRotation"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static bNodeSocketTemplate sh_node_bsdf_disney_out[] = {
|
||||
{ SOCK_SHADER, 0, N_("BSDF")},
|
||||
{ -1, 0, "" }
|
||||
};
|
||||
|
||||
static int node_shader_gpu_bsdf_disney(GPUMaterial *mat, bNode *UNUSED(node), bNodeExecData *UNUSED(execdata), GPUNodeStack *in, GPUNodeStack *out)
|
||||
{
|
||||
if (!in[11].link)
|
||||
in[11].link = GPU_builtin(GPU_VIEW_NORMAL);
|
||||
else
|
||||
GPU_link(mat, "direction_transform_m4v3", in[11].link, GPU_builtin(GPU_VIEW_MATRIX), &in[11].link);
|
||||
|
||||
return GPU_stack_link(mat, "node_bsdf_disney", in, out);
|
||||
}
|
||||
|
||||
/* node type definition */
|
||||
void register_node_type_sh_bsdf_disney(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
sh_node_type_base(&ntype, SH_NODE_BSDF_DISNEY, "Disney BSDF", NODE_CLASS_SHADER, 0);
|
||||
node_type_compatibility(&ntype, NODE_NEW_SHADING);
|
||||
node_type_socket_templates(&ntype, sh_node_bsdf_disney_in, sh_node_bsdf_disney_out);
|
||||
node_type_init(&ntype, NULL);
|
||||
node_type_storage(&ntype, "", NULL, NULL);
|
||||
node_type_gpu(&ntype, node_shader_gpu_bsdf_disney);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
Reference in New Issue
Block a user