* Fix excessive fireflies in Velvet BSDF (patch by David).
* Disable some unused SSE code
* Remove RTTI disabling flags for now, this is giving some compile issues and
  was only needed of OSL which we're not using yet.
This commit is contained in:
Brecht Van Lommel
2011-11-10 14:32:16 +00:00
parent cf6a1320a8
commit 5b1a42cb17
7 changed files with 50 additions and 24 deletions

View File

@@ -180,6 +180,18 @@ BF_JEMALLOC_LIB_STATIC = '${BF_JEMALLOC_LIBPATH}/libjemalloc.a'
WITH_BF_CYCLES = False
WITH_BF_OIIO = True
BF_OIIO = LIBDIR + '/openimageio'
BF_OIIO_INC = BF_OIIO + '/include'
BF_OIIO_LIB = 'OpenImageIO'
BF_OIIO_LIBPATH = BF_OIIO + '/lib'
WITH_BF_BOOST = True
BF_BOOST = LIBDIR + '/boost'
BF_BOOST_INC = BF_BOOST + '/include'
BF_BOOST_LIB = 'boost_date_time-mt boost_filesystem-mt boost_regex-mt boost_system-mt boost_thread-mt'
BF_BOOST_LIBPATH = BF_BOOST + '/lib'
WITH_BF_OPENMP = True
#Ray trace optimization

View File

@@ -156,7 +156,7 @@ def validate_arguments(args, bc):
'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC',
'BUILDBOT_BRANCH',
'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC',
'WITH_BF_CYCLES',
'WITH_BF_CYCLES', 'WITH_BF_CYCLES_BINARIES' 'BF_CYCLES_BINARIES_ARCH',
'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH',
'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH'
]

View File

@@ -32,6 +32,9 @@ if(UNIX AND NOT APPLE)
set(RTTI_DISABLE_FLAGS "-fno-rtti -DBOOST_NO_RTTI -DBOOST_NO_TYPEID")
endif()
# not needed yet, is for open shading language
set(RTTI_DISABLE_FLAGS "")
# Definitions and Includes
add_definitions(${BOOST_DEFINITIONS} ${OPENIMAGEIO_DEFINITIONS})

View File

@@ -24,11 +24,12 @@ defs.append('WITH_MULTI')
defs.append('WITH_CUDA')
if env['OURPLATFORM'] in ('win32-mingw'):
cxxflags.append('-fno-rtti'.split())
if env['WITH_BF_RAYOPTIMIZATION']:
cxxflags.append('-ffast-math -msse -msse2 -msse3'.split())
ccflags.append('-ffast-math -msse -msse2 -msse3'.split())
defs.append('BOOST_NO_RTTI BOOST_NO_TYPEID'.split())
# not needed yet, is for open shading language
# cxxflags.append('-fno-rtti'.split())
# defs.append('BOOST_NO_RTTI BOOST_NO_TYPEID'.split())
incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split())
incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split())

View File

@@ -43,7 +43,7 @@ template<typename T> struct texture {
return data[index];
}
__m128 fetch_m128(int index)
/*__m128 fetch_m128(int index)
{
kernel_assert(index >= 0 && index < width);
return ((__m128*)data)[index];
@@ -53,7 +53,7 @@ template<typename T> struct texture {
{
kernel_assert(index >= 0 && index < width);
return ((__m128i*)data)[index];
}
}*/
float interp(float x)
{

View File

@@ -68,8 +68,11 @@ __device float3 bsdf_ashikhmin_velvet_eval_reflect(const ShaderData *sd, const S
float cosNH = dot(m_N, H);
float cosHO = fabsf(dot(I, H));
if(!(fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f))
return make_float3(0, 0, 0);
float cosNHdivHO = cosNH / cosHO;
cosNHdivHO = fmaxf(cosNHdivHO, 0.00001f);
cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
@@ -86,6 +89,7 @@ __device float3 bsdf_ashikhmin_velvet_eval_reflect(const ShaderData *sd, const S
*pdf = 0.5f * M_1_PI_F;
return make_float3(out, out, out);
}
return make_float3(0, 0, 0);
}
@@ -116,31 +120,36 @@ __device int bsdf_ashikhmin_velvet_sample(const ShaderData *sd, const ShaderClos
float cosNH = dot(m_N, H);
float cosHO = fabsf(dot(sd->I, H));
float cosNHdivHO = cosNH / cosHO;
cosNHdivHO = fmaxf(cosNHdivHO, 0.00001f);
if(fabsf(cosNO) > 1e-5f && fabsf(cosNH) < 1.0f-1e-5f && cosHO > 1e-5f) {
float cosNHdivHO = cosNH / cosHO;
cosNHdivHO = fmaxf(cosNHdivHO, 1e-5f);
float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
float fac1 = 2 * fabsf(cosNHdivHO * cosNO);
float fac2 = 2 * fabsf(cosNHdivHO * cosNI);
float sinNH2 = 1 - cosNH * cosNH;
float sinNH4 = sinNH2 * sinNH2;
float cotangent2 = (cosNH * cosNH) / sinNH2;
float sinNH2 = 1 - cosNH * cosNH;
float sinNH4 = sinNH2 * sinNH2;
float cotangent2 = (cosNH * cosNH) / sinNH2;
float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
float D = expf(-cotangent2 * m_invsigma2) * m_invsigma2 * M_1_PI_F / sinNH4;
float G = min(1.0f, min(fac1, fac2)); // TODO: derive G from D analytically
float power = 0.25f * (D * G) / cosNO;
float power = 0.25f * (D * G) / cosNO;
*eval = make_float3(power, power, power);
*eval = make_float3(power, power, power);
#ifdef __RAY_DIFFERENTIALS__
// TODO: find a better approximation for the retroreflective bounce
*domega_in_dx = (2 * dot(m_N, sd->dI.dx)) * m_N - sd->dI.dx;
*domega_in_dy = (2 * dot(m_N, sd->dI.dy)) * m_N - sd->dI.dy;
*domega_in_dx *= 125.0f;
*domega_in_dy *= 125.0f;
// TODO: find a better approximation for the retroreflective bounce
*domega_in_dx = (2 * dot(m_N, sd->dI.dx)) * m_N - sd->dI.dx;
*domega_in_dy = (2 * dot(m_N, sd->dI.dy)) * m_N - sd->dI.dy;
*domega_in_dx *= 125.0f;
*domega_in_dy *= 125.0f;
#endif
} else
}
else
*pdf = 0.0f;
}
else
*pdf = 0.0f;
return LABEL_REFLECT|LABEL_DIFFUSE;

View File

@@ -46,12 +46,13 @@
/* SIMD Types */
/* not needed yet, will be for qbvh
#ifndef __KERNEL_GPU__
#include <emmintrin.h>
#include <xmmintrin.h>
#endif
#endif*/
#ifndef _WIN32
#ifndef __KERNEL_GPU__