Cycles OSL: refactoring and fixes

* Moved kernel/osl/nodes to kernel/shaders
* Renamed standard attributes to use geom:, particle:, object: prefixes
* Update stdosl.h to properly reflect the closures we support
* Fix the wrong stdosl.h being used for building shaders
* Add geom:numpolyvertices, geom:trianglevertices, geom:polyvertices attributes
This commit is contained in:
Brecht Van Lommel 2012-11-03 14:32:13 +00:00
parent 6b098d7406
commit 615fe0295f
74 changed files with 124 additions and 151 deletions

@ -658,11 +658,7 @@ if(UNIX AND NOT APPLE)
else()
set(Boost_USE_MULTITHREADED ON)
endif()
if(WITH_CYCLES_OSL)
find_package(Boost 1.34 COMPONENTS filesystem python3 regex system thread) # osl_nodes uses boost_python
else()
find_package(Boost 1.34 COMPONENTS filesystem regex system thread)
endif()
find_package(Boost 1.34 COMPONENTS filesystem regex system thread)
mark_as_advanced(Boost_DIR) # why doesnt boost do this?
endif()
@ -1137,12 +1133,6 @@ elseif(WIN32)
debug libboost_date_time-${BOOST_DEBUG_POSTFIX} debug libboost_filesystem-${BOOST_DEBUG_POSTFIX}
debug libboost_regex-${BOOST_DEBUG_POSTFIX}
debug libboost_system-${BOOST_DEBUG_POSTFIX} debug libboost_thread-${BOOST_DEBUG_POSTFIX})
if(WITH_CYCLES_OSL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized libboost_python3-${BOOST_POSTFIX}
debug libboost_python3-${BOOST_DEBUG_POSTFIX})
endif(WITH_CYCLES_OSL)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB")
endif()
@ -1323,12 +1313,6 @@ elseif(WIN32)
debug boost_date_time-${BOOST_DEBUG_POSTFIX} boost_filesystem-${BOOST_DEBUG_POSTFIX}
boost_regex-${BOOST_DEBUG_POSTFIX}
boost_system-${BOOST_DEBUG_POSTFIX} boost_thread-${BOOST_DEBUG_POSTFIX})
if(WITH_CYCLES_OSL)
set(BOOST_LIBRARIES ${BOOST_LIBRARIES}
optimized libboost_python3-${BOOST_POSTFIX}
debug libboost_python3-${BOOST_DEBUG_POSTFIX})
endif(WITH_CYCLES_OSL)
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_DEFINITIONS "-DBOOST_ALL_NO_LIB -DBOOST_THREAD_USE_LIB ")
endif()
@ -1583,11 +1567,7 @@ elseif(APPLE)
if(WITH_BOOST)
set(BOOST ${LIBDIR}/boost)
set(BOOST_INCLUDE_DIR ${BOOST}/include)
if(WITH_CYCLES_OSL)
set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_python3-mt boost_regex-mt boost_system-mt boost_thread-mt)
else(WITH_CYCLES_OSL)
set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt)
endif(WITH_CYCLES_OSL)
set(BOOST_LIBRARIES boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt)
set(BOOST_LIBPATH ${BOOST}/lib)
set(BOOST_DEFINITIONS)
endif()

@ -83,3 +83,4 @@ def available_devices():
def with_osl():
import _cycles
return _cycles.with_osl

@ -60,3 +60,4 @@ panorama_types = (
('FISHEYE_EQUIDISTANT', "Fisheye Equidistant", "Ideal for fulldomes, ignore the sensor dimensions"),
('FISHEYE_EQUISOLID', "Fisheye Equisolid", "Similar to most fisheye modern lens, take sensor dimensions into consideration"),
)

@ -134,6 +134,7 @@ endif()
if(WITH_CYCLES_OSL)
add_subdirectory(osl)
add_subdirectory(shaders)
endif()
# CPU module

@ -45,13 +45,10 @@ __device_inline float safe_sqrtf(float f)
__device int bsdf_microfacet_ggx_setup(ShaderClosure *sc)
{
float ag = sc->data0;
float eta = sc->data1;
float m_ag = clamp(ag, 1e-4f, 1.0f);
float m_eta = eta;
sc->data0 = m_ag;
sc->data1 = m_eta;
sc->type = CLOSURE_BSDF_MICROFACET_GGX_ID;
return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
@ -82,7 +79,6 @@ __device void bsdf_microfacet_ggx_blur(ShaderClosure *sc, float roughness)
__device float3 bsdf_microfacet_ggx_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
{
float m_ag = sc->data0;
//float m_eta = sc->data1;
int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
float3 N = sc->N;
@ -155,7 +151,6 @@ __device float3 bsdf_microfacet_ggx_eval_transmit(const ShaderClosure *sc, const
__device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, 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)
{
float m_ag = sc->data0;
float m_eta = sc->data1;
int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_GGX_REFRACTION_ID;
float3 N = sc->N;
@ -221,6 +216,7 @@ __device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, floa
#ifdef __RAY_DIFFERENTIALS__
float3 dRdx, dRdy, dTdx, dTdy;
#endif
float m_eta = sc->data1;
bool inside;
fresnel_dielectric(m_eta, m, I, &R, &T,
#ifdef __RAY_DIFFERENTIALS__
@ -274,12 +270,9 @@ __device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, floa
__device int bsdf_microfacet_beckmann_setup(ShaderClosure *sc)
{
float ab = sc->data0;
float eta = sc->data1;
float m_ab = clamp(ab, 1e-4f, 1.0f);
float m_eta = eta;
sc->data0 = m_ab;
sc->data1 = m_eta;
sc->type = CLOSURE_BSDF_MICROFACET_BECKMANN_ID;
return SD_BSDF|SD_BSDF_HAS_EVAL|SD_BSDF_GLOSSY;
@ -309,7 +302,6 @@ __device void bsdf_microfacet_beckmann_blur(ShaderClosure *sc, float roughness)
__device float3 bsdf_microfacet_beckmann_eval_reflect(const ShaderClosure *sc, const float3 I, const float3 omega_in, float *pdf)
{
float m_ab = sc->data0;
//float m_eta = sc->data1;
int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
float3 N = sc->N;
@ -386,7 +378,6 @@ __device float3 bsdf_microfacet_beckmann_eval_transmit(const ShaderClosure *sc,
__device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, 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)
{
float m_ab = sc->data0;
float m_eta = sc->data1;
int m_refractive = sc->type == CLOSURE_BSDF_MICROFACET_BECKMANN_REFRACTION_ID;
float3 N = sc->N;
@ -456,6 +447,7 @@ __device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 Ng,
#ifdef __RAY_DIFFERENTIALS__
float3 dRdx, dRdy, dTdx, dTdy;
#endif
float m_eta = sc->data1;
bool inside;
fresnel_dielectric(m_eta, m, I, &R, &T,
#ifdef __RAY_DIFFERENTIALS__

@ -68,6 +68,17 @@ __device_inline float3 triangle_normal_MT(KernelGlobals *kg, int tri_index, int
#endif
}
/* Return 3 triangle vertex locations */
__device_inline void triangle_vertices(KernelGlobals *kg, int tri_index, float3 P[3])
{
/* load triangle vertices */
float3 tri_vindex = float4_to_float3(kernel_tex_fetch(__tri_vindex, tri_index));
P[0] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.x)));
P[1] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.y)));
P[2] = float4_to_float3(kernel_tex_fetch(__tri_verts, __float_as_int(tri_vindex.z)));
}
__device_inline float3 triangle_smooth_normal(KernelGlobals *kg, int tri_index, float u, float v)
{
/* load triangle vertices */

@ -34,4 +34,3 @@ include_directories(SYSTEM ${INC_SYS})
add_library(cycles_kernel_osl ${SRC} ${HEADER_SRC})
add_subdirectory(nodes)

@ -345,6 +345,51 @@ static void set_attribute_float(float f[3], TypeDesc type, bool derivatives, voi
}
}
static bool set_attribute_int(int i, TypeDesc type, bool derivatives, void *val)
{
if(type.basetype == TypeDesc::INT && type.aggregate == TypeDesc::SCALAR && type.arraylen == 0) {
int *ival = (int *)val;
ival[0] = i;
if (derivatives) {
ival[1] = 0;
ival[2] = 0;
}
return true;
}
return false;
}
static bool set_attribute_float3_3(float3 P[3], TypeDesc type, bool derivatives, void *val)
{
if(type.vecsemantics == TypeDesc::POINT && type.arraylen >= 3) {
float *fval = (float *)val;
fval[0] = P[0].x;
fval[1] = P[0].y;
fval[2] = P[0].z;
fval[3] = P[1].x;
fval[4] = P[1].y;
fval[5] = P[1].z;
fval[6] = P[2].x;
fval[7] = P[2].y;
fval[8] = P[2].z;
if(type.arraylen > 3)
memset(fval + 3*3, 0, sizeof(float)*3*(type.arraylen - 3));
if (derivatives)
memset(fval + type.arraylen*3, 0, sizeof(float)*2*3*type.arraylen);
return true;
}
return false;
}
static bool get_mesh_attribute(KernelGlobals *kg, const ShaderData *sd, const OSLGlobals::Attribute& attr,
const TypeDesc& type, bool derivatives, void *val)
{
@ -381,43 +426,45 @@ static void get_object_attribute(const OSLGlobals::Attribute& attr, bool derivat
static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ustring name,
TypeDesc type, bool derivatives, void *val)
{
/* todo: turn this into hash table + callback once */
/* Object Attributes */
if (name == "std::object_location") {
if (name == "object:location") {
float3 fval[3];
fval[0] = object_location(kg, sd);
fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0); /* derivates set to 0 */
set_attribute_float3(fval, type, derivatives, val);
return true;
}
else if (name == "std::object_index") {
else if (name == "object:index") {
float fval[3];
fval[0] = object_pass_id(kg, sd->object);
fval[1] = fval[2] = 0.0; /* derivates set to 0 */
set_attribute_float(fval, type, derivatives, val);
return true;
}
else if (name == "std::dupli_generated") {
else if (name == "geom:dupli_generated") {
float3 fval[3];
fval[0] = object_dupli_generated(kg, sd->object);
fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0); /* derivates set to 0 */
set_attribute_float3(fval, type, derivatives, val);
return true;
}
else if (name == "std::dupli_uv") {
else if (name == "geom:dupli_uv") {
float3 fval[3];
fval[0] = object_dupli_uv(kg, sd->object);
fval[1] = fval[2] = make_float3(0.0, 0.0, 0.0); /* derivates set to 0 */
set_attribute_float3(fval, type, derivatives, val);
return true;
}
else if (name == "std::material_index") {
else if (name == "material:index") {
float fval[3];
fval[0] = shader_pass_id(kg, sd);
fval[1] = fval[2] = 0.0; /* derivates set to 0 */
set_attribute_float(fval, type, derivatives, val);
return true;
}
else if (name == "std::object_random") {
else if (name == "object:random") {
float fval[3];
fval[0] = object_random_number(kg, sd->object);
fval[1] = fval[2] = 0.0; /* derivates set to 0 */
@ -426,7 +473,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
}
/* Particle Attributes */
else if (name == "std::particle_index") {
else if (name == "particle:index") {
float fval[3];
uint particle_id = object_particle_id(kg, sd->object);
fval[0] = particle_index(kg, particle_id);
@ -434,7 +481,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
set_attribute_float(fval, type, derivatives, val);
return true;
}
else if (name == "std::particle_age") {
else if (name == "particle:age") {
float fval[3];
uint particle_id = object_particle_id(kg, sd->object);
fval[0] = particle_age(kg, particle_id);
@ -442,7 +489,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
set_attribute_float(fval, type, derivatives, val);
return true;
}
else if (name == "std::particle_lifetime") {
else if (name == "particle:lifetime") {
float fval[3];
uint particle_id = object_particle_id(kg, sd->object);
fval[0] = particle_lifetime(kg, particle_id);
@ -450,7 +497,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
set_attribute_float(fval, type, derivatives, val);
return true;
}
else if (name == "std::particle_location") {
else if (name == "particle:location") {
float3 fval[3];
uint particle_id = object_particle_id(kg, sd->object);
fval[0] = particle_location(kg, particle_id);
@ -459,7 +506,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
return true;
}
#if 0 /* unsupported */
else if (name == "std::particle_rotation") {
else if (name == "particle:rotation") {
float4 fval[3];
uint particle_id = object_particle_id(kg, sd->object);
fval[0] = particle_rotation(kg, particle_id);
@ -468,7 +515,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
return true;
}
#endif
else if (name == "std::particle_size") {
else if (name == "particle:size") {
float fval[3];
uint particle_id = object_particle_id(kg, sd->object);
fval[0] = particle_size(kg, particle_id);
@ -476,7 +523,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
set_attribute_float(fval, type, derivatives, val);
return true;
}
else if (name == "std::particle_velocity") {
else if (name == "particle:velocity") {
float3 fval[3];
uint particle_id = object_particle_id(kg, sd->object);
fval[0] = particle_velocity(kg, particle_id);
@ -484,7 +531,7 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
set_attribute_float3(fval, type, derivatives, val);
return true;
}
else if (name == "std::particle_angular_velocity") {
else if (name == "particle:angular_velocity") {
float3 fval[3];
uint particle_id = object_particle_id(kg, sd->object);
fval[0] = particle_angular_velocity(kg, particle_id);
@ -492,7 +539,17 @@ static bool get_object_standard_attribute(KernelGlobals *kg, ShaderData *sd, ust
set_attribute_float3(fval, type, derivatives, val);
return true;
}
else if (name == "geom:numpolyvertices") {
return set_attribute_int(3, type, derivatives, val);
}
else if (name == "geom:trianglevertices" || name == "geom:polyvertices") {
float3 P[3];
triangle_vertices(kg, sd->prim, P);
object_position_transform(kg, sd, &P[0]);
object_position_transform(kg, sd, &P[1]);
object_position_transform(kg, sd, &P[2]);
return set_attribute_float3_3(P, type, derivatives, val);
}
else
return false;
}
@ -501,7 +558,7 @@ static bool get_background_attribute(KernelGlobals *kg, ShaderData *sd, ustring
TypeDesc type, bool derivatives, void *val)
{
/* Ray Length */
if (name == "std::ray_length") {
if (name == "path:ray_length") {
float fval[3];
fval[0] = sd->ray_length;
fval[1] = fval[2] = 0.0; /* derivates set to 0 */

@ -76,11 +76,11 @@ set(SRC_OSO
# TODO, add a module to compile OSL
foreach(_file ${SRC_OSL})
set(_OSL_FILE ${CMAKE_CURRENT_SOURCE_DIR}/${_file})
string(REPLACE ".osl" ".oso" _OSO_FILE ${_OSL_FILE}) # TODO, replace extension only
string(REPLACE ".osl" ".oso" _OSO_FILE ${_OSL_FILE})
string(REPLACE ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} _OSO_FILE ${_OSO_FILE})
add_custom_command(
OUTPUT ${_OSO_FILE}
COMMAND ${OSL_COMPILER} -O2 ${_OSL_FILE}
COMMAND ${OSL_COMPILER} -O2 -I"${CMAKE_CURRENT_SOURCE_DIR}" ${_OSL_FILE}
DEPENDS ${_OSL_FILE} ${SRC_OSL_HEADERS})
list(APPEND SRC_OSO
${_OSO_FILE}
@ -94,3 +94,5 @@ add_custom_target(cycles_osl_shaders ALL DEPENDS ${SRC_OSO} ${SRC_OSL_HEADERS})
# CMAKE_CURRENT_SOURCE_DIR is already included in OSO paths
delayed_install("" "${SRC_OSO}" ${CYCLES_INSTALL_PATH}/shader)
delayed_install("${CMAKE_CURRENT_SOURCE_DIR}" "${SRC_OSL_HEADERS}" ${CYCLES_INSTALL_PATH}/shader)

@ -34,10 +34,10 @@ shader node_glass_bsdf(
if (distribution == "Sharp")
BSDF = Color * (Fr * reflection(Normal) + (1.0 - Fr) * refraction(Normal, eta));
else if (distribution == "Beckmann")
BSDF = Color * (Fr * microfacet_beckmann(Normal, Roughness, eta) +
BSDF = Color * (Fr * microfacet_beckmann(Normal, Roughness) +
(1.0 - Fr) * microfacet_beckmann_refraction(Normal, Roughness, eta));
else if (distribution == "GGX")
BSDF = Color * (Fr * microfacet_ggx(Normal, Roughness, eta) +
BSDF = Color * (Fr * microfacet_ggx(Normal, Roughness) +
(1.0 - Fr) * microfacet_ggx_refraction(Normal, Roughness, eta));
}

@ -29,9 +29,9 @@ shader node_glossy_bsdf(
if (distribution == "Sharp")
BSDF = Color * reflection(Normal);
else if (distribution == "Beckmann")
BSDF = Color * microfacet_beckmann(Normal, Roughness, 1.0);
BSDF = Color * microfacet_beckmann(Normal, Roughness);
else if (distribution == "GGX")
BSDF = Color * microfacet_ggx(Normal, Roughness, 1.0);
BSDF = Color * microfacet_ggx(Normal, Roughness);
}

@ -27,7 +27,7 @@ shader node_light_falloff(
{
float ray_length = 0.0;
float strength = Strength;
getattribute("std::ray_length", ray_length);
getattribute("path:ray_length", ray_length);
if (Smooth > 0.0) {
float squared = ray_length*ray_length;

@ -36,6 +36,6 @@ shader node_light_path(
IsReflectionRay = raytype("reflection");
IsTransmissionRay = raytype("refraction");
getattribute("std::ray_length", RayLength);
getattribute("path:ray_length", RayLength);
}

@ -24,9 +24,9 @@ shader node_object_info(
output float MaterialIndex = 0.0,
output float Random = 0.0)
{
getattribute("std::object_location", Location);
getattribute("std::object_index", ObjectIndex);
getattribute("std::material_index", MaterialIndex);
getattribute("std::object_random", Random);
getattribute("object:location", Location);
getattribute("object:index", ObjectIndex);
getattribute("material:index", MaterialIndex);
getattribute("object:random", Random);
}

@ -27,12 +27,12 @@ shader node_particle_info(
output vector Velocity = point(0.0, 0.0, 0.0),
output vector AngularVelocity = point(0.0, 0.0, 0.0))
{
getattribute("std::particle_index", Index);
getattribute("std::particle_age", Age);
getattribute("std::particle_lifetime", Lifetime);
getattribute("std::particle_location", Location);
getattribute("std::particle_size", Size);
getattribute("std::particle_velocity", Velocity);
getattribute("std::particle_angular_velocity", AngularVelocity);
getattribute("particle:index", Index);
getattribute("particle:age", Age);
getattribute("particle:lifetime", Lifetime);
getattribute("particle:location", Location);
getattribute("particle:size", Size);
getattribute("particle:velocity", Velocity);
getattribute("particle:angular_velocity", AngularVelocity);
}

@ -44,12 +44,12 @@ shader node_texture_coordinate(
}
else {
if (from_dupli) {
getattribute("std::dupli_generated", Generated);
getattribute("std::dupli_uv", UV);
getattribute("geom:dupli_generated", Generated);
getattribute("geom:dupli_uv", UV);
}
else {
getattribute("std::generated", Generated);
getattribute("std::uv", UV);
getattribute("geom:generated", Generated);
getattribute("geom:uv", UV);
}
Object = transform("object", P);

@ -27,6 +27,6 @@ shader node_velvet_bsdf(
{
float sigma = clamp(Sigma, 0.0, 1.0);
BSDF = Color * ashikhmin_velvet(Normal, sigma, 1.0);
BSDF = Color * ashikhmin_velvet(Normal, sigma);
}

@ -434,81 +434,18 @@ string concat (string a, string b, string c, string d, string e, string f) {
closure color diffuse(normal N) BUILTIN;
closure color oren_nayar(normal N, float sigma) BUILTIN;
closure color translucent(normal N) BUILTIN;
closure color reflection(normal N, float eta) BUILTIN;
closure color reflection(normal N) { return reflection (N, 0.0); }
closure color reflection(normal N) BUILTIN;
closure color refraction(normal N, float eta) BUILTIN;
closure color dielectric(normal N, float eta) BUILTIN;
closure color transparent() BUILTIN;
closure color microfacet_ggx(normal N, float ag, float eta) BUILTIN;
closure color microfacet_ggx(normal N, float ag) BUILTIN;
closure color microfacet_ggx_refraction(normal N, float ag, float eta) BUILTIN;
closure color microfacet_beckmann(normal N, float ab, float eta) BUILTIN;
closure color microfacet_beckmann(normal N, float ab) BUILTIN;
closure color microfacet_beckmann_refraction(normal N, float ab, float eta) BUILTIN;
closure color ward(normal N, vector T,float ax, float ay) BUILTIN;
closure color phong(normal N, float exponent) BUILTIN;
closure color phong_ramp(normal N, float exponent, color colors[8]) BUILTIN;
closure color hair_diffuse(vector T) BUILTIN;
closure color hair_specular(vector T, float offset, float exponent) BUILTIN;
closure color ashikhmin_velvet(normal N, float sigma, float eta) BUILTIN;
closure color westin_backscatter(normal N, float roughness) BUILTIN;
closure color westin_sheen(normal N, float edginess) BUILTIN;
closure color bssrdf_cubic(color radius) BUILTIN;
closure color emission(float inner_angle, float outer_angle) BUILTIN;
closure color emission(float outer_angle) BUILTIN;
closure color ashikhmin_velvet(normal N, float sigma) BUILTIN;
closure color emission() BUILTIN;
closure color debug(string tag) BUILTIN;
closure color background() BUILTIN;
closure color holdout() BUILTIN;
closure color subsurface(float eta, float g, color mfp, color albedo) BUILTIN;
closure color cloth(normal N, float s, float t, float dsdx, float dtdx, float dsdy, float dtdy,
float area_scaled, vector dPdu, color diff_warp_col, color diff_weft_col,
color spec_warp_col, color spec_weft_col, float fresnel_warp, float fresnel_weft,
float spread_x_mult, float spread_y_mult, int pattern, float pattern_angle,
float warp_width_scale, float weft_width_scale, float thread_count_mult_u,
float thread_count_mult_v) BUILTIN;
closure color cloth_specular(normal N, color spec_col[4], float eta[4], int thread_pattern[4],
float pattern_weight[4], int current_thread, float brdf_interp,
float btf_interp, float uux, float vvx, float area_scaled, vector dPdu,
float eccentricity[4], float angle[4], float Kx[4], float Ky[4],
float Sx[4], float Sy[4]) BUILTIN;
closure color fakefur_diffuse(normal N, vector T, float fur_reflectivity, float fur_transmission,
float shadow_start, float shadow_end, float fur_attenuation, float fur_density,
float fur_avg_radius, float fur_length, float fur_shadow_fraction) BUILTIN;
closure color fakefur_specular(normal N, vector T, float offset, float exp, float fur_reflectivity,
float fur_transmission, float shadow_start, float shadow_end,
float fur_attenuation, float fur_density, float fur_avg_radius,
float fur_length, float fur_shadow_fraction) BUILTIN;
closure color fakefur_skin(vector N, vector T, float fur_reflectivity, float fur_transmission,
float shadow_start, float shadow_end, float fur_attenuation, float fur_density,
float fur_avg_radius, float fur_length) BUILTIN;
closure color cloth(normal N, float s, float t, color diff_warp, color diff_weft,
color spec_warp, color spec_weft, float fresnel_warp, float fresnel_weft,
float spread_x_mult, float spread_y_mult, int pattern, float pattern_angle,
float warp_width_scale, float weft_width_scale, float thread_count_mult_u,
float thread_count_mult_v)
{
return cloth(N, s, t, Dx(s), Dx(t), Dy(s), Dy(t), area(P), dPdu, diff_warp, diff_weft, spec_warp, spec_weft,
fresnel_warp, fresnel_weft, spread_x_mult, spread_y_mult, pattern, pattern_angle,
warp_width_scale, weft_width_scale, thread_count_mult_u, thread_count_mult_v);
}
closure color cloth(normal N, float s, float t, color diff_warp, color diff_weft,
color spec_warp, color spec_weft, float fresnel_warp, float fresnel_weft,
float spread_x_mult, float spread_y_mult, int pattern, float pattern_angle,
float warp_width_scale, float weft_width_scale, float thread_count_mult_u,
float thread_count_mult_v, string tok, string val)
{
return cloth(N, s, t, Dx(s), Dx(t), Dy(s), Dy(t), area(P), dPdu, diff_warp, diff_weft, spec_warp, spec_weft,
fresnel_warp, fresnel_weft, spread_x_mult, spread_y_mult, pattern, pattern_angle,
warp_width_scale, weft_width_scale, thread_count_mult_u, thread_count_mult_v, tok, val);
}
// Renderer state
int raytype (string typename) BUILTIN;

@ -366,8 +366,8 @@ void MeshManager::update_osl_attributes(Device *device, Scene *scene, vector<Att
osl_attr.type = TypeDesc::TypeColor;
if(req.std != ATTR_STD_NONE) {
/* if standard attribute, add lookup by std:: name convention */
ustring stdname(std::string("std::") + std::string(attribute_standard_name(req.std)));
/* if standard attribute, add lookup by geom: name convention */
ustring stdname(string("geom:") + string(attribute_standard_name(req.std)));
og->attribute_map[i][stdname] = osl_attr;
}
else if(req.name != ustring()) {

@ -44,7 +44,7 @@ public:
bool append_file(const string& filepath);
string get_hex();
protected:
protected:
void process(const uint8_t *data);
void finish(uint8_t digest[16]);

@ -737,14 +737,6 @@ elseif(APPLE)
endif()
#OSL shader_headers needed
if(WITH_CYCLES_OSL)
install(
FILES ${LIBDIR}/osl/shaders/oslutil.h ${LIBDIR}/osl/shaders/stdosl.h
DESTINATION ${TARGETDIR}/blender.app/Contents/shaders/
)
endif()
# install blenderplayer bundle - copy of blender.app above. re-using macros et al
# note we are using OSX Bundle as base and copying Blender dummy bundle on top of it
if(WITH_GAMEENGINE AND WITH_PLAYER)