Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/render/film.cpp
| Show First 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | case PASS_BACKGROUND: | ||||
| pass.components = 4; | pass.components = 4; | ||||
| pass.exposure = true; | pass.exposure = true; | ||||
| break; | break; | ||||
| case PASS_AO: | case PASS_AO: | ||||
| pass.components = 4; | pass.components = 4; | ||||
| break; | break; | ||||
| case PASS_SHADOW: | case PASS_SHADOW: | ||||
| pass.components = 4; | pass.components = 4; | ||||
| pass.exposure = false; | pass.exposure = false; | ||||
brecht: Was this change intentional? | |||||
Done Inline ActionsIt is a NOP operation as exposure is always false. Will revert it as we don't support shadow passes in the viewport. jbakker: It is a NOP operation as exposure is always false. Will revert it as we don't support shadow… | |||||
| break; | break; | ||||
| case PASS_LIGHT: | case PASS_LIGHT: | ||||
| /* This isn't a real pass, used by baking to see whether | /* This isn't a real pass, used by baking to see whether | ||||
| * light data is needed or not. | * light data is needed or not. | ||||
| * | * | ||||
| * Set components to 0 so pass sort below happens in a | * Set components to 0 so pass sort below happens in a | ||||
| * determined way. | * determined way. | ||||
| */ | */ | ||||
| ▲ Show 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | |||||
| /* Film */ | /* Film */ | ||||
| NODE_DEFINE(Film) | NODE_DEFINE(Film) | ||||
| { | { | ||||
| NodeType *type = NodeType::add("film", create); | NodeType *type = NodeType::add("film", create); | ||||
| SOCKET_FLOAT(exposure, "Exposure", 0.8f); | SOCKET_FLOAT(exposure, "Exposure", 0.8f); | ||||
| SOCKET_FLOAT(pass_alpha_threshold, "Pass Alpha Threshold", 0.5f); | SOCKET_FLOAT(pass_alpha_threshold, "Pass Alpha Threshold", 0.0f); | ||||
Done Inline ActionsMaybe changing this to 0.0 will make normals and UVs work? brecht: Maybe changing this to `0.0` will make normals and UVs work? | |||||
| static NodeEnum filter_enum; | static NodeEnum filter_enum; | ||||
| filter_enum.insert("box", FILTER_BOX); | filter_enum.insert("box", FILTER_BOX); | ||||
| filter_enum.insert("gaussian", FILTER_GAUSSIAN); | filter_enum.insert("gaussian", FILTER_GAUSSIAN); | ||||
| filter_enum.insert("blackman_harris", FILTER_BLACKMAN_HARRIS); | filter_enum.insert("blackman_harris", FILTER_BLACKMAN_HARRIS); | ||||
| SOCKET_ENUM(filter_type, "Filter Type", filter_enum, FILTER_BOX); | SOCKET_ENUM(filter_type, "Filter Type", filter_enum, FILTER_BOX); | ||||
| SOCKET_FLOAT(filter_width, "Filter Width", 1.0f); | SOCKET_FLOAT(filter_width, "Filter Width", 1.0f); | ||||
| Show All 34 Lines | void Film::device_update(Device *device, DeviceScene *dscene, Scene *scene) | ||||
| device_free(device, dscene, scene); | device_free(device, dscene, scene); | ||||
| KernelFilm *kfilm = &dscene->data.film; | KernelFilm *kfilm = &dscene->data.film; | ||||
| /* update __data */ | /* update __data */ | ||||
| kfilm->exposure = exposure; | kfilm->exposure = exposure; | ||||
| kfilm->pass_flag = 0; | kfilm->pass_flag = 0; | ||||
| kfilm->display_pass_stride = -1; | |||||
| kfilm->display_pass_components = 0; | |||||
| kfilm->display_divide_pass_stride = -1; | |||||
| kfilm->use_display_exposure = false; | |||||
| kfilm->use_display_pass_alpha = (display_pass == PASS_COMBINED); | |||||
| kfilm->light_pass_flag = 0; | kfilm->light_pass_flag = 0; | ||||
| kfilm->pass_stride = 0; | kfilm->pass_stride = 0; | ||||
| kfilm->use_light_pass = use_light_visibility || use_sample_clamp; | kfilm->use_light_pass = use_light_visibility || use_sample_clamp; | ||||
| bool have_cryptomatte = false; | bool have_cryptomatte = false; | ||||
| for (size_t i = 0; i < passes.size(); i++) { | for (size_t i = 0; i < passes.size(); i++) { | ||||
| Pass &pass = passes[i]; | Pass &pass = passes[i]; | ||||
| ▲ Show 20 Lines • Show All 130 Lines • ▼ Show 20 Lines | #endif | ||||
| kfilm->pass_stride; | kfilm->pass_stride; | ||||
| have_cryptomatte = true; | have_cryptomatte = true; | ||||
| break; | break; | ||||
| default: | default: | ||||
| assert(false); | assert(false); | ||||
| break; | break; | ||||
| } | } | ||||
| if (pass.type == display_pass) { | |||||
| kfilm->display_pass_stride = kfilm->pass_stride; | |||||
| kfilm->display_pass_components = pass.components; | |||||
| kfilm->use_display_exposure = pass.exposure && (kfilm->exposure != 1.0f); | |||||
| } | |||||
| else if (pass.type == PASS_DIFFUSE_COLOR || pass.type == PASS_TRANSMISSION_COLOR || | |||||
| pass.type == PASS_GLOSSY_COLOR || pass.type == PASS_SUBSURFACE_COLOR) { | |||||
| kfilm->display_divide_pass_stride = kfilm->pass_stride; | |||||
| } | |||||
| kfilm->pass_stride += pass.components; | kfilm->pass_stride += pass.components; | ||||
| } | } | ||||
| kfilm->pass_denoising_data = 0; | kfilm->pass_denoising_data = 0; | ||||
| kfilm->pass_denoising_clean = 0; | kfilm->pass_denoising_clean = 0; | ||||
| kfilm->denoising_flags = 0; | kfilm->denoising_flags = 0; | ||||
| if (denoising_data_pass) { | if (denoising_data_pass) { | ||||
| kfilm->pass_denoising_data = kfilm->pass_stride; | kfilm->pass_denoising_data = kfilm->pass_stride; | ||||
| kfilm->pass_stride += DENOISING_PASS_SIZE_BASE; | kfilm->pass_stride += DENOISING_PASS_SIZE_BASE; | ||||
| kfilm->denoising_flags = denoising_flags; | kfilm->denoising_flags = denoising_flags; | ||||
| if (denoising_clean_pass) { | if (denoising_clean_pass) { | ||||
| kfilm->pass_denoising_clean = kfilm->pass_stride; | kfilm->pass_denoising_clean = kfilm->pass_stride; | ||||
| kfilm->pass_stride += DENOISING_PASS_SIZE_CLEAN; | kfilm->pass_stride += DENOISING_PASS_SIZE_CLEAN; | ||||
| kfilm->use_light_pass = 1; | kfilm->use_light_pass = 1; | ||||
| } | } | ||||
| if (denoising_prefiltered_pass) { | if (denoising_prefiltered_pass) { | ||||
| kfilm->pass_stride += DENOISING_PASS_SIZE_PREFILTERED; | kfilm->pass_stride += DENOISING_PASS_SIZE_PREFILTERED; | ||||
| } | } | ||||
| } | } | ||||
| kfilm->pass_stride = align_up(kfilm->pass_stride, 4); | kfilm->pass_stride = align_up(kfilm->pass_stride, 4); | ||||
| /* When displaying the normal/uv pass in the viewport we need to disable | |||||
| * transparency. | |||||
| * | |||||
| * We also don't need to perform light accumulations. Later we want to optimize this to suppress | |||||
| * light calculations. */ | |||||
| if (display_pass == PASS_NORMAL || display_pass == PASS_UV) { | |||||
| kfilm->use_light_pass = 0; | |||||
| } | |||||
| else { | |||||
| kfilm->pass_alpha_threshold = pass_alpha_threshold; | kfilm->pass_alpha_threshold = pass_alpha_threshold; | ||||
| } | |||||
| /* update filter table */ | /* update filter table */ | ||||
| vector<float> table = filter_table(filter_type, filter_width); | vector<float> table = filter_table(filter_type, filter_width); | ||||
| scene->lookup_tables->remove_table(&filter_table_offset); | scene->lookup_tables->remove_table(&filter_table_offset); | ||||
| filter_table_offset = scene->lookup_tables->add_table(dscene, table); | filter_table_offset = scene->lookup_tables->add_table(dscene, table); | ||||
Done Inline ActionsI think it's better to just change the default value in film.cpp. Doing it just in the kernel data structures risk things going out of sync. brecht: I think it's better to just change the default value in `film.cpp`.
Doing it just in the… | |||||
| kfilm->filter_table_offset = (int)filter_table_offset; | kfilm->filter_table_offset = (int)filter_table_offset; | ||||
Done Inline ActionsNote that this just disables light passes accumulation, not lighting calculations. Which is ok and we can optimize this later, but just to correct the comment. brecht: Note that this just disables light passes accumulation, not lighting calculations.
Which is ok… | |||||
| /* mist pass parameters */ | /* mist pass parameters */ | ||||
| kfilm->mist_start = mist_start; | kfilm->mist_start = mist_start; | ||||
| kfilm->mist_inv_depth = (mist_depth > 0.0f) ? 1.0f / mist_depth : 0.0f; | kfilm->mist_inv_depth = (mist_depth > 0.0f) ? 1.0f / mist_depth : 0.0f; | ||||
| kfilm->mist_falloff = mist_falloff; | kfilm->mist_falloff = mist_falloff; | ||||
| kfilm->cryptomatte_passes = cryptomatte_passes; | kfilm->cryptomatte_passes = cryptomatte_passes; | ||||
| kfilm->cryptomatte_depth = cryptomatte_depth; | kfilm->cryptomatte_depth = cryptomatte_depth; | ||||
| Show All 10 Lines | void Film::device_free(Device * /*device*/, DeviceScene * /*dscene*/, Scene *scene) | ||||
| scene->lookup_tables->remove_table(&filter_table_offset); | scene->lookup_tables->remove_table(&filter_table_offset); | ||||
| } | } | ||||
| bool Film::modified(const Film &film) | bool Film::modified(const Film &film) | ||||
| { | { | ||||
| return !Node::equals(film) || !Pass::equals(passes, film.passes); | return !Node::equals(film) || !Pass::equals(passes, film.passes); | ||||
| } | } | ||||
| void Film::tag_passes_update(Scene *scene, const vector<Pass> &passes_) | void Film::tag_passes_update(Scene *scene, const vector<Pass> &passes_, bool update_passes) | ||||
| { | { | ||||
| if (Pass::contains(passes, PASS_UV) != Pass::contains(passes_, PASS_UV)) { | if (Pass::contains(passes, PASS_UV) != Pass::contains(passes_, PASS_UV)) { | ||||
| scene->mesh_manager->tag_update(scene); | scene->mesh_manager->tag_update(scene); | ||||
| foreach (Shader *shader, scene->shaders) | foreach (Shader *shader, scene->shaders) | ||||
| shader->need_update_mesh = true; | shader->need_update_mesh = true; | ||||
| } | } | ||||
| else if (Pass::contains(passes, PASS_MOTION) != Pass::contains(passes_, PASS_MOTION)) | else if (Pass::contains(passes, PASS_MOTION) != Pass::contains(passes_, PASS_MOTION)) { | ||||
| scene->mesh_manager->tag_update(scene); | scene->mesh_manager->tag_update(scene); | ||||
| } | |||||
| else if (Pass::contains(passes, PASS_AO) != Pass::contains(passes_, PASS_AO)) { | |||||
| scene->integrator->tag_update(scene); | |||||
| } | |||||
| if (update_passes) { | |||||
| passes = passes_; | passes = passes_; | ||||
| } | } | ||||
| } | |||||
| void Film::tag_update(Scene * /*scene*/) | void Film::tag_update(Scene * /*scene*/) | ||||
| { | { | ||||
| need_update = true; | need_update = true; | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||
Was this change intentional?