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
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-02 00:26:52 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-02 00:26:52 +0400
commitde9dffc61e15a6af41947cbcf09ada89779e86ac (patch)
treec3f6e42482085a3a18c8278adf55dbb1e0f76c8d /intern/cycles/kernel/kernel_types.h
parent40b05d364e988bca01dd338026dc24765f56187a (diff)
Cycles: initial subsurface multiple scattering support. It's not working as
well as I would like, but it works, just add a subsurface scattering node and you can use it like any other BSDF. It is using fully raytraced sampling compatible with progressive rendering and other more advanced rendering algorithms we might used in the future, and it uses no extra memory so it's suitable for complex scenes. Disadvantage is that it can be quite noisy and slow. Two limitations that will be solved are that it does not work with bump mapping yet, and that the falloff function used is a simple cubic function, it's not using the real BSSRDF falloff function yet. The node has a color input, along with a scattering radius for each RGB color channel along with an overall scale factor for the radii. There is also no GPU support yet, will test if I can get that working later. Node Documentation: http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Cycles/Nodes/Shaders#BSSRDF Implementation notes: http://wiki.blender.org/index.php/Dev:2.6/Source/Render/Cycles/Subsurface_Scattering
Diffstat (limited to 'intern/cycles/kernel/kernel_types.h')
-rw-r--r--intern/cycles/kernel/kernel_types.h43
1 files changed, 31 insertions, 12 deletions
diff --git a/intern/cycles/kernel/kernel_types.h b/intern/cycles/kernel/kernel_types.h
index f6b8a1b8b82..9c126074e83 100644
--- a/intern/cycles/kernel/kernel_types.h
+++ b/intern/cycles/kernel/kernel_types.h
@@ -37,6 +37,13 @@ CCL_NAMESPACE_BEGIN
#define PARTICLE_SIZE 5
#define TIME_INVALID FLT_MAX
+#define BSSRDF_RADIUS_TABLE_SIZE 1024
+#define BSSRDF_REFL_TABLE_SIZE 256
+#define BSSRDF_PDF_TABLE_OFFSET (BSSRDF_RADIUS_TABLE_SIZE*BSSRDF_REFL_TABLE_SIZE)
+#define BSSRDF_LOOKUP_TABLE_SIZE (BSSRDF_RADIUS_TABLE_SIZE*BSSRDF_REFL_TABLE_SIZE*2)
+#define BSSRDF_MIN_RADIUS 1e-8f
+#define BSSRDF_MAX_ATTEMPTS 8
+
#define TEX_NUM_FLOAT_IMAGES 5
/* device capabilities */
@@ -48,6 +55,7 @@ CCL_NAMESPACE_BEGIN
#ifdef WITH_OSL
#define __OSL__
#endif
+#define __SUBSURFACE__
#endif
#ifdef __KERNEL_CUDA__
@@ -423,7 +431,8 @@ typedef enum ShaderContext {
SHADER_CONTEXT_INDIRECT = 1,
SHADER_CONTEXT_EMISSION = 2,
SHADER_CONTEXT_SHADOW = 3,
- SHADER_CONTEXT_NUM = 4
+ SHADER_CONTEXT_SSS = 4,
+ SHADER_CONTEXT_NUM = 5
} ShaderContext;
/* Shader Data
@@ -438,20 +447,21 @@ enum ShaderDataFlag {
SD_BSDF = 4, /* have bsdf closure? */
SD_BSDF_HAS_EVAL = 8, /* have non-singular bsdf closure? */
SD_BSDF_GLOSSY = 16, /* have glossy bsdf */
- SD_HOLDOUT = 32, /* have holdout closure? */
- SD_VOLUME = 64, /* have volume closure? */
- SD_AO = 128, /* have ao closure? */
+ SD_BSSRDF = 32, /* have bssrdf */
+ SD_HOLDOUT = 64, /* have holdout closure? */
+ SD_VOLUME = 128, /* have volume closure? */
+ SD_AO = 256, /* have ao closure? */
/* shader flags */
- SD_SAMPLE_AS_LIGHT = 256, /* direct light sample */
- SD_HAS_SURFACE_TRANSPARENT = 512, /* has surface transparency */
- SD_HAS_VOLUME = 1024, /* has volume shader */
- SD_HOMOGENEOUS_VOLUME = 2048, /* has homogeneous volume */
+ SD_SAMPLE_AS_LIGHT = 512, /* direct light sample */
+ SD_HAS_SURFACE_TRANSPARENT = 1024, /* has surface transparency */
+ SD_HAS_VOLUME = 2048, /* has volume shader */
+ SD_HOMOGENEOUS_VOLUME = 4096, /* has homogeneous volume */
/* object flags */
- SD_HOLDOUT_MASK = 4096, /* holdout for camera rays */
- SD_OBJECT_MOTION = 8192, /* has object motion blur */
- SD_TRANSFORM_APPLIED = 16384 /* vertices have transform applied */
+ SD_HOLDOUT_MASK = 8192, /* holdout for camera rays */
+ SD_OBJECT_MOTION = 16384, /* has object motion blur */
+ SD_TRANSFORM_APPLIED = 32768 /* vertices have transform applied */
};
typedef struct ShaderData {
@@ -681,6 +691,9 @@ typedef struct KernelIntegrator {
int ao_samples;
int mesh_light_samples;
int use_lamp_mis;
+ int subsurface_samples;
+
+ int pad1, pad2, pad3;
} KernelIntegrator;
typedef struct KernelBVH {
@@ -712,9 +725,14 @@ typedef struct KernelCurves {
float encasing_ratio;
int curveflags;
int subdivisions;
-
} KernelCurves;
+typedef struct KernelBSSRDF {
+ int table_offset;
+ int num_attempts;
+ int pad1, pad2;
+} KernelBSSRDF;
+
typedef struct KernelData {
KernelCamera cam;
KernelFilm film;
@@ -723,6 +741,7 @@ typedef struct KernelData {
KernelIntegrator integrator;
KernelBVH bvh;
KernelCurves curve_kernel_data;
+ KernelBSSRDF bssrdf;
} KernelData;
CCL_NAMESPACE_END