GOOENGINE: Restore gooengine settings and defaults lost in merge
This commit is contained in:
@@ -1712,6 +1712,7 @@ struct StampDataCustomField {
|
||||
|
||||
struct StampData {
|
||||
char file[512];
|
||||
char filename[512];
|
||||
char note[512];
|
||||
char date[512];
|
||||
char marker[512];
|
||||
@@ -1749,8 +1750,12 @@ static void stampdata(
|
||||
if (scene->r.stamp & R_STAMP_FILENAME) {
|
||||
const char *blendfile_path = BKE_main_blendfile_path_from_global();
|
||||
SNPRINTF(stamp_data->file,
|
||||
do_prefix ? "File %s" : "%s",
|
||||
(blendfile_path[0] != '\0') ? blendfile_path : "<untitled>");
|
||||
do_prefix ? "Path %s" : "%s",
|
||||
(blendfile_path[0] != '\0') ? blendfile_path : "<unsaved>");
|
||||
|
||||
const char* filename = BLI_path_basename(blendfile_path);
|
||||
SNPRINTF(stamp_data->filename,
|
||||
do_prefix ? "File %s" : "%s", (filename[0] != '\0') ? filename : "<untitled>");
|
||||
}
|
||||
else {
|
||||
stamp_data->file[0] = '\0';
|
||||
@@ -2091,6 +2096,28 @@ void BKE_image_stamp_buf(Scene *scene,
|
||||
/* Top left corner */
|
||||
y -= h;
|
||||
|
||||
/* also a little of space to the background. */
|
||||
buf_rectfill_area(rect,
|
||||
rectf,
|
||||
width,
|
||||
height,
|
||||
scene->r.bg_stamp,
|
||||
display,
|
||||
x - BUFF_MARGIN_X,
|
||||
y - BUFF_MARGIN_Y,
|
||||
w + BUFF_MARGIN_X,
|
||||
y + h + BUFF_MARGIN_Y);
|
||||
|
||||
/* and draw the text. */
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
BLF_draw_buffer(mono, stamp_data.filename, sizeof(stamp_data.filename));
|
||||
|
||||
/* the extra pixel for background. */
|
||||
y -= BUFF_MARGIN_Y * 2;
|
||||
|
||||
/* Draw file *path* here, under the basename */
|
||||
y -= h;
|
||||
|
||||
/* also a little of space to the background. */
|
||||
buf_rectfill_area(rect,
|
||||
rectf,
|
||||
@@ -2204,6 +2231,29 @@ void BKE_image_stamp_buf(Scene *scene,
|
||||
}
|
||||
|
||||
/* Top left corner, below: File, Date, Memory, Render-time, Host-name. */
|
||||
if (TEXT_SIZE_CHECK(stamp_data.frame, w, h)) {
|
||||
y -= h;
|
||||
|
||||
/* and space for background. */
|
||||
buf_rectfill_area(rect,
|
||||
rectf,
|
||||
width,
|
||||
height,
|
||||
scene->r.bg_stamp,
|
||||
display,
|
||||
0,
|
||||
y - BUFF_MARGIN_Y,
|
||||
w + BUFF_MARGIN_X,
|
||||
y + h + BUFF_MARGIN_Y);
|
||||
|
||||
BLF_position(mono, x, y + y_ofs, 0.0);
|
||||
BLF_draw_buffer(mono, stamp_data.frame, sizeof(stamp_data.frame));
|
||||
|
||||
/* the extra pixel for background. */
|
||||
y -= BUFF_MARGIN_Y * 2;
|
||||
}
|
||||
|
||||
/* Top left corner, below File, Date, Memory, Rendertime, Hostname */
|
||||
BLF_enable(mono, BLF_WORD_WRAP);
|
||||
if (TEXT_SIZE_CHECK_WORD_WRAP(stamp_data.note, w, h)) {
|
||||
y -= h;
|
||||
|
||||
@@ -3432,6 +3432,15 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
scene->eevee.taa_samples = 16;
|
||||
scene->eevee.taa_render_samples = 64;
|
||||
|
||||
scene->eevee.sss_samples = 7;
|
||||
scene->eevee.sss_jitter_threshold = 0.3f;
|
||||
|
||||
scene->eevee.ssr_quality = 0.25f;
|
||||
scene->eevee.ssr_max_roughness = 0.5f;
|
||||
scene->eevee.ssr_thickness = 0.2f;
|
||||
scene->eevee.ssr_border_fade = 0.075f;
|
||||
scene->eevee.ssr_firefly_fac = 10.0f;
|
||||
|
||||
scene->eevee.volumetric_start = 0.1f;
|
||||
scene->eevee.volumetric_end = 100.0f;
|
||||
scene->eevee.volumetric_tile_size = 8;
|
||||
@@ -3441,17 +3450,29 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
scene->eevee.volumetric_shadow_samples = 16;
|
||||
|
||||
scene->eevee.gtao_distance = 0.2f;
|
||||
scene->eevee.fast_gi_quality = 0.25f;
|
||||
scene->eevee.gtao_factor = 1.0f;
|
||||
scene->eevee.gtao_quality = 0.25f;
|
||||
|
||||
scene->eevee.bokeh_max_size = 100.0f;
|
||||
scene->eevee.bokeh_threshold = 1.0f;
|
||||
|
||||
copy_v3_fl(scene->eevee.bloom_color, 1.0f);
|
||||
scene->eevee.bloom_threshold = 0.8f;
|
||||
scene->eevee.bloom_knee = 0.5f;
|
||||
scene->eevee.bloom_intensity = 0.05f;
|
||||
scene->eevee.bloom_radius = 6.5f;
|
||||
scene->eevee.bloom_clamp = 0.0f;
|
||||
|
||||
scene->eevee.motion_blur_samples = 8;
|
||||
scene->eevee.motion_blur_shutter_deprecated = 0.5f;
|
||||
|
||||
scene->eevee.shadow_cube_size_deprecated = 512;
|
||||
scene->eevee.shadow_method = SHADOW_ESM;
|
||||
scene->eevee.shadow_cube_size = 512;
|
||||
scene->eevee.shadow_cascade_size = 1024;
|
||||
|
||||
scene->eevee.flag = SCE_EEVEE_TAA_REPROJECTION;
|
||||
scene->eevee.flag = SCE_EEVEE_VOLUMETRIC_LIGHTS | SCE_EEVEE_GTAO_BENT_NORMALS |
|
||||
SCE_EEVEE_GTAO_BOUNCE | SCE_EEVEE_TAA_REPROJECTION |
|
||||
SCE_EEVEE_SSR_HALF_RESOLUTION;
|
||||
|
||||
/* If the file is pre-2.80 move on. */
|
||||
if (scene->layer_properties == nullptr) {
|
||||
@@ -3507,21 +3528,21 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
IDProperty *props = IDP_GetPropertyFromGroup(scene->layer_properties,
|
||||
RE_engine_id_BLENDER_EEVEE);
|
||||
// EEVEE_GET_BOOL(props, volumetric_enable, SCE_EEVEE_VOLUMETRIC_ENABLED);
|
||||
// EEVEE_GET_BOOL(props, volumetric_lights, SCE_EEVEE_VOLUMETRIC_LIGHTS);
|
||||
// EEVEE_GET_BOOL(props, volumetric_shadows, SCE_EEVEE_VOLUMETRIC_SHADOWS);
|
||||
EEVEE_GET_BOOL(props, volumetric_lights, SCE_EEVEE_VOLUMETRIC_LIGHTS);
|
||||
EEVEE_GET_BOOL(props, volumetric_shadows, SCE_EEVEE_VOLUMETRIC_SHADOWS);
|
||||
EEVEE_GET_BOOL(props, gtao_enable, SCE_EEVEE_GTAO_ENABLED);
|
||||
// EEVEE_GET_BOOL(props, gtao_use_bent_normals, SCE_EEVEE_GTAO_BENT_NORMALS);
|
||||
// EEVEE_GET_BOOL(props, gtao_bounce, SCE_EEVEE_GTAO_BOUNCE);
|
||||
EEVEE_GET_BOOL(props, gtao_use_bent_normals, SCE_EEVEE_GTAO_BENT_NORMALS);
|
||||
EEVEE_GET_BOOL(props, gtao_bounce, SCE_EEVEE_GTAO_BOUNCE);
|
||||
EEVEE_GET_BOOL(props, dof_enable, SCE_EEVEE_DOF_ENABLED);
|
||||
EEVEE_GET_BOOL(props, bloom_enable, SCE_EEVEE_BLOOM_ENABLED);
|
||||
EEVEE_GET_BOOL(props, motion_blur_enable, SCE_EEVEE_MOTION_BLUR_ENABLED_DEPRECATED);
|
||||
// EEVEE_GET_BOOL(props, shadow_high_bitdepth, SCE_EEVEE_SHADOW_HIGH_BITDEPTH);
|
||||
EEVEE_GET_BOOL(props, shadow_high_bitdepth, SCE_EEVEE_SHADOW_HIGH_BITDEPTH);
|
||||
EEVEE_GET_BOOL(props, taa_reprojection, SCE_EEVEE_TAA_REPROJECTION);
|
||||
// EEVEE_GET_BOOL(props, sss_enable, SCE_EEVEE_SSS_ENABLED);
|
||||
// EEVEE_GET_BOOL(props, sss_separate_albedo, SCE_EEVEE_SSS_SEPARATE_ALBEDO);
|
||||
EEVEE_GET_BOOL(props, ssr_enable, SCE_EEVEE_SSR_ENABLED);
|
||||
// EEVEE_GET_BOOL(props, ssr_refraction, SCE_EEVEE_SSR_REFRACTION);
|
||||
// EEVEE_GET_BOOL(props, ssr_halfres, SCE_EEVEE_SSR_HALF_RESOLUTION);
|
||||
EEVEE_GET_BOOL(props, ssr_refraction, SCE_EEVEE_SSR_REFRACTION);
|
||||
EEVEE_GET_BOOL(props, ssr_halfres, SCE_EEVEE_SSR_HALF_RESOLUTION);
|
||||
|
||||
EEVEE_GET_INT(props, gi_diffuse_bounces);
|
||||
EEVEE_GET_INT(props, gi_diffuse_bounces);
|
||||
@@ -3531,14 +3552,14 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
EEVEE_GET_INT(props, taa_samples);
|
||||
EEVEE_GET_INT(props, taa_render_samples);
|
||||
|
||||
// EEVEE_GET_INT(props, sss_samples);
|
||||
// EEVEE_GET_FLOAT(props, sss_jitter_threshold);
|
||||
EEVEE_GET_INT(props, sss_samples);
|
||||
EEVEE_GET_FLOAT(props, sss_jitter_threshold);
|
||||
|
||||
// EEVEE_GET_FLOAT(props, ssr_quality);
|
||||
// EEVEE_GET_FLOAT(props, ssr_max_roughness);
|
||||
// EEVEE_GET_FLOAT(props, ssr_thickness);
|
||||
// EEVEE_GET_FLOAT(props, ssr_border_fade);
|
||||
// EEVEE_GET_FLOAT(props, ssr_firefly_fac);
|
||||
EEVEE_GET_FLOAT(props, ssr_quality);
|
||||
EEVEE_GET_FLOAT(props, ssr_max_roughness);
|
||||
EEVEE_GET_FLOAT(props, ssr_thickness);
|
||||
EEVEE_GET_FLOAT(props, ssr_border_fade);
|
||||
EEVEE_GET_FLOAT(props, ssr_firefly_fac);
|
||||
|
||||
EEVEE_GET_FLOAT(props, volumetric_start);
|
||||
EEVEE_GET_FLOAT(props, volumetric_end);
|
||||
@@ -3548,26 +3569,27 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
EEVEE_GET_FLOAT(props, volumetric_light_clamp);
|
||||
EEVEE_GET_INT(props, volumetric_shadow_samples);
|
||||
|
||||
// EEVEE_GET_FLOAT(props, gtao_distance);
|
||||
// EEVEE_GET_FLOAT(props, gtao_factor);
|
||||
EEVEE_GET_FLOAT(props, gtao_distance);
|
||||
EEVEE_GET_FLOAT(props, gtao_factor);
|
||||
EEVEE_GET_FLOAT(props, gtao_quality);
|
||||
EEVEE_GET_FLOAT(props, fast_gi_quality);
|
||||
|
||||
EEVEE_GET_FLOAT(props, bokeh_max_size);
|
||||
EEVEE_GET_FLOAT(props, bokeh_threshold);
|
||||
|
||||
// EEVEE_GET_FLOAT_ARRAY(props, bloom_color, 3);
|
||||
// EEVEE_GET_FLOAT(props, bloom_threshold);
|
||||
// EEVEE_GET_FLOAT(props, bloom_knee);
|
||||
// EEVEE_GET_FLOAT(props, bloom_intensity);
|
||||
// EEVEE_GET_FLOAT(props, bloom_radius);
|
||||
// EEVEE_GET_FLOAT(props, bloom_clamp);
|
||||
EEVEE_GET_FLOAT_ARRAY(props, bloom_color, 3);
|
||||
EEVEE_GET_FLOAT(props, bloom_threshold);
|
||||
EEVEE_GET_FLOAT(props, bloom_knee);
|
||||
EEVEE_GET_FLOAT(props, bloom_intensity);
|
||||
EEVEE_GET_FLOAT(props, bloom_radius);
|
||||
EEVEE_GET_FLOAT(props, bloom_clamp);
|
||||
|
||||
EEVEE_GET_INT(props, motion_blur_samples);
|
||||
EEVEE_GET_FLOAT(props, motion_blur_shutter_deprecated);
|
||||
|
||||
// EEVEE_GET_INT(props, shadow_method);
|
||||
EEVEE_GET_INT(props, shadow_cube_size_deprecated);
|
||||
// EEVEE_GET_INT(props, shadow_cascade_size);
|
||||
EEVEE_GET_INT(props, shadow_method);
|
||||
EEVEE_GET_INT(props, shadow_cube_size);
|
||||
EEVEE_GET_INT(props, shadow_cascade_size);
|
||||
|
||||
/* Cleanup. */
|
||||
IDP_FreeProperty(scene->layer_properties);
|
||||
@@ -3853,6 +3875,13 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "gi_cubemap_draw_size")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.gi_irradiance_draw_size = 0.1f;
|
||||
scene->eevee.gi_cubemap_draw_size = 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_member_exists(
|
||||
fd->filesdna, "RigidBodyWorld", "RigidBodyWorld_Shared", "*shared"))
|
||||
{
|
||||
@@ -4309,9 +4338,22 @@ void blo_do_versions_280(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "gi_irradiance_smoothing"))
|
||||
{
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.gi_irradiance_smoothing = 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "gi_filter_quality")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.gi_filter_quality = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "Light", "float", "att_dist")) {
|
||||
LISTBASE_FOREACH (Light *, la, &bmain->lights) {
|
||||
la->att_dist = la->clipend_deprecated;
|
||||
la->att_dist = la->clip_end;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1773,6 +1773,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
if (!DNA_struct_member_exists(fd->filesdna, "SceneEEVEE", "float", "bokeh_overblur")) {
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
scene->eevee.bokeh_neighbor_max = 10.0f;
|
||||
scene->eevee.bokeh_denoise_fac = 0.75f;
|
||||
scene->eevee.bokeh_overblur = 5.0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1148,13 +1148,13 @@ void do_versions_after_linking_400(FileData *fd, Main *bmain)
|
||||
bmain, NTREE_SHADER, SH_NODE_SUBSURFACE_SCATTERING, 4, 1, 5);
|
||||
}
|
||||
|
||||
// if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 50)) {
|
||||
// if (all_scenes_use(bmain, {RE_engine_id_BLENDER_EEVEE})) {
|
||||
// LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
// versioning_eevee_shadow_settings(object);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 50)) {
|
||||
if (all_scenes_use(bmain, {RE_engine_id_BLENDER_EEVEE})) {
|
||||
LISTBASE_FOREACH (Object *, object, &bmain->objects) {
|
||||
versioning_eevee_shadow_settings(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 51)) {
|
||||
// /* Convert blend method to math nodes. */
|
||||
@@ -4335,9 +4335,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
// if (!MAIN_VERSION_FILE_ATLEAST(bmain, 402, 31)) {
|
||||
// bool only_uses_eevee_legacy_or_workbench = true;
|
||||
// LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
// if (!(STREQ(scene->r.engine, RE_engine_id_BLENDER_EEVEE) ||
|
||||
// STREQ(scene->r.engine, RE_engine_id_BLENDER_WORKBENCH)))
|
||||
// {
|
||||
// if (!STR_ELEM(scene->r.engine, RE_engine_id_BLENDER_EEVEE, RE_engine_id_BLENDER_WORKBENCH)) {
|
||||
// only_uses_eevee_legacy_or_workbench = false;
|
||||
// }
|
||||
// }
|
||||
@@ -4387,7 +4385,7 @@ void blo_do_versions_400(FileData *fd, Library * /*lib*/, Main *bmain)
|
||||
bool shadow_resolution_absolute = false;
|
||||
/* Try to get default resolution from scene setting. */
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
shadow_max_res_local = (2.0f * M_SQRT2) / scene->eevee.shadow_cube_size_deprecated;
|
||||
shadow_max_res_local = (2.0f * M_SQRT2) / scene->eevee.shadow_cube_size;
|
||||
/* Round to avoid weird numbers in the UI. */
|
||||
shadow_max_res_local = ceil(shadow_max_res_local * 1000.0f) / 1000.0f;
|
||||
shadow_resolution_absolute = true;
|
||||
|
||||
@@ -371,6 +371,12 @@ static void blo_update_defaults_scene(Main *bmain, Scene *scene)
|
||||
copy_v2_fl2(scene->safe_areas.title, 0.1f, 0.05f);
|
||||
copy_v2_fl2(scene->safe_areas.action, 0.035f, 0.035f);
|
||||
|
||||
/* Change default cube-map quality. */
|
||||
scene->eevee.gi_filter_quality = 3.0f;
|
||||
|
||||
/* Enable Soft Shadows by default. */
|
||||
scene->eevee.flag |= SCE_EEVEE_SHADOW_SOFT;
|
||||
|
||||
/* Default Rotate Increment. */
|
||||
const float default_snap_angle_increment = DEG2RADF(5.0f);
|
||||
scene->toolsettings->snap_angle_increment_2d = default_snap_angle_increment;
|
||||
|
||||
@@ -725,6 +725,7 @@ void update_id_after_copy(const Depsgraph *depsgraph,
|
||||
Scene *scene_cow = (Scene *)id_cow;
|
||||
const Scene *scene_orig = (const Scene *)id_orig;
|
||||
scene_cow->toolsettings = scene_orig->toolsettings;
|
||||
scene_cow->eevee.light_cache_data = scene_orig->eevee.light_cache_data;
|
||||
scene_setup_view_layers_after_remap(depsgraph, id_node, reinterpret_cast<Scene *>(id_cow));
|
||||
break;
|
||||
}
|
||||
@@ -944,6 +945,7 @@ void discard_scene_pointers(ID *id_cow)
|
||||
{
|
||||
Scene *scene_cow = (Scene *)id_cow;
|
||||
scene_cow->toolsettings = nullptr;
|
||||
scene_cow->eevee.light_cache_data = nullptr;
|
||||
}
|
||||
|
||||
/* nullptr-ify all edit mode pointers which points to data from
|
||||
|
||||
@@ -838,9 +838,12 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
|
||||
bool use_sculpt_pbvh = BKE_sculptsession_use_pbvh_draw(ob, draw_ctx->rv3d) &&
|
||||
!DRW_state_is_image_render();
|
||||
|
||||
if (ob->sculpt && BKE_object_sculpt_pbvh_get(ob)) {
|
||||
BKE_pbvh_is_drawing_set(*BKE_object_sculpt_pbvh_get(ob), use_sculpt_pbvh);
|
||||
}
|
||||
/* Seems this is not needed anymore? Comparing to eevee next similar function
|
||||
* this section is removed
|
||||
*/
|
||||
// if (ob->sculpt && blender::bke::object::pbvh_get(*ob)) {
|
||||
// BKE_pbvh_is_drawing_set(*blender::bke::object::pbvh_get(*ob), use_sculpt_pbvh);
|
||||
// }
|
||||
|
||||
/* First get materials for this mesh. */
|
||||
if (ELEM(ob->type, OB_MESH, OB_SURF)) {
|
||||
@@ -912,11 +915,11 @@ void EEVEE_materials_cache_populate(EEVEE_Data *vedata,
|
||||
}
|
||||
}
|
||||
|
||||
if (G.debug_value == 889 && ob->sculpt && BKE_object_sculpt_pbvh_get(ob)) {
|
||||
if (G.debug_value == 889 && ob->sculpt && blender::bke::object::pbvh_get(*ob)) {
|
||||
int debug_node_nr = 0;
|
||||
DRW_debug_modelmat(ob->object_to_world().ptr());
|
||||
BKE_pbvh_draw_debug_cb(
|
||||
*BKE_object_sculpt_pbvh_get(ob), DRW_sculpt_debug_cb, &debug_node_nr);
|
||||
*blender::bke::object::pbvh_get(*ob), DRW_sculpt_debug_cb, &debug_node_nr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1038,23 +1038,23 @@ Material *EEVEE_material_default_diffuse_get()
|
||||
if (!e_data.diffuse_mat) {
|
||||
Material *ma = static_cast<Material *>(BKE_id_new_nomain(ID_MA, "EEVEEE default diffuse"));
|
||||
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::node_tree_add_tree_embedded(
|
||||
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
ma->use_nodes = true;
|
||||
|
||||
bNode *bsdf = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_BSDF_DIFFUSE);
|
||||
bNodeSocket *base_color = blender::bke::nodeFindSocket(bsdf, SOCK_IN, "Color");
|
||||
bNode *bsdf = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_BSDF_DIFFUSE);
|
||||
bNodeSocket *base_color = blender::bke::node_find_socket(bsdf, SOCK_IN, "Color");
|
||||
copy_v3_fl(((bNodeSocketValueRGBA *)base_color->default_value)->value, 0.8f);
|
||||
|
||||
bNode *output = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
bNode *output = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
|
||||
blender::bke::nodeAddLink(ntree,
|
||||
blender::bke::node_add_link(ntree,
|
||||
bsdf,
|
||||
blender::bke::nodeFindSocket(bsdf, SOCK_OUT, "BSDF"),
|
||||
blender::bke::node_find_socket(bsdf, SOCK_OUT, "BSDF"),
|
||||
output,
|
||||
blender::bke::nodeFindSocket(output, SOCK_IN, "Surface"));
|
||||
blender::bke::node_find_socket(output, SOCK_IN, "Surface"));
|
||||
|
||||
blender::bke::nodeSetActive(ntree, output);
|
||||
blender::bke::node_set_active(ntree, output);
|
||||
e_data.diffuse_mat = ma;
|
||||
}
|
||||
return e_data.diffuse_mat;
|
||||
@@ -1065,25 +1065,25 @@ Material *EEVEE_material_default_glossy_get()
|
||||
if (!e_data.glossy_mat) {
|
||||
Material *ma = static_cast<Material *>(BKE_id_new_nomain(ID_MA, "EEVEEE default metal"));
|
||||
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::node_tree_add_tree_embedded(
|
||||
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
ma->use_nodes = true;
|
||||
|
||||
bNode *bsdf = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_BSDF_GLOSSY);
|
||||
bNodeSocket *base_color = blender::bke::nodeFindSocket(bsdf, SOCK_IN, "Color");
|
||||
bNode *bsdf = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_BSDF_GLOSSY);
|
||||
bNodeSocket *base_color = blender::bke::node_find_socket(bsdf, SOCK_IN, "Color");
|
||||
copy_v3_fl(((bNodeSocketValueRGBA *)base_color->default_value)->value, 1.0f);
|
||||
bNodeSocket *roughness = blender::bke::nodeFindSocket(bsdf, SOCK_IN, "Roughness");
|
||||
bNodeSocket *roughness = blender::bke::node_find_socket(bsdf, SOCK_IN, "Roughness");
|
||||
((bNodeSocketValueFloat *)roughness->default_value)->value = 0.0f;
|
||||
|
||||
bNode *output = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
bNode *output = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
|
||||
blender::bke::nodeAddLink(ntree,
|
||||
blender::bke::node_add_link(ntree,
|
||||
bsdf,
|
||||
blender::bke::nodeFindSocket(bsdf, SOCK_OUT, "BSDF"),
|
||||
blender::bke::node_find_socket(bsdf, SOCK_OUT, "BSDF"),
|
||||
output,
|
||||
blender::bke::nodeFindSocket(output, SOCK_IN, "Surface"));
|
||||
blender::bke::node_find_socket(output, SOCK_IN, "Surface"));
|
||||
|
||||
blender::bke::nodeSetActive(ntree, output);
|
||||
blender::bke::node_set_active(ntree, output);
|
||||
e_data.glossy_mat = ma;
|
||||
}
|
||||
return e_data.glossy_mat;
|
||||
@@ -1094,24 +1094,24 @@ Material *EEVEE_material_default_error_get()
|
||||
if (!e_data.error_mat) {
|
||||
Material *ma = static_cast<Material *>(BKE_id_new_nomain(ID_MA, "EEVEEE default error"));
|
||||
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTreeEmbedded(
|
||||
bNodeTree *ntree = blender::bke::node_tree_add_tree_embedded(
|
||||
nullptr, &ma->id, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
ma->use_nodes = true;
|
||||
|
||||
/* Use emission and output material to be compatible with both World and Material. */
|
||||
bNode *bsdf = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_EMISSION);
|
||||
bNodeSocket *color = blender::bke::nodeFindSocket(bsdf, SOCK_IN, "Color");
|
||||
bNode *bsdf = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_EMISSION);
|
||||
bNodeSocket *color = blender::bke::node_find_socket(bsdf, SOCK_IN, "Color");
|
||||
copy_v3_fl3(((bNodeSocketValueRGBA *)color->default_value)->value, 1.0f, 0.0f, 1.0f);
|
||||
|
||||
bNode *output = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
bNode *output = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
|
||||
blender::bke::nodeAddLink(ntree,
|
||||
blender::bke::node_add_link(ntree,
|
||||
bsdf,
|
||||
blender::bke::nodeFindSocket(bsdf, SOCK_OUT, "Emission"),
|
||||
blender::bke::node_find_socket(bsdf, SOCK_OUT, "Emission"),
|
||||
output,
|
||||
blender::bke::nodeFindSocket(output, SOCK_IN, "Surface"));
|
||||
blender::bke::node_find_socket(output, SOCK_IN, "Surface"));
|
||||
|
||||
blender::bke::nodeSetActive(ntree, output);
|
||||
blender::bke::node_set_active(ntree, output);
|
||||
e_data.error_mat = ma;
|
||||
}
|
||||
return e_data.error_mat;
|
||||
@@ -1121,23 +1121,23 @@ bNodeTree *EEVEE_shader_default_surface_nodetree(Material *ma)
|
||||
{
|
||||
/* WARNING: This function is not threadsafe. Which is not a problem for the moment. */
|
||||
if (!e_data.surface.ntree) {
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTree(
|
||||
bNodeTree *ntree = blender::bke::node_tree_add_tree(
|
||||
nullptr, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
bNode *bsdf = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_BSDF_PRINCIPLED);
|
||||
bNode *output = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
bNodeSocket *bsdf_out = blender::bke::nodeFindSocket(bsdf, SOCK_OUT, "BSDF");
|
||||
bNodeSocket *output_in = blender::bke::nodeFindSocket(output, SOCK_IN, "Surface");
|
||||
blender::bke::nodeAddLink(ntree, bsdf, bsdf_out, output, output_in);
|
||||
blender::bke::nodeSetActive(ntree, output);
|
||||
bNode *bsdf = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_BSDF_PRINCIPLED);
|
||||
bNode *output = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_OUTPUT_MATERIAL);
|
||||
bNodeSocket *bsdf_out = blender::bke::node_find_socket(bsdf, SOCK_OUT, "BSDF");
|
||||
bNodeSocket *output_in = blender::bke::node_find_socket(output, SOCK_IN, "Surface");
|
||||
blender::bke::node_add_link(ntree, bsdf, bsdf_out, output, output_in);
|
||||
blender::bke::node_set_active(ntree, output);
|
||||
|
||||
e_data.surface.color_socket = static_cast<bNodeSocketValueRGBA *>(
|
||||
blender::bke::nodeFindSocket(bsdf, SOCK_IN, "Base Color")->default_value);
|
||||
blender::bke::node_find_socket(bsdf, SOCK_IN, "Base Color")->default_value);
|
||||
e_data.surface.metallic_socket = static_cast<bNodeSocketValueFloat *>(
|
||||
blender::bke::nodeFindSocket(bsdf, SOCK_IN, "Metallic")->default_value);
|
||||
blender::bke::node_find_socket(bsdf, SOCK_IN, "Metallic")->default_value);
|
||||
e_data.surface.roughness_socket = static_cast<bNodeSocketValueFloat *>(
|
||||
blender::bke::nodeFindSocket(bsdf, SOCK_IN, "Roughness")->default_value);
|
||||
blender::bke::node_find_socket(bsdf, SOCK_IN, "Roughness")->default_value);
|
||||
e_data.surface.specular_socket = static_cast<bNodeSocketValueFloat *>(
|
||||
blender::bke::nodeFindSocket(bsdf, SOCK_IN, "Specular IOR Level")->default_value);
|
||||
blender::bke::node_find_socket(bsdf, SOCK_IN, "Specular IOR Level")->default_value);
|
||||
e_data.surface.ntree = ntree;
|
||||
}
|
||||
/* Update */
|
||||
@@ -1153,17 +1153,17 @@ bNodeTree *EEVEE_shader_default_world_nodetree(World *wo)
|
||||
{
|
||||
/* WARNING: This function is not threadsafe. Which is not a problem for the moment. */
|
||||
if (!e_data.world.ntree) {
|
||||
bNodeTree *ntree = blender::bke::ntreeAddTree(
|
||||
bNodeTree *ntree = blender::bke::node_tree_add_tree(
|
||||
nullptr, "Shader Nodetree", ntreeType_Shader->idname);
|
||||
bNode *bg = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_BACKGROUND);
|
||||
bNode *output = blender::bke::nodeAddStaticNode(nullptr, ntree, SH_NODE_OUTPUT_WORLD);
|
||||
bNodeSocket *bg_out = blender::bke::nodeFindSocket(bg, SOCK_OUT, "Background");
|
||||
bNodeSocket *output_in = blender::bke::nodeFindSocket(output, SOCK_IN, "Surface");
|
||||
blender::bke::nodeAddLink(ntree, bg, bg_out, output, output_in);
|
||||
blender::bke::nodeSetActive(ntree, output);
|
||||
bNode *bg = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_BACKGROUND);
|
||||
bNode *output = blender::bke::node_add_static_node(nullptr, ntree, SH_NODE_OUTPUT_WORLD);
|
||||
bNodeSocket *bg_out = blender::bke::node_find_socket(bg, SOCK_OUT, "Background");
|
||||
bNodeSocket *output_in = blender::bke::node_find_socket(output, SOCK_IN, "Surface");
|
||||
blender::bke::node_add_link(ntree, bg, bg_out, output, output_in);
|
||||
blender::bke::node_set_active(ntree, output);
|
||||
|
||||
e_data.world.color_socket = static_cast<bNodeSocketValueRGBA *>(
|
||||
blender::bke::nodeFindSocket(bg, SOCK_IN, "Color")->default_value);
|
||||
blender::bke::node_find_socket(bg, SOCK_IN, "Color")->default_value);
|
||||
e_data.world.ntree = ntree;
|
||||
}
|
||||
|
||||
@@ -1568,12 +1568,12 @@ void EEVEE_shaders_free()
|
||||
e_data.error_mat = nullptr;
|
||||
}
|
||||
if (e_data.surface.ntree) {
|
||||
blender::bke::ntreeFreeEmbeddedTree(e_data.surface.ntree);
|
||||
blender::bke::node_tree_free_embedded_tree(e_data.surface.ntree);
|
||||
MEM_freeN(e_data.surface.ntree);
|
||||
e_data.surface.ntree = nullptr;
|
||||
}
|
||||
if (e_data.world.ntree) {
|
||||
blender::bke::ntreeFreeEmbeddedTree(e_data.world.ntree);
|
||||
blender::bke::node_tree_free_embedded_tree(e_data.world.ntree);
|
||||
MEM_freeN(e_data.world.ntree);
|
||||
e_data.world.ntree = nullptr;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ void neighbor_blend(
|
||||
void main()
|
||||
{
|
||||
ivec2 center_texel = ivec2(gl_FragCoord.xy);
|
||||
float line_kernel = sizePixel * 0.5 - 0.5;
|
||||
float line_kernel = sizeLine * 0.5 - 0.5;
|
||||
|
||||
fragColor = texelFetch(colorTex, center_texel, 0);
|
||||
|
||||
|
||||
@@ -260,6 +260,44 @@ void DRW_texture_free(GPUTexture *tex);
|
||||
} while (0)
|
||||
|
||||
/* Shaders */
|
||||
GPUShader *DRW_shader_create_from_info_name(const char *info_name);
|
||||
GPUShader *DRW_shader_create_ex(
|
||||
const char *vert, const char *geom, const char *frag, const char *defines, const char *name);
|
||||
GPUShader *DRW_shader_create_with_lib_ex(const char *vert,
|
||||
const char *geom,
|
||||
const char *frag,
|
||||
const char *lib,
|
||||
const char *defines,
|
||||
const char *name);
|
||||
GPUShader *DRW_shader_create_with_shaderlib_ex(const char *vert,
|
||||
const char *geom,
|
||||
const char *frag,
|
||||
const DRWShaderLibrary *lib,
|
||||
const char *defines,
|
||||
const char *name);
|
||||
GPUShader *DRW_shader_create_with_transform_feedback(const char *vert,
|
||||
const char *geom,
|
||||
const char *defines,
|
||||
eGPUShaderTFBType prim_type,
|
||||
const char **varying_names,
|
||||
int varying_count);
|
||||
GPUShader *DRW_shader_create_fullscreen_ex(const char *frag,
|
||||
const char *defines,
|
||||
const char *name);
|
||||
GPUShader *DRW_shader_create_fullscreen_with_shaderlib_ex(const char *frag,
|
||||
const DRWShaderLibrary *lib,
|
||||
const char *defines,
|
||||
const char *name);
|
||||
#define DRW_shader_create(vert, geom, frag, defines) \
|
||||
DRW_shader_create_ex(vert, geom, frag, defines, __func__)
|
||||
#define DRW_shader_create_with_lib(vert, geom, frag, lib, defines) \
|
||||
DRW_shader_create_with_lib_ex(vert, geom, frag, lib, defines, __func__)
|
||||
#define DRW_shader_create_with_shaderlib(vert, geom, frag, lib, defines) \
|
||||
DRW_shader_create_with_shaderlib_ex(vert, geom, frag, lib, defines, __func__)
|
||||
#define DRW_shader_create_fullscreen(frag, defines) \
|
||||
DRW_shader_create_fullscreen_ex(frag, defines, __func__)
|
||||
#define DRW_shader_create_fullscreen_with_shaderlib(frag, lib, defines) \
|
||||
DRW_shader_create_fullscreen_with_shaderlib_ex(frag, lib, defines, __func__)
|
||||
void DRW_shader_init();
|
||||
void DRW_shader_exit();
|
||||
|
||||
@@ -291,6 +329,36 @@ void DRW_shader_free(GPUShader *shader);
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
DRWShaderLibrary *DRW_shader_library_create();
|
||||
|
||||
/**
|
||||
* \warning Each library must be added after all its dependencies.
|
||||
*/
|
||||
void DRW_shader_library_add_file(DRWShaderLibrary *lib,
|
||||
const char *lib_code,
|
||||
const char *lib_name);
|
||||
#define DRW_SHADER_LIB_ADD(lib, lib_name) \
|
||||
DRW_shader_library_add_file(lib, datatoc_##lib_name##_glsl, STRINGIFY(lib_name) ".glsl")
|
||||
|
||||
#define DRW_SHADER_LIB_ADD_SHARED(lib, lib_name) \
|
||||
DRW_shader_library_add_file(lib, datatoc_##lib_name##_h, STRINGIFY(lib_name) ".h")
|
||||
|
||||
/**
|
||||
* \return an allocN'ed string containing the shader code with its dependencies prepended.
|
||||
* Caller must free the string with #MEM_freeN after use.
|
||||
*/
|
||||
char *DRW_shader_library_create_shader_string(const DRWShaderLibrary *lib,
|
||||
const char *shader_code);
|
||||
|
||||
void DRW_shader_library_free(DRWShaderLibrary *lib);
|
||||
#define DRW_SHADER_LIB_FREE_SAFE(lib) \
|
||||
do { \
|
||||
if (lib != nullptr) { \
|
||||
DRW_shader_library_free(lib); \
|
||||
lib = nullptr; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Batches */
|
||||
|
||||
enum eDRWAttrType {
|
||||
|
||||
@@ -730,6 +730,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, const Object *ob)
|
||||
else {
|
||||
ob_infos->ob_flag += (ob == DST.draw_ctx.obact) ? (1 << 4) : 0;
|
||||
}
|
||||
ob_infos->ob_flag += (ob->base_flag & BASE_HOLDOUT) ? (1 << 5) : 0;
|
||||
/* Negative scaling. */
|
||||
ob_infos->ob_flag *= (ob->transflag & OB_NEG_SCALE) ? -1.0f : 1.0f;
|
||||
/* Object Color. */
|
||||
|
||||
@@ -34,6 +34,10 @@
|
||||
|
||||
#include "draw_manager_c.hh"
|
||||
|
||||
#include "CLG_log.h"
|
||||
|
||||
static CLG_LogRef LOG = {"draw.manager.shader"};
|
||||
|
||||
#include <atomic>
|
||||
#include <condition_variable>
|
||||
#include <mutex>
|
||||
@@ -437,6 +441,11 @@ GPUMaterial *DRW_shader_from_material(Material *ma,
|
||||
|
||||
drw_register_shader_vlattrs(mat);
|
||||
|
||||
if (DRW_state_is_image_render()) {
|
||||
/* Do not deferred if doing render. */
|
||||
deferred = false;
|
||||
}
|
||||
|
||||
drw_deferred_shader_add(mat, deferred);
|
||||
DRW_shader_queue_optimize_material(mat);
|
||||
return mat;
|
||||
@@ -491,3 +500,247 @@ void DRW_shader_free(GPUShader *shader)
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
/** \{ */
|
||||
|
||||
GPUShader *DRW_shader_create_from_info_name(const char *info_name)
|
||||
{
|
||||
return GPU_shader_create_from_info_name(info_name);
|
||||
}
|
||||
|
||||
GPUShader *DRW_shader_create_ex(
|
||||
const char *vert, const char *geom, const char *frag, const char *defines, const char *name)
|
||||
{
|
||||
return GPU_shader_create(vert, frag, geom, nullptr, defines, name);
|
||||
}
|
||||
|
||||
GPUShader *DRW_shader_create_with_lib_ex(const char *vert,
|
||||
const char *geom,
|
||||
const char *frag,
|
||||
const char *lib,
|
||||
const char *defines,
|
||||
const char *name)
|
||||
{
|
||||
GPUShader *sh;
|
||||
char *vert_with_lib = nullptr;
|
||||
char *frag_with_lib = nullptr;
|
||||
char *geom_with_lib = nullptr;
|
||||
|
||||
vert_with_lib = BLI_string_joinN(lib, vert);
|
||||
frag_with_lib = BLI_string_joinN(lib, frag);
|
||||
if (geom) {
|
||||
geom_with_lib = BLI_string_joinN(lib, geom);
|
||||
}
|
||||
|
||||
sh = GPU_shader_create(vert_with_lib, frag_with_lib, geom_with_lib, nullptr, defines, name);
|
||||
|
||||
MEM_freeN(vert_with_lib);
|
||||
MEM_freeN(frag_with_lib);
|
||||
if (geom) {
|
||||
MEM_freeN(geom_with_lib);
|
||||
}
|
||||
|
||||
return sh;
|
||||
}
|
||||
|
||||
GPUShader *DRW_shader_create_with_shaderlib_ex(const char *vert,
|
||||
const char *geom,
|
||||
const char *frag,
|
||||
const DRWShaderLibrary *lib,
|
||||
const char *defines,
|
||||
const char *name)
|
||||
{
|
||||
GPUShader *sh;
|
||||
char *vert_with_lib = DRW_shader_library_create_shader_string(lib, vert);
|
||||
char *frag_with_lib = DRW_shader_library_create_shader_string(lib, frag);
|
||||
char *geom_with_lib = (geom) ? DRW_shader_library_create_shader_string(lib, geom) : nullptr;
|
||||
|
||||
sh = GPU_shader_create(vert_with_lib, frag_with_lib, geom_with_lib, nullptr, defines, name);
|
||||
|
||||
MEM_SAFE_FREE(vert_with_lib);
|
||||
MEM_SAFE_FREE(frag_with_lib);
|
||||
MEM_SAFE_FREE(geom_with_lib);
|
||||
|
||||
return sh;
|
||||
}
|
||||
|
||||
GPUShader *DRW_shader_create_with_transform_feedback(const char *vert,
|
||||
const char *geom,
|
||||
const char *defines,
|
||||
const eGPUShaderTFBType prim_type,
|
||||
const char **varying_names,
|
||||
const int varying_count)
|
||||
{
|
||||
return GPU_shader_create_ex(vert,
|
||||
datatoc_gpu_shader_depth_only_frag_glsl,
|
||||
geom,
|
||||
nullptr,
|
||||
nullptr,
|
||||
defines,
|
||||
prim_type,
|
||||
varying_names,
|
||||
varying_count,
|
||||
__func__);
|
||||
}
|
||||
|
||||
GPUShader *DRW_shader_create_fullscreen_ex(const char *frag, const char *defines, const char *name)
|
||||
{
|
||||
return GPU_shader_create(
|
||||
datatoc_common_fullscreen_vert_glsl, frag, nullptr, nullptr, defines, name);
|
||||
}
|
||||
|
||||
GPUShader *DRW_shader_create_fullscreen_with_shaderlib_ex(const char *frag,
|
||||
const DRWShaderLibrary *lib,
|
||||
const char *defines,
|
||||
const char *name)
|
||||
{
|
||||
|
||||
GPUShader *sh;
|
||||
char *vert = datatoc_common_fullscreen_vert_glsl;
|
||||
char *frag_with_lib = DRW_shader_library_create_shader_string(lib, frag);
|
||||
|
||||
sh = GPU_shader_create(vert, frag_with_lib, nullptr, nullptr, defines, name);
|
||||
|
||||
MEM_SAFE_FREE(frag_with_lib);
|
||||
|
||||
return sh;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Shader Library
|
||||
*
|
||||
* Simple include system for glsl files.
|
||||
*
|
||||
* Usage: Create a DRWShaderLibrary and add the library in the right order.
|
||||
* You can have nested dependencies but each new library needs to have all its dependencies already
|
||||
* added to the DRWShaderLibrary.
|
||||
* Finally you can use DRW_shader_library_create_shader_string to get a shader string that also
|
||||
* contains the needed libraries for this shader.
|
||||
* \{ */
|
||||
|
||||
/* 64 because we use a 64bit bitmap. */
|
||||
#define MAX_LIB 64
|
||||
#define MAX_LIB_NAME 64
|
||||
#define MAX_LIB_DEPS 8
|
||||
|
||||
struct DRWShaderLibrary {
|
||||
const char *libs[MAX_LIB];
|
||||
char libs_name[MAX_LIB][MAX_LIB_NAME];
|
||||
uint64_t libs_deps[MAX_LIB];
|
||||
};
|
||||
|
||||
DRWShaderLibrary *DRW_shader_library_create()
|
||||
{
|
||||
return static_cast<DRWShaderLibrary *>(
|
||||
MEM_callocN(sizeof(DRWShaderLibrary), "DRWShaderLibrary"));
|
||||
}
|
||||
|
||||
void DRW_shader_library_free(DRWShaderLibrary *lib)
|
||||
{
|
||||
MEM_SAFE_FREE(lib);
|
||||
}
|
||||
|
||||
static int drw_shader_library_search(const DRWShaderLibrary *lib, const char *name)
|
||||
{
|
||||
for (int i = 0; i < MAX_LIB; i++) {
|
||||
if (lib->libs[i]) {
|
||||
if (!strncmp(lib->libs_name[i], name, strlen(lib->libs_name[i]))) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Return bitmap of dependencies. */
|
||||
static uint64_t drw_shader_dependencies_get(const DRWShaderLibrary *lib,
|
||||
const char *pragma_str,
|
||||
const char *lib_code,
|
||||
const char * /*lib_name*/)
|
||||
{
|
||||
/* Search dependencies. */
|
||||
uint pragma_len = strlen(pragma_str);
|
||||
uint64_t deps = 0;
|
||||
const char *haystack = lib_code;
|
||||
while ((haystack = strstr(haystack, pragma_str))) {
|
||||
haystack += pragma_len;
|
||||
int dep = drw_shader_library_search(lib, haystack);
|
||||
if (dep == -1) {
|
||||
char dbg_name[MAX_NAME];
|
||||
int i = 0;
|
||||
while ((*haystack != ')') && (i < (sizeof(dbg_name) - 2))) {
|
||||
dbg_name[i] = *haystack;
|
||||
haystack++;
|
||||
i++;
|
||||
}
|
||||
dbg_name[i] = '\0';
|
||||
|
||||
CLOG_INFO(&LOG,
|
||||
0,
|
||||
"Dependency '%s' not found\n"
|
||||
"This might be due to bad lib ordering or overriding a builtin shader.\n",
|
||||
dbg_name);
|
||||
}
|
||||
else {
|
||||
deps |= 1llu << uint64_t(dep);
|
||||
}
|
||||
}
|
||||
return deps;
|
||||
}
|
||||
|
||||
void DRW_shader_library_add_file(DRWShaderLibrary *lib, const char *lib_code, const char *lib_name)
|
||||
{
|
||||
int index = -1;
|
||||
for (int i = 0; i < MAX_LIB; i++) {
|
||||
if (lib->libs[i] == nullptr) {
|
||||
index = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (index > -1) {
|
||||
lib->libs[index] = lib_code;
|
||||
STRNCPY(lib->libs_name[index], lib_name);
|
||||
lib->libs_deps[index] = drw_shader_dependencies_get(
|
||||
lib, "BLENDER_REQUIRE(", lib_code, lib_name);
|
||||
}
|
||||
else {
|
||||
printf("Error: Too many libraries. Cannot add %s.\n", lib_name);
|
||||
BLI_assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
char *DRW_shader_library_create_shader_string(const DRWShaderLibrary *lib, const char *shader_code)
|
||||
{
|
||||
uint64_t deps = drw_shader_dependencies_get(lib, "BLENDER_REQUIRE(", shader_code, "shader code");
|
||||
|
||||
DynStr *ds = BLI_dynstr_new();
|
||||
/* Add all dependencies recursively. */
|
||||
for (int i = MAX_LIB - 1; i > -1; i--) {
|
||||
if (lib->libs[i] && (deps & (1llu << uint64_t(i)))) {
|
||||
deps |= lib->libs_deps[i];
|
||||
}
|
||||
}
|
||||
/* Concatenate all needed libs into one string. */
|
||||
for (int i = 0; i < MAX_LIB && deps != 0llu; i++, deps >>= 1llu) {
|
||||
if (deps & 1llu) {
|
||||
BLI_dynstr_append(ds, lib->libs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
BLI_dynstr_append(ds, shader_code);
|
||||
|
||||
char *str = BLI_dynstr_get_cstring(ds);
|
||||
BLI_dynstr_free(ds);
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
@@ -293,6 +293,7 @@ float get_homogenous_z_offset(float vs_z, float hs_w, float vs_offset)
|
||||
#define DRW_BASE_FROM_DUPLI (1 << 2)
|
||||
#define DRW_BASE_FROM_SET (1 << 3)
|
||||
#define DRW_BASE_ACTIVE (1 << 4)
|
||||
#define DRW_BASE_HOLDOUT (1 << 5)
|
||||
|
||||
/* Wire Color Types, matching eV3DShadingColorType. */
|
||||
#define V3D_SHADING_SINGLE_COLOR 2
|
||||
|
||||
@@ -11089,7 +11089,7 @@ static int ui_handle_menu_event(bContext *C,
|
||||
|
||||
/* Menu search if space-bar or #MenuTypeFlag::SearchOnKeyPress. */
|
||||
MenuType *mt = WM_menutype_find(menu->menu_idname, true);
|
||||
if ((mt && bool(mt->flag & MenuTypeFlag::SearchOnKeyPress)) ||
|
||||
if ((mt && bool(mt->flag & MenuTypeFlag::SearchOnKeyPress) && !bool(U.experimental.disable_search_on_keypress)) ||
|
||||
event->type == EVT_SPACEKEY)
|
||||
{
|
||||
if ((level != 0) && (but == nullptr || !menu->menu_idname[0])) {
|
||||
|
||||
@@ -436,8 +436,7 @@ void collection_hide_menu_draw(const bContext *C, uiLayout *layout)
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
LayerCollection *lc_scene = static_cast<LayerCollection *>(view_layer->layer_collections.first);
|
||||
|
||||
/* Use the "invoke" operator context so the "Shift" modifier is used to extend. */
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_INVOKE_REGION_WIN);
|
||||
uiLayoutSetOperatorContext(layout, WM_OP_EXEC_REGION_WIN);
|
||||
|
||||
LISTBASE_FOREACH (LayerCollection *, lc, &lc_scene->layer_collections) {
|
||||
int index = BKE_layer_collection_findindex(view_layer, lc);
|
||||
|
||||
@@ -1619,11 +1619,6 @@ static int lightprobe_cache_bake_invoke(bContext *C, wmOperator *op, const wmEve
|
||||
|
||||
wmJob *wm_job = EEVEE_NEXT_lightbake_job_create(
|
||||
wm, win, bmain, view_layer, scene, probes, data->report, scene->r.cfra, 0);
|
||||
if (wm_job == nullptr) {
|
||||
MEM_delete(data);
|
||||
BKE_report(op->reports, RPT_WARNING, "Can't bake light probe while rendering");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
WM_event_add_modal_handler(C, op);
|
||||
|
||||
@@ -2855,12 +2850,6 @@ static int copy_material_exec(bContext *C, wmOperator *op)
|
||||
material_copybuffer_filepath_get(filepath, sizeof(filepath));
|
||||
copybuffer.write(filepath, *op->reports);
|
||||
|
||||
/* Restore some status info that may be affected by partial write process. */
|
||||
if (!is_fake_user) {
|
||||
id_fake_user_clear(&ma->id);
|
||||
}
|
||||
ma->id.us = usercount;
|
||||
|
||||
/* We are all done! */
|
||||
BKE_report(op->reports, RPT_INFO, "Copied material to internal clipboard");
|
||||
|
||||
|
||||
@@ -43,10 +43,8 @@
|
||||
#include "BKE_object.hh"
|
||||
#include "BKE_particle.h"
|
||||
#include "BKE_report.hh"
|
||||
#include "BKE_scene.hh"
|
||||
|
||||
#include "ANIM_bone_collections.hh"
|
||||
#include "ANIM_keyframing.hh"
|
||||
|
||||
#include "DEG_depsgraph.hh"
|
||||
#include "DEG_depsgraph_build.hh"
|
||||
@@ -303,8 +301,6 @@ static void outliner_object_set_flag_recursive_fn(bContext *C,
|
||||
ptr = RNA_pointer_create(&scene->id, &RNA_ObjectBase, base_iter);
|
||||
}
|
||||
RNA_property_boolean_set(&ptr, base_or_object_prop, value);
|
||||
blender::animrig::autokeyframe_property(
|
||||
C, scene, &ptr, base_or_object_prop, -1, BKE_scene_frame_get(scene), true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -831,11 +827,6 @@ static void namebutton_fn(bContext *C, void *tsep, char *oldname)
|
||||
undo_str = "Rename Modifier";
|
||||
break;
|
||||
}
|
||||
case TSE_MODIFIER: {
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER | NA_RENAME, nullptr);
|
||||
DEG_relations_tag_update(bmain);
|
||||
break;
|
||||
}
|
||||
case TSE_EBONE: {
|
||||
bArmature *arm = (bArmature *)tselem->id;
|
||||
if (arm->edbo) {
|
||||
@@ -3956,13 +3947,11 @@ static void outliner_draw_tree(bContext *C,
|
||||
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
|
||||
int starty, startx;
|
||||
|
||||
short columns_offset = use_mode_column ? UI_UNIT_X : 0;
|
||||
|
||||
/* Move the tree a unit left in view layer mode */
|
||||
if ((space_outliner->outlinevis == SO_VIEW_LAYER) &&
|
||||
!(space_outliner->filter & SO_FILTER_NO_COLLECTION) &&
|
||||
(space_outliner->filter & SO_FILTER_NO_VIEW_LAYERS))
|
||||
{
|
||||
short columns_offset = (use_mode_column && (space_outliner->outlinevis == SO_SCENES)) ?
|
||||
UI_UNIT_X :
|
||||
0;
|
||||
if (!use_mode_column && (space_outliner->outlinevis == SO_VIEW_LAYER)) {
|
||||
columns_offset -= UI_UNIT_X;
|
||||
}
|
||||
|
||||
|
||||
@@ -2022,6 +2022,14 @@ static void space_view3d_listener(const wmSpaceTypeListenerParams *params)
|
||||
|
||||
static void space_view3d_refresh(const bContext *C, ScrArea *area)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
LightCache *lcache = scene->eevee.light_cache_data;
|
||||
|
||||
if (lcache && (lcache->flag & LIGHTCACHE_UPDATE_AUTO) != 0) {
|
||||
lcache->flag &= ~LIGHTCACHE_UPDATE_AUTO;
|
||||
view3d_lightcache_update((bContext *)C);
|
||||
}
|
||||
|
||||
View3D *v3d = (View3D *)area->spacedata.first;
|
||||
MEM_SAFE_FREE(v3d->runtime.local_stats);
|
||||
|
||||
|
||||
@@ -138,6 +138,9 @@ struct TransData {
|
||||
TransDataCurveHandleFlags *hdata;
|
||||
/** If set, copy of Object or #bPoseChannel protection. */
|
||||
short protectflag;
|
||||
/** Local rotation accumulator for Trackball (is initialized) */
|
||||
short rotmtx_init;
|
||||
float rotmtx[3][3];
|
||||
};
|
||||
|
||||
#define TRANSDATA_THREAD_LIMIT 1024
|
||||
|
||||
@@ -53,7 +53,18 @@ static void transdata_elem_trackball(const TransInfo *t,
|
||||
float mat_buf[3][3];
|
||||
const float(*mat)[3] = mat_final;
|
||||
if (t->flag & T_PROP_EDIT) {
|
||||
if (UNLIKELY(!td->rotmtx_init)) {
|
||||
unit_m3(td->rotmtx);
|
||||
td->rotmtx_init = true;
|
||||
}
|
||||
axis_angle_normalized_to_mat3(mat_buf, axis, td->factor * angle);
|
||||
|
||||
/* Apply "continuous" trackball rotation. */
|
||||
if (U.uiflag & USER_ACCUMULATE_TRACKBALL) {
|
||||
mul_m3_m3_post(mat_buf, td->rotmtx);
|
||||
copy_m3_m3(td->rotmtx, mat_buf);
|
||||
}
|
||||
|
||||
mat = mat_buf;
|
||||
}
|
||||
ElementRotation(t, tc, td, mat, t->around);
|
||||
@@ -96,8 +107,16 @@ static void applyTrackballValue(TransInfo *t, const float axis[3], const float a
|
||||
float mat_final[3][3];
|
||||
int i;
|
||||
|
||||
/* Hack: Use otherwise-unused matrix storage for this */
|
||||
float (*mat_temp)[3] = t->orient[0].matrix;
|
||||
|
||||
axis_angle_normalized_to_mat3(mat_final, axis, angle);
|
||||
|
||||
if (U.uiflag & USER_ACCUMULATE_TRACKBALL) {
|
||||
mul_m3_m3_post(mat_final, mat_temp);
|
||||
copy_m3_m3(mat_temp, mat_final);
|
||||
}
|
||||
|
||||
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
|
||||
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
|
||||
TransData *td = tc->data;
|
||||
@@ -129,8 +148,17 @@ static void applyTrackball(TransInfo *t)
|
||||
size_t ofs = 0;
|
||||
float phi[2];
|
||||
|
||||
/* Store previous mouse coordinates as (z,w) in the xyzw vector */
|
||||
float* phi_prev = t->values + 2;
|
||||
|
||||
copy_v2_v2(phi, t->values);
|
||||
|
||||
/* Get mouse delta only since phi_prev */
|
||||
if (U.uiflag & USER_ACCUMULATE_TRACKBALL) {
|
||||
sub_v2_v2(phi, phi_prev);
|
||||
copy_v2_v2(phi_prev, t->values);
|
||||
}
|
||||
|
||||
transform_snap_increment(t, phi);
|
||||
|
||||
applyNumInput(&t->num, phi);
|
||||
@@ -193,6 +221,9 @@ static void initTrackball(TransInfo *t, wmOperator * /*op*/)
|
||||
|
||||
initMouseInputMode(t, &t->mouse, INPUT_TRACKBALL);
|
||||
|
||||
/* Initialize re-used matrix storage to I */
|
||||
unit_m3(t->orient[0].matrix);
|
||||
|
||||
t->idx_max = 1;
|
||||
t->num.idx_max = 1;
|
||||
t->snap[0] = DEG2RAD(5.0);
|
||||
|
||||
@@ -138,7 +138,9 @@ struct GPUMaterial {
|
||||
GPUTexture *sss_tex_profile; /* Texture containing SSS profile. */
|
||||
bool sss_enabled;
|
||||
float sss_radii[3];
|
||||
|
||||
int sss_samples;
|
||||
bool sss_dirty;
|
||||
|
||||
uint32_t refcount;
|
||||
|
||||
bool do_batch_compilation;
|
||||
@@ -389,6 +391,196 @@ struct GPUSssKernelData {
|
||||
|
||||
BLI_STATIC_ASSERT_ALIGN(GPUSssKernelData, 16)
|
||||
|
||||
static void sss_calculate_offsets(GPUSssKernelData *kd, int count, float exponent)
|
||||
{
|
||||
float step = 2.0f / float(count - 1);
|
||||
for (int i = 0; i < count; i++) {
|
||||
float o = float(i) * step - 1.0f;
|
||||
float sign = (o < 0.0f) ? -1.0f : 1.0f;
|
||||
float ofs = sign * fabsf(powf(o, exponent));
|
||||
kd->kernel[i][3] = ofs;
|
||||
}
|
||||
}
|
||||
|
||||
# define BURLEY_TRUNCATE 16.0f
|
||||
# define BURLEY_TRUNCATE_CDF 0.9963790093708328f // cdf(BURLEY_TRUNCATE)
|
||||
static float burley_profile(float r, float d)
|
||||
{
|
||||
float exp_r_3_d = expf(-r / (3.0f * d));
|
||||
float exp_r_d = exp_r_3_d * exp_r_3_d * exp_r_3_d;
|
||||
return (exp_r_d + exp_r_3_d) / (4.0f * d);
|
||||
}
|
||||
|
||||
static float eval_profile(float r, float param)
|
||||
{
|
||||
r = fabsf(r);
|
||||
return burley_profile(r, param) / BURLEY_TRUNCATE_CDF;
|
||||
}
|
||||
|
||||
/* Resolution for each sample of the precomputed kernel profile */
|
||||
# define INTEGRAL_RESOLUTION 32
|
||||
static float eval_integral(float x0, float x1, float param)
|
||||
{
|
||||
const float range = x1 - x0;
|
||||
const float step = range / INTEGRAL_RESOLUTION;
|
||||
float integral = 0.0f;
|
||||
|
||||
for (int i = 0; i < INTEGRAL_RESOLUTION; i++) {
|
||||
float x = x0 + range * (float(i) + 0.5f) / float(INTEGRAL_RESOLUTION);
|
||||
float y = eval_profile(x, param);
|
||||
integral += y * step;
|
||||
}
|
||||
|
||||
return integral;
|
||||
}
|
||||
# undef INTEGRAL_RESOLUTION
|
||||
|
||||
static void compute_sss_kernel(GPUSssKernelData *kd, const float radii[3], int sample_len)
|
||||
{
|
||||
float rad[3];
|
||||
/* Minimum radius */
|
||||
rad[0] = std::max(radii[0], 1e-15f);
|
||||
rad[1] = std::max(radii[1], 1e-15f);
|
||||
rad[2] = std::max(radii[2], 1e-15f);
|
||||
|
||||
kd->avg_inv_radius = 3.0f / (rad[0] + rad[1] + rad[2]);
|
||||
|
||||
/* Christensen-Burley fitting */
|
||||
float l[3], d[3];
|
||||
|
||||
mul_v3_v3fl(l, rad, 0.25f * M_1_PI);
|
||||
const float A = 1.0f;
|
||||
const float s = 1.9f - A + 3.5f * (A - 0.8f) * (A - 0.8f);
|
||||
/* XXX 0.6f Out of nowhere to match cycles! Empirical! Can be tweak better. */
|
||||
mul_v3_v3fl(d, l, 0.6f / s);
|
||||
mul_v3_v3fl(rad, d, BURLEY_TRUNCATE);
|
||||
kd->max_radius = std::max({rad[0], rad[1], rad[2]});
|
||||
|
||||
copy_v3_v3(kd->param, d);
|
||||
|
||||
/* Compute samples locations on the 1d kernel [-1..1] */
|
||||
sss_calculate_offsets(kd, sample_len, SSS_EXPONENT);
|
||||
|
||||
/* Weights sum for normalization */
|
||||
float sum[3] = {0.0f, 0.0f, 0.0f};
|
||||
|
||||
/* Compute integral of each sample footprint */
|
||||
for (int i = 0; i < sample_len; i++) {
|
||||
float x0, x1;
|
||||
|
||||
if (i == 0) {
|
||||
x0 = kd->kernel[0][3] - fabsf(kd->kernel[0][3] - kd->kernel[1][3]) / 2.0f;
|
||||
}
|
||||
else {
|
||||
x0 = (kd->kernel[i - 1][3] + kd->kernel[i][3]) / 2.0f;
|
||||
}
|
||||
|
||||
if (i == sample_len - 1) {
|
||||
x1 = kd->kernel[sample_len - 1][3] +
|
||||
fabsf(kd->kernel[sample_len - 2][3] - kd->kernel[sample_len - 1][3]) / 2.0f;
|
||||
}
|
||||
else {
|
||||
x1 = (kd->kernel[i][3] + kd->kernel[i + 1][3]) / 2.0f;
|
||||
}
|
||||
|
||||
x0 *= kd->max_radius;
|
||||
x1 *= kd->max_radius;
|
||||
|
||||
kd->kernel[i][0] = eval_integral(x0, x1, kd->param[0]);
|
||||
kd->kernel[i][1] = eval_integral(x0, x1, kd->param[1]);
|
||||
kd->kernel[i][2] = eval_integral(x0, x1, kd->param[2]);
|
||||
|
||||
sum[0] += kd->kernel[i][0];
|
||||
sum[1] += kd->kernel[i][1];
|
||||
sum[2] += kd->kernel[i][2];
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (sum[i] > 0.0f) {
|
||||
/* Normalize */
|
||||
for (int j = 0; j < sample_len; j++) {
|
||||
kd->kernel[j][i] /= sum[i];
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Avoid 0 kernel sum. */
|
||||
kd->kernel[sample_len / 2][i] = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
/* Put center sample at the start of the array (to sample first) */
|
||||
float tmpv[4];
|
||||
copy_v4_v4(tmpv, kd->kernel[sample_len / 2]);
|
||||
for (int i = sample_len / 2; i > 0; i--) {
|
||||
copy_v4_v4(kd->kernel[i], kd->kernel[i - 1]);
|
||||
}
|
||||
copy_v4_v4(kd->kernel[0], tmpv);
|
||||
|
||||
kd->samples = sample_len;
|
||||
}
|
||||
|
||||
# define INTEGRAL_RESOLUTION 512
|
||||
static void compute_sss_translucence_kernel(const GPUSssKernelData *kd,
|
||||
int resolution,
|
||||
float **output)
|
||||
{
|
||||
float(*texels)[4];
|
||||
texels = static_cast<float(*)[4]>(
|
||||
MEM_callocN(sizeof(float[4]) * resolution, "compute_sss_translucence_kernel"));
|
||||
*output = (float *)texels;
|
||||
|
||||
/* Last texel should be black, hence the - 1. */
|
||||
for (int i = 0; i < resolution - 1; i++) {
|
||||
/* Distance from surface. */
|
||||
float d = kd->max_radius * (float(i) + 0.00001f) / float(resolution);
|
||||
|
||||
/* For each distance d we compute the radiance incoming from an hypothetical parallel plane. */
|
||||
/* Compute radius of the footprint on the hypothetical plane. */
|
||||
float r_fp = sqrtf(kd->max_radius * kd->max_radius - d * d);
|
||||
float r_step = r_fp / INTEGRAL_RESOLUTION;
|
||||
float area_accum = 0.0f;
|
||||
for (float r = 0.0f; r < r_fp; r += r_step) {
|
||||
/* Compute distance to the "shading" point through the medium. */
|
||||
/* r_step * 0.5f to put sample between the area borders */
|
||||
float dist = hypotf(r + r_step * 0.5f, d);
|
||||
|
||||
float profile[3];
|
||||
profile[0] = eval_profile(dist, kd->param[0]);
|
||||
profile[1] = eval_profile(dist, kd->param[1]);
|
||||
profile[2] = eval_profile(dist, kd->param[2]);
|
||||
|
||||
/* Since the profile and configuration are radially symmetrical we
|
||||
* can just evaluate it once and weight it accordingly */
|
||||
float r_next = r + r_step;
|
||||
float disk_area = (M_PI * r_next * r_next) - (M_PI * r * r);
|
||||
|
||||
mul_v3_fl(profile, disk_area);
|
||||
add_v3_v3(texels[i], profile);
|
||||
area_accum += disk_area;
|
||||
}
|
||||
/* Normalize over the disk. */
|
||||
mul_v3_fl(texels[i], 1.0f / (area_accum));
|
||||
}
|
||||
|
||||
/* Normalize */
|
||||
for (int j = resolution - 2; j > 0; j--) {
|
||||
texels[j][0] /= (texels[0][0] > 0.0f) ? texels[0][0] : 1.0f;
|
||||
texels[j][1] /= (texels[0][1] > 0.0f) ? texels[0][1] : 1.0f;
|
||||
texels[j][2] /= (texels[0][2] > 0.0f) ? texels[0][2] : 1.0f;
|
||||
}
|
||||
|
||||
/* First texel should be white */
|
||||
texels[0][0] = (texels[0][0] > 0.0f) ? 1.0f : 0.0f;
|
||||
texels[0][1] = (texels[0][1] > 0.0f) ? 1.0f : 0.0f;
|
||||
texels[0][2] = (texels[0][2] > 0.0f) ? 1.0f : 0.0f;
|
||||
|
||||
/* dim the last few texels for smoother transition */
|
||||
mul_v3_fl(texels[resolution - 2], 0.25f);
|
||||
mul_v3_fl(texels[resolution - 3], 0.5f);
|
||||
mul_v3_fl(texels[resolution - 4], 0.75f);
|
||||
}
|
||||
# undef INTEGRAL_RESOLUTION
|
||||
|
||||
bool GPU_material_sss_profile_create(GPUMaterial *material, float radii[3])
|
||||
{
|
||||
/* Enable only once. */
|
||||
@@ -396,6 +588,7 @@ bool GPU_material_sss_profile_create(GPUMaterial *material, float radii[3])
|
||||
return false;
|
||||
}
|
||||
copy_v3_v3(material->sss_radii, radii);
|
||||
material->sss_dirty = true;
|
||||
material->sss_enabled = true;
|
||||
|
||||
/* Update / Create UBO */
|
||||
@@ -405,6 +598,54 @@ bool GPU_material_sss_profile_create(GPUMaterial *material, float radii[3])
|
||||
return true;
|
||||
}
|
||||
|
||||
GPUUniformBuf *GPU_material_sss_profile_get(GPUMaterial *material,
|
||||
int sample_len,
|
||||
GPUTexture **tex_profile)
|
||||
{
|
||||
if (!material->sss_enabled) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (material->sss_dirty || (material->sss_samples != sample_len)) {
|
||||
GPUSssKernelData kd;
|
||||
|
||||
compute_sss_kernel(&kd, material->sss_radii, sample_len);
|
||||
|
||||
/* Update / Create UBO */
|
||||
GPU_uniformbuf_update(material->sss_profile, &kd);
|
||||
|
||||
/* Update / Create Tex */
|
||||
float *translucence_profile;
|
||||
compute_sss_translucence_kernel(&kd, 64, &translucence_profile);
|
||||
|
||||
if (material->sss_tex_profile != nullptr) {
|
||||
GPU_texture_free(material->sss_tex_profile);
|
||||
}
|
||||
|
||||
material->sss_tex_profile = GPU_texture_create_1d("sss_tex_profile",
|
||||
64,
|
||||
1,
|
||||
GPU_RGBA16F,
|
||||
GPU_TEXTURE_USAGE_SHADER_READ,
|
||||
translucence_profile);
|
||||
|
||||
MEM_freeN(translucence_profile);
|
||||
|
||||
material->sss_samples = sample_len;
|
||||
material->sss_dirty = false;
|
||||
}
|
||||
|
||||
if (tex_profile != nullptr) {
|
||||
*tex_profile = material->sss_tex_profile;
|
||||
}
|
||||
return material->sss_profile;
|
||||
}
|
||||
|
||||
GPUUniformBuf *GPU_material_create_sss_profile_ubo()
|
||||
{
|
||||
return GPU_uniformbuf_create(sizeof(GPUSssKernelData));
|
||||
}
|
||||
|
||||
# undef SSS_EXPONENT
|
||||
# undef SSS_SAMPLES
|
||||
#endif
|
||||
@@ -590,6 +831,7 @@ uint64_t GPU_material_uuid_get(GPUMaterial *mat)
|
||||
return mat->uuid;
|
||||
}
|
||||
|
||||
|
||||
void GPU_material_light_group_bits_get(GPUMaterial *mat, int* out)
|
||||
{
|
||||
Material* ma = mat->ma;
|
||||
|
||||
@@ -56,14 +56,19 @@ typedef struct Light {
|
||||
short pr_texture, use_nodes;
|
||||
|
||||
/* Eevee */
|
||||
float bias;
|
||||
float clipsta;
|
||||
float clipend_deprecated;
|
||||
float clip_end;
|
||||
|
||||
float cascade_max_dist;
|
||||
float cascade_exponent;
|
||||
float cascade_fade;
|
||||
int cascade_count;
|
||||
|
||||
float contact_dist;
|
||||
float contact_bias;
|
||||
float contact_thickness;
|
||||
|
||||
float diff_fac;
|
||||
float spec_fac;
|
||||
float transmission_fac;
|
||||
@@ -76,7 +81,7 @@ typedef struct Light {
|
||||
|
||||
/* Goo-engine */
|
||||
int light_group_bits[4];
|
||||
char _pad4[4];
|
||||
// char _pad4[4];
|
||||
|
||||
/* Preview */
|
||||
struct PreviewImage *preview;
|
||||
@@ -138,7 +143,7 @@ enum {
|
||||
// LA_SHAD_TEX = 1 << 16, /* Deprecated. */
|
||||
LA_SHOW_CONE = 1 << 17,
|
||||
// LA_SHOW_SHADOW_BOX = 1 << 18,
|
||||
// LA_SHAD_CONTACT = 1 << 19, /* Deprecated. */
|
||||
LA_SHAD_CONTACT = 1 << 19,
|
||||
LA_CUSTOM_ATTENUATION = 1 << 20,
|
||||
LA_USE_SOFT_FALLOFF = 1 << 21,
|
||||
/** Use absolute resolution clamping instead of relative. */
|
||||
|
||||
@@ -179,11 +179,24 @@
|
||||
.gi_diffuse_bounces = 3, \
|
||||
.gi_cubemap_resolution = 512, \
|
||||
.gi_visibility_resolution = 32, \
|
||||
.gi_cubemap_draw_size = 0.3f, \
|
||||
.gi_irradiance_draw_size = 0.1f, \
|
||||
.gi_irradiance_smoothing = 0.1f, \
|
||||
.gi_filter_quality = 3.0f, \
|
||||
.gi_irradiance_pool_size = 16, \
|
||||
.shadow_pool_size = 512, \
|
||||
\
|
||||
.taa_samples = 16, \
|
||||
.taa_render_samples = 64, \
|
||||
\
|
||||
.sss_samples = 7, \
|
||||
.sss_jitter_threshold = 0.3f, \
|
||||
\
|
||||
.ssr_quality = 0.25f, \
|
||||
.ssr_max_roughness = 0.5f, \
|
||||
.ssr_thickness = 0.2f, \
|
||||
.ssr_border_fade = 0.075f, \
|
||||
.ssr_firefly_fac = 10.0f, \
|
||||
\
|
||||
.volumetric_start = 0.1f, \
|
||||
.volumetric_end = 100.0f, \
|
||||
@@ -195,6 +208,8 @@
|
||||
.volumetric_shadow_samples = 16, \
|
||||
\
|
||||
.gtao_distance = 0.2f, \
|
||||
.gtao_factor = 1.0f, \
|
||||
.gtao_quality = 0.25f, \
|
||||
.gtao_thickness = 0.5f, \
|
||||
.gtao_focus = 0.05f, \
|
||||
.gtao_resolution = 2, \
|
||||
@@ -211,6 +226,14 @@
|
||||
.bokeh_max_size = 100.0f, \
|
||||
.bokeh_threshold = 1.0f, \
|
||||
.bokeh_neighbor_max = 10.0f, \
|
||||
.bokeh_denoise_fac = 0.75f, \
|
||||
\
|
||||
.bloom_color = {1.0f, 1.0f, 1.0f}, \
|
||||
.bloom_threshold = 0.8f, \
|
||||
.bloom_knee = 0.5f, \
|
||||
.bloom_intensity = 0.05f, \
|
||||
.bloom_radius = 6.5f, \
|
||||
.bloom_clamp = 0.0f, \
|
||||
\
|
||||
.motion_blur_depth_scale = 100.0f, \
|
||||
.motion_blur_max = 32, \
|
||||
@@ -218,6 +241,8 @@
|
||||
\
|
||||
.clamp_surface_indirect = 10.0f, \
|
||||
\
|
||||
.shadow_cube_size = 512, \
|
||||
.shadow_cascade_size = 1024, \
|
||||
.shadow_ray_count = 1, \
|
||||
.shadow_step_count = 6, \
|
||||
.shadow_resolution_scale = 1.0f, \
|
||||
@@ -231,7 +256,9 @@
|
||||
\
|
||||
.overscan = 3.0f, \
|
||||
\
|
||||
.flag = SCE_EEVEE_TAA_REPROJECTION, \
|
||||
.flag = SCE_EEVEE_VOLUMETRIC_LIGHTS | SCE_EEVEE_GTAO_BENT_NORMALS | \
|
||||
SCE_EEVEE_GTAO_BOUNCE | SCE_EEVEE_TAA_REPROJECTION | \
|
||||
SCE_EEVEE_SSR_HALF_RESOLUTION | SCE_EEVEE_SHADOW_SOFT, \
|
||||
}
|
||||
|
||||
#define _DNA_DEFAULT_SceneHydra \
|
||||
|
||||
@@ -1886,12 +1886,24 @@ typedef struct SceneEEVEE {
|
||||
int gi_diffuse_bounces;
|
||||
int gi_cubemap_resolution;
|
||||
int gi_visibility_resolution;
|
||||
float gi_irradiance_smoothing;
|
||||
float gi_glossy_clamp;
|
||||
float gi_filter_quality;
|
||||
int gi_irradiance_pool_size;
|
||||
char _pad0[4];
|
||||
|
||||
float gi_cubemap_draw_size;
|
||||
float gi_irradiance_draw_size;
|
||||
|
||||
int taa_samples;
|
||||
int taa_render_samples;
|
||||
int sss_samples;
|
||||
float sss_jitter_threshold;
|
||||
|
||||
float ssr_quality;
|
||||
float ssr_max_roughness;
|
||||
float ssr_thickness;
|
||||
float ssr_border_fade;
|
||||
float ssr_firefly_fac;
|
||||
|
||||
float volumetric_start;
|
||||
float volumetric_end;
|
||||
@@ -1903,6 +1915,8 @@ typedef struct SceneEEVEE {
|
||||
int volumetric_ray_depth;
|
||||
|
||||
float gtao_distance;
|
||||
float gtao_factor;
|
||||
float gtao_quality;
|
||||
float gtao_thickness;
|
||||
float gtao_focus;
|
||||
int gtao_resolution;
|
||||
@@ -1914,12 +1928,20 @@ typedef struct SceneEEVEE {
|
||||
float fast_gi_thickness_near;
|
||||
float fast_gi_thickness_far;
|
||||
char fast_gi_method;
|
||||
char _pad1[3];
|
||||
char _pad0[3];
|
||||
|
||||
float bokeh_overblur;
|
||||
float bokeh_max_size;
|
||||
float bokeh_threshold;
|
||||
float bokeh_neighbor_max;
|
||||
float bokeh_denoise_fac;
|
||||
|
||||
float bloom_color[3];
|
||||
float bloom_threshold;
|
||||
float bloom_knee;
|
||||
float bloom_intensity;
|
||||
float bloom_radius;
|
||||
float bloom_clamp;
|
||||
|
||||
int motion_blur_samples DNA_DEPRECATED;
|
||||
int motion_blur_max;
|
||||
@@ -1929,7 +1951,9 @@ typedef struct SceneEEVEE {
|
||||
float motion_blur_depth_scale;
|
||||
|
||||
/* Only keep for versioning. */
|
||||
int shadow_cube_size_deprecated DNA_DEPRECATED;
|
||||
int shadow_method DNA_DEPRECATED;
|
||||
int shadow_cube_size;
|
||||
int shadow_cascade_size;
|
||||
int shadow_pool_size;
|
||||
int shadow_ray_count;
|
||||
int shadow_step_count;
|
||||
@@ -1942,6 +1966,8 @@ typedef struct SceneEEVEE {
|
||||
|
||||
int ray_tracing_method;
|
||||
|
||||
char _pad1[4];
|
||||
|
||||
struct RaytraceEEVEE ray_tracing_options;
|
||||
|
||||
struct LightCache *light_cache DNA_DEPRECATED;
|
||||
@@ -2749,8 +2775,6 @@ typedef enum eGPencil_Flags {
|
||||
GP_TOOL_FLAG_CREATE_WEIGHTS = (1 << 4),
|
||||
/** Auto-merge with last stroke. */
|
||||
GP_TOOL_FLAG_AUTOMERGE_STROKE = (1 << 5),
|
||||
/* Autoclose last stroke */
|
||||
GP_TOOL_FLAG_AUTOCLOSE_STROKE = (1 << 6),
|
||||
} eGPencil_Flags;
|
||||
|
||||
/** #Scene::r.simplify_gpencil */
|
||||
@@ -2874,35 +2898,35 @@ enum {
|
||||
/** #SceneEEVEE::flag */
|
||||
enum {
|
||||
// SCE_EEVEE_VOLUMETRIC_ENABLED = (1 << 0), /* Unused */
|
||||
// SCE_EEVEE_VOLUMETRIC_LIGHTS = (1 << 1), /* Unused. */
|
||||
SCE_EEVEE_VOLUMETRIC_LIGHTS = (1 << 1),
|
||||
SCE_EEVEE_VOLUMETRIC_SHADOWS = (1 << 2),
|
||||
// SCE_EEVEE_VOLUMETRIC_COLORED = (1 << 3), /* Unused */
|
||||
SCE_EEVEE_GTAO_ENABLED = (1 << 4),
|
||||
// SCE_EEVEE_GTAO_BENT_NORMALS = (1 << 5), /* Unused. */
|
||||
// SCE_EEVEE_GTAO_BOUNCE = (1 << 6), /* Unused. */
|
||||
SCE_EEVEE_GTAO_BENT_NORMALS = (1 << 5),
|
||||
SCE_EEVEE_GTAO_BOUNCE = (1 << 6),
|
||||
// SCE_EEVEE_DOF_ENABLED = (1 << 7), /* Moved to camera->dof.flag */
|
||||
SCE_EEVEE_BLOOM_ENABLED = (1 << 8),
|
||||
SCE_EEVEE_MOTION_BLUR_ENABLED_DEPRECATED = (1 << 9), /* Moved to scene->r.mode */
|
||||
// SCE_EEVEE_SHADOW_HIGH_BITDEPTH = (1 << 10), /* Unused. */
|
||||
SCE_EEVEE_SHADOW_HIGH_BITDEPTH = (1 << 10),
|
||||
SCE_EEVEE_TAA_REPROJECTION = (1 << 11),
|
||||
// SCE_EEVEE_SSS_ENABLED = (1 << 12), /* Unused */
|
||||
// SCE_EEVEE_SSS_SEPARATE_ALBEDO = (1 << 13), /* Unused */
|
||||
SCE_EEVEE_SSR_ENABLED = (1 << 14),
|
||||
// SCE_EEVEE_SSR_REFRACTION = (1 << 15), /* Unused. */
|
||||
// SCE_EEVEE_SSR_HALF_RESOLUTION = (1 << 16), /* Unused. */
|
||||
// SCE_EEVEE_SHOW_IRRADIANCE = (1 << 17), /* Unused. */
|
||||
// SCE_EEVEE_SHOW_CUBEMAPS = (1 << 18), /* Unused. */
|
||||
SCE_EEVEE_SSR_REFRACTION = (1 << 15),
|
||||
SCE_EEVEE_SSR_HALF_RESOLUTION = (1 << 16),
|
||||
SCE_EEVEE_SHOW_IRRADIANCE = (1 << 17),
|
||||
SCE_EEVEE_SHOW_CUBEMAPS = (1 << 18),
|
||||
SCE_EEVEE_GI_AUTOBAKE = (1 << 19),
|
||||
// SCE_EEVEE_SHADOW_SOFT = (1 << 20), /* Unused. */
|
||||
SCE_EEVEE_SHADOW_SOFT = (1 << 20),
|
||||
SCE_EEVEE_OVERSCAN = (1 << 21),
|
||||
// SCE_EEVEE_DOF_HQ_SLIGHT_FOCUS = (1 << 22), /* Unused. */
|
||||
SCE_EEVEE_DOF_HQ_SLIGHT_FOCUS = (1 << 22),
|
||||
SCE_EEVEE_DOF_JITTER = (1 << 23),
|
||||
SCE_EEVEE_SHADOW_ENABLED = (1 << 24),
|
||||
SCE_EEVEE_SHADOW_ID_HIGH_BITDEPTH = (1 << 24),
|
||||
SCE_EEVEE_RAYTRACE_OPTIONS_SPLIT = (1 << 25),
|
||||
SCE_EEVEE_SHADOW_JITTERED_VIEWPORT = (1 << 26),
|
||||
SCE_EEVEE_VOLUME_CUSTOM_RANGE = (1 << 27),
|
||||
SCE_EEVEE_FAST_GI_ENABLED = (1 << 28),
|
||||
SCE_EEVEE_SHADOW_ID_HIGH_BITDEPTH = (1 << 29),
|
||||
};
|
||||
|
||||
typedef enum RaytraceEEVEE_Flag {
|
||||
@@ -2928,6 +2952,13 @@ typedef enum FastGI_Method {
|
||||
FAST_GI_AO_ONLY = 1,
|
||||
} FastGI_Method;
|
||||
|
||||
/** #SceneEEVEE::shadow_method */
|
||||
enum {
|
||||
SHADOW_ESM = 1,
|
||||
/* SHADOW_VSM = 2, */ /* UNUSED */
|
||||
/* SHADOW_METHOD_MAX = 3, */ /* UNUSED */
|
||||
};
|
||||
|
||||
/** #SceneDisplay->render_aa and #SceneDisplay->viewport_aa */
|
||||
enum {
|
||||
SCE_DISPLAY_AA_OFF = 0,
|
||||
|
||||
@@ -763,7 +763,7 @@ typedef struct UserDef_Experimental {
|
||||
char use_shader_node_previews;
|
||||
char use_animation_baklava;
|
||||
char enable_new_cpu_compositor;
|
||||
char _pad[2];
|
||||
/* char _pad[0]; */
|
||||
/** `makesdna` does not allow empty structs. */
|
||||
} UserDef_Experimental;
|
||||
|
||||
@@ -1011,7 +1011,7 @@ typedef struct UserDef {
|
||||
int gpu_preferred_index;
|
||||
uint32_t gpu_preferred_vendor_id;
|
||||
uint32_t gpu_preferred_device_id;
|
||||
char _pad16[4];
|
||||
char _pad17[4];
|
||||
/** #eGPUBackendType */
|
||||
short gpu_backend;
|
||||
|
||||
|
||||
@@ -103,7 +103,6 @@ DNA_STRUCT_RENAME_MEMBER(HookModifierData, totindex, indexar_num)
|
||||
DNA_STRUCT_RENAME_MEMBER(Image, name, filepath)
|
||||
DNA_STRUCT_RENAME_MEMBER(LaplacianDeformModifierData, total_verts, verts_num)
|
||||
DNA_STRUCT_RENAME_MEMBER(Library, name, filepath)
|
||||
DNA_STRUCT_RENAME_MEMBER(Light, clipend, clipend_deprecated)
|
||||
DNA_STRUCT_RENAME_MEMBER(Light, energy, energy_deprecated)
|
||||
DNA_STRUCT_RENAME_MEMBER(Light, energy_new, energy)
|
||||
DNA_STRUCT_RENAME_MEMBER(LineartGpencilModifierData, line_types, edge_types)
|
||||
@@ -175,10 +174,8 @@ DNA_STRUCT_RENAME_MEMBER(RenderData, blurfac, motion_blur_shutter)
|
||||
DNA_STRUCT_RENAME_MEMBER(RigidBodyWorld, steps_per_second, substeps_per_frame)
|
||||
DNA_STRUCT_RENAME_MEMBER(SDefBind, numverts, verts_num)
|
||||
DNA_STRUCT_RENAME_MEMBER(SDefVert, numbinds, binds_num)
|
||||
DNA_STRUCT_RENAME_MEMBER(SceneEEVEE, gtao_quality, fast_gi_quality)
|
||||
DNA_STRUCT_RENAME_MEMBER(SceneEEVEE, motion_blur_position, motion_blur_position_deprecated)
|
||||
DNA_STRUCT_RENAME_MEMBER(SceneEEVEE, motion_blur_shutter, motion_blur_shutter_deprecated)
|
||||
DNA_STRUCT_RENAME_MEMBER(SceneEEVEE, shadow_cube_size, shadow_cube_size_deprecated)
|
||||
DNA_STRUCT_RENAME_MEMBER(Sequence, retiming_handle_num, retiming_keys_num)
|
||||
DNA_STRUCT_RENAME_MEMBER(Sequence, retiming_handles, retiming_keys)
|
||||
DNA_STRUCT_RENAME_MEMBER(SpaceImage, pixel_snap_mode, pixel_round_mode)
|
||||
|
||||
@@ -1427,6 +1427,14 @@ static bool override_apply_property_check_skip(Main *bmain,
|
||||
{
|
||||
UNUSED_VARS_NDEBUG(bmain, id_ptr_src);
|
||||
|
||||
// HACK: Specifically prevent overriding actions when Resync Enforce is used
|
||||
if ((rnaapply_ctx.flag & RNA_OVERRIDE_APPLY_FLAG_IGNORE_ID_POINTERS) != 0) {
|
||||
StructRNA* rna_type = RNA_property_pointer_type(&rnaapply_ctx.ptr_dst, rnaapply_ctx.prop_dst);
|
||||
if (RNA_struct_is_ID(rna_type) && RNA_type_to_ID_code(rna_type) == ID_AC) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if ((rnaapply_ctx.flag & RNA_OVERRIDE_APPLY_FLAG_IGNORE_ID_POINTERS) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -259,6 +259,40 @@ static void rna_def_light_shadow(StructRNA *srna, bool sun)
|
||||
prop, "Shadow Soft Size", "Light size for ray shadow sampling (Raytraced shadows)");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_draw_update");
|
||||
|
||||
/* Goo Engine */
|
||||
prop = RNA_def_property(srna, "use_contact_shadow", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "mode", LA_SHAD_CONTACT);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Contact Shadow",
|
||||
"Use screen space ray-tracing to have correct shadowing "
|
||||
"near occluder, or for small features that does not appear "
|
||||
"in shadow maps");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_update");
|
||||
|
||||
prop = RNA_def_property(srna, "contact_shadow_distance", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "contact_dist");
|
||||
RNA_def_property_range(prop, 0.0f, 9999.0f);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Contact Shadow Distance",
|
||||
"World space distance in which to search for "
|
||||
"screen space occluder");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_update");
|
||||
|
||||
prop = RNA_def_property(srna, "contact_shadow_bias", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "contact_bias");
|
||||
RNA_def_property_range(prop, 0.001f, 9999.0f);
|
||||
RNA_def_property_ui_range(prop, 0.001f, 5.0f, 1.0, 3);
|
||||
RNA_def_property_ui_text(prop, "Contact Shadow Bias", "Bias to avoid self shadowing");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_update");
|
||||
|
||||
prop = RNA_def_property(srna, "contact_shadow_thickness", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "contact_thickness");
|
||||
RNA_def_property_range(prop, 0.0f, 9999.0f);
|
||||
RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Contact Shadow Thickness", "Pixel thickness used to detect occlusion");
|
||||
RNA_def_property_update(prop, 0, "rna_Light_update");
|
||||
|
||||
/* Eevee */
|
||||
prop = RNA_def_property(srna, "shadow_filter_radius", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
|
||||
@@ -968,6 +968,12 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MATERIAL);
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, nullptr, "blend_shadow");
|
||||
RNA_def_property_enum_items(prop, prop_eevee_blend_shadow_items);
|
||||
RNA_def_property_ui_text(prop, "Shadow Mode", "Shadow mapping method");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
prop = RNA_def_property(srna, "alpha_threshold", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_range(prop, 0, 1);
|
||||
RNA_def_property_ui_text(prop,
|
||||
@@ -1089,7 +1095,7 @@ void RNA_def_material(BlenderRNA *brna)
|
||||
"The max distance a vertex can be displaced. "
|
||||
"Displacements over this threshold may cause visibility issues.");
|
||||
RNA_def_property_update(prop, 0, "rna_Material_draw_update");
|
||||
|
||||
|
||||
prop = RNA_def_property(srna, "light_group_bits", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_int_sdna(prop, nullptr, "light_group_bits");
|
||||
RNA_def_property_array(prop, 4);
|
||||
|
||||
@@ -3807,17 +3807,6 @@ static void rna_def_tool_settings(BlenderRNA *brna)
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_gpencil_autoclose_strokes", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "gpencil_flags", GP_TOOL_FLAG_AUTOCLOSE_STROKE);
|
||||
RNA_def_property_boolean_default(prop, false);
|
||||
RNA_def_property_ui_icon(prop, ICON_AUTOMERGE_OFF, 1);
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Autoclose",
|
||||
"Close the last drawn stroke before post processing");
|
||||
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
|
||||
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, nullptr);
|
||||
prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_pointer_sdna(prop, nullptr, "gp_sculpt");
|
||||
RNA_def_property_flag(prop, PROP_DEG_SYNC_ONLY);
|
||||
@@ -8038,6 +8027,72 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
RNA_def_property_flag(prop, PROP_ANIMATABLE);
|
||||
|
||||
/* Screen Space Subsurface Scattering */
|
||||
prop = RNA_def_property(srna, "sss_samples", PROP_INT, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute the scattering effect");
|
||||
RNA_def_property_range(prop, 1, 32);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "sss_jitter_threshold", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Jitter Threshold", "Rotate samples that are below this threshold");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
/* Screen Space Reflection */
|
||||
prop = RNA_def_property(srna, "use_ssr", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_SSR_ENABLED);
|
||||
RNA_def_property_ui_text(prop, "Screen Space Reflections", "Enable screen space reflection");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_ssr_refraction", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_SSR_REFRACTION);
|
||||
RNA_def_property_ui_text(prop, "Screen Space Refractions", "Enable screen space Refractions");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_ssr_halfres", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_SSR_HALF_RESOLUTION);
|
||||
RNA_def_property_ui_text(prop, "Half Res Trace", "Raytrace at a lower resolution");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "ssr_quality", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the screen space ray-tracing");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "ssr_max_roughness", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Max Roughness", "Do not raytrace reflections for roughness above this value");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "ssr_thickness", PROP_FLOAT, PROP_DISTANCE);
|
||||
RNA_def_property_ui_text(prop, "Thickness", "Pixel thickness used to detect intersection");
|
||||
RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MATERIAL);
|
||||
RNA_def_property_range(prop, 1e-6f, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 5, 3);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "ssr_border_fade", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_ui_text(prop, "Edge Fading", "Screen percentage used to fade the SSR");
|
||||
RNA_def_property_range(prop, 0.0f, 0.5f);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "ssr_firefly_fac", PROP_FLOAT, PROP_NONE);
|
||||
RNA_def_property_ui_text(prop, "Clamp", "Clamp pixel intensity to remove noise (0 to disable)");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "ray_tracing_method", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_items(prop, ray_tracing_method_items);
|
||||
RNA_def_property_ui_text(
|
||||
@@ -8185,10 +8240,30 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
/* TODO: remove this, kept for EEVEE 4.2 compatibility,
|
||||
* this is a duplicate of "fast_gi_quality"). */
|
||||
prop = RNA_def_property(srna, "use_gtao_bent_normals", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_GTAO_BENT_NORMALS);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Bent Normals", "Compute main non occluded direction to sample the environment");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_gtao_bounce", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_GTAO_BOUNCE);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"Bounces Approximation",
|
||||
"An approximation to simulate light bounces "
|
||||
"giving less occlusion on brighter objects");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "gtao_factor", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending");
|
||||
RNA_def_property_range(prop, 0.0f, FLT_MAX);
|
||||
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 2);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "gtao_quality", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "fast_gi_quality");
|
||||
RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the horizon search");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
@@ -8312,6 +8387,22 @@ static void rna_def_scene_eevee(BlenderRNA *brna)
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "bokeh_denoise_fac", PROP_FLOAT, PROP_FACTOR);
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Denoise Amount", "Amount of flicker removal applied to bokeh highlights");
|
||||
RNA_def_property_range(prop, 0.0f, 1.0f);
|
||||
RNA_def_property_ui_range(prop, 0.0f, 1.0f, 10, 2);
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_bokeh_high_quality_slight_defocus", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_DOF_HQ_SLIGHT_FOCUS);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"High Quality Slight Defocus",
|
||||
"Sample all pixels in almost in-focus regions to eliminate noise");
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
|
||||
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, nullptr);
|
||||
|
||||
prop = RNA_def_property(srna, "use_bokeh_jittered", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, nullptr, "flag", SCE_EEVEE_DOF_JITTER);
|
||||
RNA_def_property_ui_text(prop,
|
||||
|
||||
@@ -39,6 +39,8 @@
|
||||
# include "BLI_math_base.h" /* isfinite() */
|
||||
#endif
|
||||
|
||||
#include "float.h" /* FLT_MAX */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Fast Python to C Array Conversion for Primitive Types
|
||||
* \{ */
|
||||
@@ -1556,7 +1558,11 @@ bool PyC_RunString_AsNumber(const char *imports[],
|
||||
ok = false;
|
||||
}
|
||||
else if (!isfinite(val)) {
|
||||
*r_value = 0.0;
|
||||
if (val > 0.0) {
|
||||
*r_value = FLT_MAX;
|
||||
} else {
|
||||
*r_value = -FLT_MAX;
|
||||
}
|
||||
ok = true;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -94,7 +94,7 @@ RenderEngineType *RE_engines_find(const char *idname)
|
||||
BLI_findstring(&R_engines, idname, offsetof(RenderEngineType, idname)));
|
||||
if (!type) {
|
||||
type = static_cast<RenderEngineType *>(
|
||||
BLI_findstring(&R_engines, "BLENDER_EEVEE_NEXT", offsetof(RenderEngineType, idname)));
|
||||
BLI_findstring(&R_engines, "BLENDER_EEVEE", offsetof(RenderEngineType, idname)));
|
||||
}
|
||||
|
||||
return type;
|
||||
|
||||
@@ -2100,7 +2100,7 @@ void RE_RenderFreestyleStrokes(Render *re, Main *bmain, Scene *scene, const bool
|
||||
char scene_engine[32];
|
||||
STRNCPY(scene_engine, re->r.engine);
|
||||
if (use_eevee_for_freestyle_render(re)) {
|
||||
change_renderdata_engine(re, RE_engine_id_BLENDER_EEVEE_NEXT);
|
||||
change_renderdata_engine(re, RE_engine_id_BLENDER_EEVEE);
|
||||
}
|
||||
|
||||
RE_engine_render(re, false);
|
||||
|
||||
Reference in New Issue
Block a user