Cycles:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 10 Nov 2011 14:32:16 +0000 (14:32 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 10 Nov 2011 14:32:16 +0000 (14:32 +0000)
* 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.

build_files/scons/config/linux-config.py
build_files/scons/tools/btools.py
intern/cycles/CMakeLists.txt
intern/cycles/SConscript
intern/cycles/kernel/kernel_compat_cpu.h
intern/cycles/kernel/svm/bsdf_ashikhmin_velvet.h
intern/cycles/util/util_types.h

index 9e2352c51fc0cc8c77dc310abb2ca5be41c6c37c..1ac1db62a2885e604aab48d64144ff9932d06796 100644 (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
index 7de1649fd626b0b29c79b1d45eaf7d4751641121..417bbcc48bad136952cc4c87cc71cc0852daecf0 100644 (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'
             ]
index c0992aae7da7cba9a0f87fa9f8c551440b52cc6f..d1ee5e0050dd8264b1216802de9e1f35dc714586 100644 (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})
index 5ecd52d369f4a75fa9a05aee4663ac450e8d85ea..e2c81edea376044e53f6240c9106fb2ee4f48c41 100644 (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())
index cee0710492f49f53765af82bb780be003cda6de1..fd96148968fb4130d0c4100e804ec46c5dc0004c 100644 (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)
        {
index e16efebf5bbff4f4180336ffa47d264cb363566e..2e9343647b84e456f7697c5085af6b2753f60806 100644 (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;
index af5b91c963a6ce7b9c0c9573603cc18e4973ea68..2c0ae13ad2ae0d21a7b6e6941610449481da5baf 100644 (file)
 
 /* 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__