Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-10-12 04:08:31 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-10-12 04:08:31 +0400
commit8f33609374129c5bced382d351de94c8c5e50861 (patch)
tree4cd1728e0b4a6077609db6c09b10d6e2a4e1a2f8 /intern
parent90cd0a37a9c84964dd0daac3f553800e529fae29 (diff)
Code cleanup: remove some unused cycles SSS code.
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/render/CMakeLists.txt2
-rw-r--r--intern/cycles/render/bssrdf.cpp134
-rw-r--r--intern/cycles/render/bssrdf.h29
-rw-r--r--intern/cycles/render/shader.cpp24
-rw-r--r--intern/cycles/render/shader.h1
5 files changed, 0 insertions, 190 deletions
diff --git a/intern/cycles/render/CMakeLists.txt b/intern/cycles/render/CMakeLists.txt
index dbbfe2ee7c9..7d00ed92164 100644
--- a/intern/cycles/render/CMakeLists.txt
+++ b/intern/cycles/render/CMakeLists.txt
@@ -18,7 +18,6 @@ set(SRC
background.cpp
blackbody.cpp
buffers.cpp
- bssrdf.cpp
camera.cpp
film.cpp
graph.cpp
@@ -47,7 +46,6 @@ set(SRC_HEADERS
background.h
blackbody.h
buffers.h
- bssrdf.h
camera.h
film.h
graph.h
diff --git a/intern/cycles/render/bssrdf.cpp b/intern/cycles/render/bssrdf.cpp
deleted file mode 100644
index 69cab5e1824..00000000000
--- a/intern/cycles/render/bssrdf.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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 "bssrdf.h"
-
-#include "util_algorithm.h"
-#include "util_math.h"
-#include "util_types.h"
-
-#include "kernel_types.h"
-#include "kernel_montecarlo.h"
-
-CCL_NAMESPACE_BEGIN
-
-static float bssrdf_cubic(float ld, float r)
-{
- if(ld == 0.0f)
- return (r == 0.0f)? 1.0f: 0.0f;
-
- return powf(ld - min(r, ld), 3.0f) * 4.0f/powf(ld, 4.0f);
-}
-
-/* Cumulative density function utilities */
-
-static float cdf_lookup_inverse(const vector<float>& table, float2 range, float x)
-{
- int index = upper_bound(table.begin(), table.end(), x) - table.begin();
-
- if(index == 0)
- return range[0];
- else if(index == table.size())
- return range[1];
- else
- index--;
-
- float t = (x - table[index])/(table[index+1] - table[index]);
- float y = ((index + t)/(table.size() - 1));
-
- return y*(range[1] - range[0]) + range[0];
-}
-
-static void cdf_invert(vector<float>& to, float2 to_range, const vector<float>& from, float2 from_range)
-{
- float step = 1.0f/(float)(to.size() - 1);
-
- for(int i = 0; i < to.size(); i++) {
- float x = (i*step)*(from_range[1] - from_range[0]) + from_range[0];
- to[i] = cdf_lookup_inverse(from, to_range, x);
- }
-}
-
-/* BSSRDF */
-
-static void bssrdf_lookup_table_create(float ld, vector<float>& sample_table, vector<float>& pdf_table)
-{
- const int size = BSSRDF_RADIUS_TABLE_SIZE;
- vector<float> cdf(size);
- vector<float> pdf(size);
- float step = 1.0f/(float)(size - 1);
- float max_radius = ld;
- float pdf_sum = 0.0f;
-
- /* compute the probability density function */
- for(int i = 0; i < pdf.size(); i++) {
- float x = (i*step)*max_radius;
- pdf[i] = bssrdf_cubic(ld, x);
- pdf_sum += pdf[i];
- }
-
- /* adjust for area covered by each distance */
- for(int i = 0; i < pdf.size(); i++) {
- float x = (i*step)*max_radius;
- pdf[i] *= M_2PI_F*x;
- }
-
- /* normalize pdf, we multiply in reflectance later */
- if(pdf_sum > 0.0f)
- for(int i = 0; i < pdf.size(); i++)
- pdf[i] /= pdf_sum;
-
- /* sum to account for sampling which uses overlapping sphere */
- for(int i = pdf.size() - 2; i >= 0; i--)
- pdf[i] = pdf[i] + pdf[i+1];
-
- /* compute the cumulative density function */
- cdf[0] = 0.0f;
-
- for(int i = 1; i < size; i++)
- cdf[i] = cdf[i-1] + 0.5f*(pdf[i-1] + pdf[i])*step*max_radius;
-
- /* invert cumulative density function for importance sampling */
- float2 cdf_range = make_float2(0.0f, cdf[size - 1]);
- float2 table_range = make_float2(0.0f, max_radius);
-
- cdf_invert(sample_table, table_range, cdf, cdf_range);
-
- /* copy pdf table */
- for(int i = 0; i < pdf.size(); i++)
- pdf_table[i] = pdf[i];
-}
-
-void bssrdf_table_build(vector<float>& table)
-{
- vector<float> sample_table(BSSRDF_RADIUS_TABLE_SIZE);
- vector<float> pdf_table(BSSRDF_RADIUS_TABLE_SIZE);
-
- table.resize(BSSRDF_LOOKUP_TABLE_SIZE);
-
- /* create a 2D lookup table, for reflection x sample radius */
- for(int i = 0; i < BSSRDF_REFL_TABLE_SIZE; i++) {
- float radius = 1.0f;
-
- bssrdf_lookup_table_create(radius, sample_table, pdf_table);
-
- memcpy(&table[i*BSSRDF_RADIUS_TABLE_SIZE], &sample_table[0], BSSRDF_RADIUS_TABLE_SIZE*sizeof(float));
- memcpy(&table[BSSRDF_PDF_TABLE_OFFSET + i*BSSRDF_RADIUS_TABLE_SIZE], &pdf_table[0], BSSRDF_RADIUS_TABLE_SIZE*sizeof(float));
- }
-}
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/render/bssrdf.h b/intern/cycles/render/bssrdf.h
deleted file mode 100644
index b8f0d44bc34..00000000000
--- a/intern/cycles/render/bssrdf.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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
- */
-
-#ifndef __BSSRDF_H__
-#define __BSSRDF_H__
-
-#include "util_vector.h"
-
-CCL_NAMESPACE_BEGIN
-
-void bssrdf_table_build(vector<float>& table);
-
-CCL_NAMESPACE_END
-
-#endif /* __BSSRDF_H__ */
-
diff --git a/intern/cycles/render/shader.cpp b/intern/cycles/render/shader.cpp
index 385395e3752..26af60572f6 100644
--- a/intern/cycles/render/shader.cpp
+++ b/intern/cycles/render/shader.cpp
@@ -15,7 +15,6 @@
*/
#include "background.h"
-#include "bssrdf.h"
#include "blackbody.h"
#include "device.h"
#include "graph.h"
@@ -127,7 +126,6 @@ void Shader::tag_used(Scene *scene)
ShaderManager::ShaderManager()
{
need_update = true;
- bssrdf_table_offset = TABLE_OFFSET_INVALID;
blackbody_table_offset = TABLE_OFFSET_INVALID;
}
@@ -254,23 +252,6 @@ void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Sc
device->tex_alloc("__shader_flag", dscene->shader_flag);
- /* bssrdf lookup table */
- KernelBSSRDF *kbssrdf = &dscene->data.bssrdf;
-
- if(has_surface_bssrdf && bssrdf_table_offset == TABLE_OFFSET_INVALID) {
- vector<float> table;
-
- bssrdf_table_build(table);
- bssrdf_table_offset = scene->lookup_tables->add_table(dscene, table);
-
- kbssrdf->table_offset = (int)bssrdf_table_offset;
- kbssrdf->num_attempts = BSSRDF_MAX_ATTEMPTS;
- }
- else if(!has_surface_bssrdf && bssrdf_table_offset != TABLE_OFFSET_INVALID) {
- scene->lookup_tables->remove_table(bssrdf_table_offset);
- bssrdf_table_offset = TABLE_OFFSET_INVALID;
- }
-
/* blackbody lookup table */
KernelBlackbody *kblackbody = &dscene->data.blackbody;
@@ -289,11 +270,6 @@ void ShaderManager::device_update_common(Device *device, DeviceScene *dscene, Sc
void ShaderManager::device_free_common(Device *device, DeviceScene *dscene, Scene *scene)
{
- if(bssrdf_table_offset != TABLE_OFFSET_INVALID) {
- scene->lookup_tables->remove_table(bssrdf_table_offset);
- bssrdf_table_offset = TABLE_OFFSET_INVALID;
- }
-
if(blackbody_table_offset != TABLE_OFFSET_INVALID) {
scene->lookup_tables->remove_table(blackbody_table_offset);
blackbody_table_offset = TABLE_OFFSET_INVALID;
diff --git a/intern/cycles/render/shader.h b/intern/cycles/render/shader.h
index a58d6955da0..6869a651b46 100644
--- a/intern/cycles/render/shader.h
+++ b/intern/cycles/render/shader.h
@@ -141,7 +141,6 @@ protected:
typedef unordered_map<ustring, uint, ustringHash> AttributeIDMap;
AttributeIDMap unique_attribute_id;
- size_t bssrdf_table_offset;
size_t blackbody_table_offset;
};