Cycles: add some volume nodes, they don't actually do anything, this is just
to give other developers who may want to work on this to get a starting point.
This commit is contained in:
@@ -435,6 +435,12 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
|
|||||||
else if(string_iequals(node.name(), "background")) {
|
else if(string_iequals(node.name(), "background")) {
|
||||||
snode = new BackgroundNode();
|
snode = new BackgroundNode();
|
||||||
}
|
}
|
||||||
|
else if(string_iequals(node.name(), "transparent_volume")) {
|
||||||
|
snode = new TransparentVolumeNode();
|
||||||
|
}
|
||||||
|
else if(string_iequals(node.name(), "isotropic_volume")) {
|
||||||
|
snode = new IsotropicVolumeNode();
|
||||||
|
}
|
||||||
else if(string_iequals(node.name(), "geometry")) {
|
else if(string_iequals(node.name(), "geometry")) {
|
||||||
snode = new GeometryNode();
|
snode = new GeometryNode();
|
||||||
}
|
}
|
||||||
|
@@ -275,6 +275,14 @@ static ShaderNode *add_node(BL::BlendData b_data, ShaderGraph *graph, BL::Node *
|
|||||||
node = new EmissionNode();
|
node = new EmissionNode();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case BL::ShaderNode::type_VOLUME_ISOTROPIC: {
|
||||||
|
node = new IsotropicVolumeNode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BL::ShaderNode::type_VOLUME_TRANSPARENT: {
|
||||||
|
node = new TransparentVolumeNode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
case BL::ShaderNode::type_GEOMETRY: {
|
case BL::ShaderNode::type_GEOMETRY: {
|
||||||
node = new GeometryNode();
|
node = new GeometryNode();
|
||||||
break;
|
break;
|
||||||
|
@@ -218,7 +218,8 @@ enum ShaderDataFlag {
|
|||||||
SD_BSDF = 4, /* have bsdf closure? */
|
SD_BSDF = 4, /* have bsdf closure? */
|
||||||
SD_BSDF_HAS_EVAL = 8, /* have non-singular bsdf closure? */
|
SD_BSDF_HAS_EVAL = 8, /* have non-singular bsdf closure? */
|
||||||
SD_BSDF_GLOSSY = 16, /* have glossy bsdf */
|
SD_BSDF_GLOSSY = 16, /* have glossy bsdf */
|
||||||
SD_HOLDOUT = 32 /* have holdout closure? */
|
SD_HOLDOUT = 32, /* have holdout closure? */
|
||||||
|
SD_VOLUME = 64 /* have volume closure? */
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct ShaderData {
|
typedef struct ShaderData {
|
||||||
|
@@ -184,6 +184,9 @@ __device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ShaderT
|
|||||||
case NODE_CLOSURE_HOLDOUT:
|
case NODE_CLOSURE_HOLDOUT:
|
||||||
svm_node_closure_holdout(sd, stack, node);
|
svm_node_closure_holdout(sd, stack, node);
|
||||||
break;
|
break;
|
||||||
|
case NODE_CLOSURE_VOLUME:
|
||||||
|
svm_node_closure_volume(kg, sd, stack, node, path_flag);
|
||||||
|
break;
|
||||||
case NODE_CLOSURE_SET_WEIGHT:
|
case NODE_CLOSURE_SET_WEIGHT:
|
||||||
svm_node_closure_set_weight(sd, node.y, node.z, node.w);
|
svm_node_closure_set_weight(sd, node.y, node.z, node.w);
|
||||||
break;
|
break;
|
||||||
|
@@ -192,6 +192,47 @@ __device void svm_node_closure_bsdf(KernelGlobals *kg, ShaderData *sd, float *st
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__device void svm_node_closure_volume(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node, int path_flag)
|
||||||
|
{
|
||||||
|
uint type, param1_offset, param2_offset;
|
||||||
|
|
||||||
|
#ifdef __MULTI_CLOSURE__
|
||||||
|
uint mix_weight_offset;
|
||||||
|
decode_node_uchar4(node.y, &type, ¶m1_offset, ¶m2_offset, &mix_weight_offset);
|
||||||
|
float mix_weight = (stack_valid(mix_weight_offset)? stack_load_float(stack, mix_weight_offset): 1.0f);
|
||||||
|
|
||||||
|
if(mix_weight == 0.0f)
|
||||||
|
return;
|
||||||
|
#else
|
||||||
|
decode_node_uchar4(node.y, &type, ¶m1_offset, ¶m2_offset, NULL);
|
||||||
|
float mix_weight = 1.0f;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float param1 = (stack_valid(param1_offset))? stack_load_float(stack, param1_offset): __int_as_float(node.z);
|
||||||
|
//float param2 = (stack_valid(param2_offset))? stack_load_float(stack, param2_offset): __int_as_float(node.w);
|
||||||
|
|
||||||
|
switch(type) {
|
||||||
|
case CLOSURE_VOLUME_TRANSPARENT_ID: {
|
||||||
|
ShaderClosure *sc = svm_node_closure_get(sd);
|
||||||
|
svm_node_closure_set_mix_weight(sc, mix_weight);
|
||||||
|
|
||||||
|
float density = param1;
|
||||||
|
volume_transparent_setup(sd, sc, density);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case CLOSURE_VOLUME_ISOTROPIC_ID: {
|
||||||
|
ShaderClosure *sc = svm_node_closure_get(sd);
|
||||||
|
svm_node_closure_set_mix_weight(sc, mix_weight);
|
||||||
|
|
||||||
|
float density = param1;
|
||||||
|
volume_isotropic_setup(sd, sc, density);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
__device void svm_node_closure_emission(ShaderData *sd, float *stack, uint4 node)
|
__device void svm_node_closure_emission(ShaderData *sd, float *stack, uint4 node)
|
||||||
{
|
{
|
||||||
#ifdef __MULTI_CLOSURE__
|
#ifdef __MULTI_CLOSURE__
|
||||||
|
@@ -83,7 +83,8 @@ typedef enum NodeType {
|
|||||||
NODE_ATTR_BUMP_DY = 4500,
|
NODE_ATTR_BUMP_DY = 4500,
|
||||||
NODE_TEX_ENVIRONMENT = 4600,
|
NODE_TEX_ENVIRONMENT = 4600,
|
||||||
NODE_CLOSURE_HOLDOUT = 4700,
|
NODE_CLOSURE_HOLDOUT = 4700,
|
||||||
NODE_BLEND_WEIGHT = 4800
|
NODE_BLEND_WEIGHT = 4800,
|
||||||
|
NODE_CLOSURE_VOLUME = 4900
|
||||||
} NodeType;
|
} NodeType;
|
||||||
|
|
||||||
typedef enum NodeAttributeType {
|
typedef enum NodeAttributeType {
|
||||||
@@ -286,14 +287,17 @@ typedef enum ClosureType {
|
|||||||
CLOSURE_BACKGROUND_ID,
|
CLOSURE_BACKGROUND_ID,
|
||||||
CLOSURE_HOLDOUT_ID,
|
CLOSURE_HOLDOUT_ID,
|
||||||
CLOSURE_SUBSURFACE_ID,
|
CLOSURE_SUBSURFACE_ID,
|
||||||
|
|
||||||
CLOSURE_VOLUME_ID,
|
CLOSURE_VOLUME_ID,
|
||||||
|
CLOSURE_VOLUME_TRANSPARENT_ID,
|
||||||
|
CLOSURE_VOLUME_ISOTROPIC_ID,
|
||||||
|
|
||||||
NBUILTIN_CLOSURES
|
NBUILTIN_CLOSURES
|
||||||
} ClosureType;
|
} ClosureType;
|
||||||
|
|
||||||
/* watch this, being lazy with memory usage */
|
/* watch this, being lazy with memory usage */
|
||||||
#define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
|
#define CLOSURE_IS_BSDF(type) (type <= CLOSURE_BSDF_WESTIN_SHEEN_ID)
|
||||||
#define CLOSURE_IS_VOLUME(type) (type == CLOSURE_VOLUME_ID)
|
#define CLOSURE_IS_VOLUME(type) (type >= CLOSURE_VOLUME_ID && type <= CLOSURE_VOLUME_ISOTROPIC_ID)
|
||||||
#define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
|
#define CLOSURE_IS_EMISSION(type) (type == CLOSURE_EMISSION_ID)
|
||||||
#define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
|
#define CLOSURE_IS_HOLDOUT(type) (type == CLOSURE_HOLDOUT_ID)
|
||||||
#define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
|
#define CLOSURE_IS_BACKGROUND(type) (type == CLOSURE_BACKGROUND_ID)
|
||||||
|
@@ -1,42 +1,73 @@
|
|||||||
/*
|
/*
|
||||||
* Adapted from Open Shading Language with this license:
|
* Copyright 2011, Blender Foundation.
|
||||||
*
|
*
|
||||||
* Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
|
* This program is free software; you can redistribute it and/or
|
||||||
* All Rights Reserved.
|
* 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.
|
||||||
*
|
*
|
||||||
* Modifications Copyright 2011, Blender Foundation.
|
* 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.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* You should have received a copy of the GNU General Public License
|
||||||
* modification, are permitted provided that the following conditions are
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
* met:
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* * 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
CCL_NAMESPACE_BEGIN
|
CCL_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
/* note: the interfaces here are just as an example, need to figure
|
||||||
|
out the right functions and parameters to use */
|
||||||
|
|
||||||
|
/* ISOTROPIC VOLUME CLOSURE */
|
||||||
|
|
||||||
|
__device void volume_isotropic_setup(ShaderData *sd, ShaderClosure *sc, float density)
|
||||||
|
{
|
||||||
|
sc->type = CLOSURE_VOLUME_ISOTROPIC_ID;
|
||||||
|
sd->flag |= SD_VOLUME;
|
||||||
|
sc->data0 = density;
|
||||||
|
}
|
||||||
|
|
||||||
|
__device float3 volume_isotropic_eval_phase(const ShaderData *sd, const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
|
||||||
|
{
|
||||||
|
return make_float3(1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TRANSPARENT VOLUME CLOSURE */
|
||||||
|
|
||||||
|
__device void volume_transparent_setup(ShaderData *sd, ShaderClosure *sc, float density)
|
||||||
|
{
|
||||||
|
sc->type = CLOSURE_VOLUME_TRANSPARENT_ID;
|
||||||
|
sd->flag |= SD_VOLUME;
|
||||||
|
sc->data0 = density;
|
||||||
|
}
|
||||||
|
|
||||||
|
__device float3 volume_transparent_eval_phase(const ShaderData *sd, const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
|
||||||
|
{
|
||||||
|
return make_float3(1.0f, 1.0f, 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
/* VOLUME CLOSURE */
|
/* VOLUME CLOSURE */
|
||||||
|
|
||||||
__device float3 volume_eval_phase(const ShaderData *sd, const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
|
__device float3 volume_eval_phase(const ShaderData *sd, const ShaderClosure *sc, const float3 omega_in, const float3 omega_out)
|
||||||
{
|
{
|
||||||
return make_float3(1.0f, 1.0f, 1.0f);
|
float3 eval;
|
||||||
|
|
||||||
|
switch(sc->type) {
|
||||||
|
case CLOSURE_VOLUME_ISOTROPIC_ID:
|
||||||
|
eval = volume_isotropic_eval_phase(sd, sc, omega_in, omega_out);
|
||||||
|
break;
|
||||||
|
case CLOSURE_VOLUME_TRANSPARENT_ID:
|
||||||
|
eval = volume_transparent_eval_phase(sd, sc, omega_in, omega_out);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
eval = make_float3(0.0f, 0.0f, 0.0f);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return eval;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCL_NAMESPACE_END
|
CCL_NAMESPACE_END
|
||||||
|
@@ -1312,6 +1312,88 @@ void HoldoutNode::compile(OSLCompiler& compiler)
|
|||||||
compiler.add(this, "node_holdout");
|
compiler.add(this, "node_holdout");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Volume Closure */
|
||||||
|
|
||||||
|
VolumeNode::VolumeNode()
|
||||||
|
: ShaderNode("volume")
|
||||||
|
{
|
||||||
|
closure = ccl::CLOSURE_VOLUME_ISOTROPIC_ID;
|
||||||
|
|
||||||
|
add_input("Color", SHADER_SOCKET_COLOR, make_float3(0.8f, 0.8f, 0.8f));
|
||||||
|
add_input("Density", SHADER_SOCKET_FLOAT, 1.0f);
|
||||||
|
|
||||||
|
add_output("Volume", SHADER_SOCKET_CLOSURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VolumeNode::compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2)
|
||||||
|
{
|
||||||
|
ShaderInput *color_in = input("Color");
|
||||||
|
|
||||||
|
if(color_in->link) {
|
||||||
|
compiler.stack_assign(color_in);
|
||||||
|
compiler.add_node(NODE_CLOSURE_WEIGHT, color_in->stack_offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
compiler.add_node(NODE_CLOSURE_SET_WEIGHT, color_in->value);
|
||||||
|
|
||||||
|
if(param1)
|
||||||
|
compiler.stack_assign(param1);
|
||||||
|
if(param2)
|
||||||
|
compiler.stack_assign(param2);
|
||||||
|
|
||||||
|
compiler.add_node(NODE_CLOSURE_VOLUME,
|
||||||
|
compiler.encode_uchar4(closure,
|
||||||
|
(param1)? param1->stack_offset: SVM_STACK_INVALID,
|
||||||
|
(param2)? param2->stack_offset: SVM_STACK_INVALID,
|
||||||
|
compiler.closure_mix_weight_offset()),
|
||||||
|
__float_as_int((param1)? param1->value.x: 0.0f),
|
||||||
|
__float_as_int((param2)? param2->value.x: 0.0f));
|
||||||
|
}
|
||||||
|
|
||||||
|
void VolumeNode::compile(SVMCompiler& compiler)
|
||||||
|
{
|
||||||
|
compile(compiler, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void VolumeNode::compile(OSLCompiler& compiler)
|
||||||
|
{
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Transparent Volume Closure */
|
||||||
|
|
||||||
|
TransparentVolumeNode::TransparentVolumeNode()
|
||||||
|
{
|
||||||
|
closure = CLOSURE_VOLUME_TRANSPARENT_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransparentVolumeNode::compile(SVMCompiler& compiler)
|
||||||
|
{
|
||||||
|
VolumeNode::compile(compiler, input("Density"), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TransparentVolumeNode::compile(OSLCompiler& compiler)
|
||||||
|
{
|
||||||
|
compiler.add(this, "node_isotropic_volume");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Isotropic Volume Closure */
|
||||||
|
|
||||||
|
IsotropicVolumeNode::IsotropicVolumeNode()
|
||||||
|
{
|
||||||
|
closure = CLOSURE_VOLUME_ISOTROPIC_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
void IsotropicVolumeNode::compile(SVMCompiler& compiler)
|
||||||
|
{
|
||||||
|
VolumeNode::compile(compiler, input("Density"), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void IsotropicVolumeNode::compile(OSLCompiler& compiler)
|
||||||
|
{
|
||||||
|
compiler.add(this, "node_isotropic_volume");
|
||||||
|
}
|
||||||
|
|
||||||
/* Geometry */
|
/* Geometry */
|
||||||
|
|
||||||
GeometryNode::GeometryNode()
|
GeometryNode::GeometryNode()
|
||||||
|
@@ -262,6 +262,25 @@ public:
|
|||||||
SHADER_NODE_CLASS(HoldoutNode)
|
SHADER_NODE_CLASS(HoldoutNode)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class VolumeNode : public ShaderNode {
|
||||||
|
public:
|
||||||
|
SHADER_NODE_CLASS(VolumeNode)
|
||||||
|
|
||||||
|
void compile(SVMCompiler& compiler, ShaderInput *param1, ShaderInput *param2);
|
||||||
|
|
||||||
|
ClosureType closure;
|
||||||
|
};
|
||||||
|
|
||||||
|
class TransparentVolumeNode : public VolumeNode {
|
||||||
|
public:
|
||||||
|
SHADER_NODE_CLASS(TransparentVolumeNode)
|
||||||
|
};
|
||||||
|
|
||||||
|
class IsotropicVolumeNode : public VolumeNode {
|
||||||
|
public:
|
||||||
|
SHADER_NODE_CLASS(IsotropicVolumeNode)
|
||||||
|
};
|
||||||
|
|
||||||
class GeometryNode : public ShaderNode {
|
class GeometryNode : public ShaderNode {
|
||||||
public:
|
public:
|
||||||
SHADER_NODE_CLASS(GeometryNode)
|
SHADER_NODE_CLASS(GeometryNode)
|
||||||
|
@@ -488,6 +488,8 @@ struct ShadeResult;
|
|||||||
#define SH_NODE_OUTPUT_TEXTURE 158
|
#define SH_NODE_OUTPUT_TEXTURE 158
|
||||||
#define SH_NODE_HOLDOUT 159
|
#define SH_NODE_HOLDOUT 159
|
||||||
#define SH_NODE_BLEND_WEIGHT 160
|
#define SH_NODE_BLEND_WEIGHT 160
|
||||||
|
#define SH_NODE_VOLUME_TRANSPARENT 161
|
||||||
|
#define SH_NODE_VOLUME_ISOTROPIC 162
|
||||||
|
|
||||||
/* custom defines options for Material node */
|
/* custom defines options for Material node */
|
||||||
#define SH_NODE_MAT_DIFF 1
|
#define SH_NODE_MAT_DIFF 1
|
||||||
|
@@ -1886,9 +1886,11 @@ static void registerShaderNodes(ListBase *ntypelist)
|
|||||||
register_node_type_sh_bsdf_transparent(ntypelist);
|
register_node_type_sh_bsdf_transparent(ntypelist);
|
||||||
register_node_type_sh_bsdf_velvet(ntypelist);
|
register_node_type_sh_bsdf_velvet(ntypelist);
|
||||||
register_node_type_sh_emission(ntypelist);
|
register_node_type_sh_emission(ntypelist);
|
||||||
|
register_node_type_sh_volume_transparent(ntypelist);
|
||||||
|
register_node_type_sh_volume_isotropic(ntypelist);
|
||||||
|
register_node_type_sh_holdout(ntypelist);
|
||||||
register_node_type_sh_mix_shader(ntypelist);
|
register_node_type_sh_mix_shader(ntypelist);
|
||||||
register_node_type_sh_add_shader(ntypelist);
|
register_node_type_sh_add_shader(ntypelist);
|
||||||
register_node_type_sh_holdout(ntypelist);
|
|
||||||
|
|
||||||
register_node_type_sh_output_lamp(ntypelist);
|
register_node_type_sh_output_lamp(ntypelist);
|
||||||
register_node_type_sh_output_material(ntypelist);
|
register_node_type_sh_output_material(ntypelist);
|
||||||
|
@@ -74,6 +74,8 @@ DefNode( ShaderNode, SH_NODE_BSDF_GLASS, def_glossy, "BSDF_GLASS", BsdfGlass
|
|||||||
DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent Bsdf", "")
|
DefNode( ShaderNode, SH_NODE_BSDF_TRANSLUCENT, 0, "BSDF_TRANSLUCENT", BsdfTranslucent, "Translucent Bsdf", "")
|
||||||
DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent Bsdf", "")
|
DefNode( ShaderNode, SH_NODE_BSDF_TRANSPARENT, 0, "BSDF_TRANSPARENT", BsdfTransparent, "Transparent Bsdf", "")
|
||||||
DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet Bsdf", "")
|
DefNode( ShaderNode, SH_NODE_BSDF_VELVET, 0, "BSDF_VELVET", BsdfVelvet, "Velvet Bsdf", "")
|
||||||
|
DefNode( ShaderNode, SH_NODE_VOLUME_TRANSPARENT, 0, "VOLUME_TRANSPARENT", VolumeTransparent, "Transparent Volume", "")
|
||||||
|
DefNode( ShaderNode, SH_NODE_VOLUME_ISOTROPIC, 0, "VOLUME_ISOTROPIC", VolumeIsotropic, "Isotropic Volume", "")
|
||||||
DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "")
|
DefNode( ShaderNode, SH_NODE_EMISSION, 0, "EMISSION", Emission, "Emission", "")
|
||||||
DefNode( ShaderNode, SH_NODE_GEOMETRY, 0, "GEOMETRY", Geometry, "Geometry", "")
|
DefNode( ShaderNode, SH_NODE_GEOMETRY, 0, "GEOMETRY", Geometry, "Geometry", "")
|
||||||
DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", Light_path, "Light_path", "")
|
DefNode( ShaderNode, SH_NODE_LIGHT_PATH, 0, "LIGHT_PATH", Light_path, "Light_path", "")
|
||||||
|
@@ -138,6 +138,8 @@ set(SRC
|
|||||||
shader/nodes/node_shader_blend_weight.c
|
shader/nodes/node_shader_blend_weight.c
|
||||||
shader/nodes/node_shader_geometry.c
|
shader/nodes/node_shader_geometry.c
|
||||||
shader/nodes/node_shader_holdout.c
|
shader/nodes/node_shader_holdout.c
|
||||||
|
shader/nodes/node_shader_volume_transparent.c
|
||||||
|
shader/nodes/node_shader_volume_isotropic.c
|
||||||
shader/nodes/node_shader_light_path.c
|
shader/nodes/node_shader_light_path.c
|
||||||
shader/nodes/node_shader_mix_shader.c
|
shader/nodes/node_shader_mix_shader.c
|
||||||
shader/nodes/node_shader_add_shader.c
|
shader/nodes/node_shader_add_shader.c
|
||||||
|
@@ -75,6 +75,8 @@ void register_node_type_sh_bsdf_transparent(ListBase *lb);
|
|||||||
void register_node_type_sh_bsdf_velvet(ListBase *lb);
|
void register_node_type_sh_bsdf_velvet(ListBase *lb);
|
||||||
void register_node_type_sh_emission(ListBase *lb);
|
void register_node_type_sh_emission(ListBase *lb);
|
||||||
void register_node_type_sh_holdout(ListBase *lb);
|
void register_node_type_sh_holdout(ListBase *lb);
|
||||||
|
void register_node_type_sh_volume_transparent(ListBase *lb);
|
||||||
|
void register_node_type_sh_volume_isotropic(ListBase *lb);
|
||||||
void register_node_type_sh_mix_shader(ListBase *lb);
|
void register_node_type_sh_mix_shader(ListBase *lb);
|
||||||
void register_node_type_sh_add_shader(ListBase *lb);
|
void register_node_type_sh_add_shader(ListBase *lb);
|
||||||
|
|
||||||
|
@@ -0,0 +1,69 @@
|
|||||||
|
/**
|
||||||
|
* $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $
|
||||||
|
*
|
||||||
|
* ***** 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_volume_isotropic_in[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ SOCK_FLOAT, 1, "Density", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static bNodeSocketTemplate sh_node_volume_isotropic_out[]= {
|
||||||
|
{ SOCK_SHADER, 0, "Volume"},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void node_shader_exec_volume_isotropic(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static int node_shader_gpu_volume_isotropic(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* node type definition */
|
||||||
|
void register_node_type_sh_volume_isotropic(ListBase *lb)
|
||||||
|
{
|
||||||
|
static bNodeType ntype;
|
||||||
|
|
||||||
|
node_type_base(&ntype, SH_NODE_VOLUME_ISOTROPIC, "Isotropic Volume", NODE_CLASS_SHADER, 0);
|
||||||
|
node_type_socket_templates(&ntype, sh_node_volume_isotropic_in, sh_node_volume_isotropic_out);
|
||||||
|
node_type_size(&ntype, 150, 60, 200);
|
||||||
|
node_type_init(&ntype, NULL);
|
||||||
|
node_type_storage(&ntype, "", NULL, NULL);
|
||||||
|
node_type_exec(&ntype, node_shader_exec_volume_isotropic);
|
||||||
|
node_type_gpu(&ntype, node_shader_gpu_volume_isotropic);
|
||||||
|
|
||||||
|
nodeRegisterType(lb, &ntype);
|
||||||
|
};
|
||||||
|
|
@@ -0,0 +1,69 @@
|
|||||||
|
/**
|
||||||
|
* $Id: node_shader_output.c 32517 2010-10-16 14:32:17Z campbellbarton $
|
||||||
|
*
|
||||||
|
* ***** 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_volume_transparent_in[]= {
|
||||||
|
{ SOCK_RGBA, 1, "Color", 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
|
||||||
|
{ SOCK_FLOAT, 1, "Density", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static bNodeSocketTemplate sh_node_volume_transparent_out[]= {
|
||||||
|
{ SOCK_SHADER, 0, "Volume"},
|
||||||
|
{ -1, 0, "" }
|
||||||
|
};
|
||||||
|
|
||||||
|
static void node_shader_exec_volume_transparent(void *UNUSED(data), bNode *UNUSED(node), bNodeStack **UNUSED(in), bNodeStack **UNUSED(out))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static int node_shader_gpu_volume_transparent(GPUMaterial *mat, bNode *UNUSED(node), GPUNodeStack *in, GPUNodeStack *out)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* node type definition */
|
||||||
|
void register_node_type_sh_volume_transparent(ListBase *lb)
|
||||||
|
{
|
||||||
|
static bNodeType ntype;
|
||||||
|
|
||||||
|
node_type_base(&ntype, SH_NODE_VOLUME_TRANSPARENT, "Transparent Volume", NODE_CLASS_SHADER, 0);
|
||||||
|
node_type_socket_templates(&ntype, sh_node_volume_transparent_in, sh_node_volume_transparent_out);
|
||||||
|
node_type_size(&ntype, 150, 60, 200);
|
||||||
|
node_type_init(&ntype, NULL);
|
||||||
|
node_type_storage(&ntype, "", NULL, NULL);
|
||||||
|
node_type_exec(&ntype, node_shader_exec_volume_transparent);
|
||||||
|
node_type_gpu(&ntype, node_shader_gpu_volume_transparent);
|
||||||
|
|
||||||
|
nodeRegisterType(lb, &ntype);
|
||||||
|
};
|
||||||
|
|
Reference in New Issue
Block a user