示例#1
0
    string CacheStatisticsEntry::to_string() const
    {
        const uint64 accesses = m_hit_count + m_miss_count;

        if (accesses == 0)
            return "n/a";

        return
                "efficiency " + pretty_percent(m_hit_count, accesses)
            + "  accesses " + pretty_uint(accesses)
            + "  hits " + pretty_uint(m_hit_count)
            + "  misses " + pretty_uint(m_miss_count);
    }
示例#2
0
void Frame::print_settings()
{
    RENDERER_LOG_INFO(
        "frame settings:\n"
        "  resolution       %s x %s\n"
        "  tile size        %s x %s\n"
        "  pixel format     %s\n"
        "  filter           %s\n"
        "  filter size      %f\n"
        "  color space      %s\n"
        "  premult. alpha   %s\n"
        "  clamping         %s\n"
        "  gamma correction %f\n"
        "  crop window      (%s, %s)-(%s, %s)",
        pretty_uint(impl->m_frame_width).c_str(),
        pretty_uint(impl->m_frame_height).c_str(),
        pretty_uint(impl->m_tile_width).c_str(),
        pretty_uint(impl->m_tile_height).c_str(),
        pixel_format_name(impl->m_pixel_format),
        impl->m_filter_name.c_str(),
        impl->m_filter_radius,
        color_space_name(m_color_space),
        m_is_premultiplied_alpha ? "on" : "off",
        impl->m_clamp ? "on" : "off",
        impl->m_target_gamma,
        pretty_uint(impl->m_crop_window.min[0]).c_str(),
        pretty_uint(impl->m_crop_window.min[1]).c_str(),
        pretty_uint(impl->m_crop_window.max[0]).c_str(),
        pretty_uint(impl->m_crop_window.max[1]).c_str());
}
// Print traversal statistics.
void TraversalStatistics::print(Logger& logger)
{
    LOG_DEBUG(
        logger,
        "  traversals       %s\n"
        "  visited interior avg %.1f  min %s  max %s  dev %.1f\n"
        "  visited leaves   avg %.1f  min %s  max %s  dev %.1f",
        pretty_uint(m_traversal_count).c_str(),
        m_visited_interior.get_mean(),
        pretty_uint(m_visited_interior.get_min()).c_str(),
        pretty_uint(m_visited_interior.get_max()).c_str(),
        m_visited_interior.get_dev(),
        m_visited_leaves.get_mean(),
        pretty_uint(m_visited_leaves.get_min()).c_str(),
        pretty_uint(m_visited_leaves.get_max()).c_str(),
        m_visited_leaves.get_dev());
}
示例#4
0
void SPPMParameters::print() const
{
    RENDERER_LOG_INFO(
        "sppm settings:\n"
        "  dl               %s\n"
        "  ibl              %s",
        m_dl_mode == SPPM ? "sppm" : m_dl_mode == RayTraced ? "ray traced" : "off",
        m_enable_ibl ? "on" : "off");

    RENDERER_LOG_INFO(
        "sppm photon tracing settings:\n"
        "  light photons    %s\n"
        "  env. photons     %s\n"
        "  max path length  %s\n"
        "  rr min path len. %s",
        pretty_uint(m_light_photon_count).c_str(),
        pretty_uint(m_env_photon_count).c_str(),
        m_photon_tracing_max_path_length == ~0 ? "infinite" : pretty_uint(m_photon_tracing_max_path_length).c_str(),
        m_photon_tracing_rr_min_path_length == ~0 ? "infinite" : pretty_uint(m_photon_tracing_rr_min_path_length).c_str());

    RENDERER_LOG_INFO(
        "sppm path tracing settings:\n"
        "  max path length  %s\n"
        "  rr min path len. %s\n"
        "  initial radius   %s%%\n"
        "  alpha            %s\n"
        "  max photons/est. %s\n"
        "  dl light samples %s",
        m_path_tracing_max_path_length == ~0 ? "infinite" : pretty_uint(m_path_tracing_max_path_length).c_str(),
        m_path_tracing_rr_min_path_length == ~0 ? "infinite" : pretty_uint(m_path_tracing_rr_min_path_length).c_str(),
        pretty_scalar(m_initial_radius_percents, 3).c_str(),
        pretty_scalar(m_alpha, 1).c_str(),
        pretty_uint(m_max_photons_per_estimate).c_str(),
        pretty_scalar(m_dl_light_sample_count).c_str());
}
PixelRendererBase::~PixelRendererBase()
{
    if (m_invalid_sample_count > 0)
    {
        RENDERER_LOG_WARNING(
            "found %s pixel sample%s with NaN or negative values",
            pretty_uint(m_invalid_sample_count).c_str(),
            m_invalid_sample_count > 1 ? "s" : "");
    }
}
示例#6
0
void CurveTree::build_bvh(
    const ParamArray&       params,
    const double            time,
    Statistics&             statistics)
{
    // Collect curves for this tree.
    RENDERER_LOG_INFO(
        "collecting geometry for curve tree #" FMT_UNIQUE_ID " from assembly \"%s\"...",
        m_arguments.m_curve_tree_uid,
        m_arguments.m_assembly.get_path().c_str());
    vector<GAABB3> curve_bboxes;
    collect_curves(curve_bboxes);

    // Print statistics about the input geometry.
    RENDERER_LOG_INFO(
        "building curve tree #" FMT_UNIQUE_ID " (bvh, %s %s)...",
        m_arguments.m_curve_tree_uid,
        pretty_uint(m_curve_keys.size()).c_str(),
        plural(m_curve_keys.size(), "curve").c_str());

    // Create the partitioner.
    typedef bvh::SAHPartitioner<vector<GAABB3> > Partitioner;
    Partitioner partitioner(
        curve_bboxes,
        CurveTreeDefaultMaxLeafSize,
        CurveTreeDefaultInteriorNodeTraversalCost,
        CurveTreeDefaultCurveIntersectionCost);

    // Build the tree.
    typedef bvh::Builder<CurveTree, Partitioner> Builder;
    Builder builder;
    builder.build<DefaultWallclockTimer>(
        *this,
        partitioner,
        m_curves1.size() + m_curves3.size(),
        CurveTreeDefaultMaxLeafSize);
    statistics.merge(
        bvh::TreeStatistics<CurveTree>(*this, m_arguments.m_bbox));

    // Reorder the curve keys based on the nodes ordering.
    if (!m_curves1.empty() || !m_curves3.empty())
    {
        const vector<size_t>& ordering = partitioner.get_item_ordering();
        reorder_curve_keys(ordering);
        reorder_curves(ordering);
        reorder_curve_keys_in_leaf_nodes();
    }
}
示例#7
0
void LightPathsTab::slot_context_menu(const QPoint& point)
{
    if (!(QApplication::keyboardModifiers() & Qt::ShiftModifier))
        return;

    QMenu* menu = new QMenu(this);

    const auto light_path_count = m_project.get_light_path_recorder().get_light_path_count();
    menu->addAction(
        QString("Save %1 Light Path%2...")
            .arg(QString::fromStdString(pretty_uint(light_path_count)))
            .arg(light_path_count > 1 ? "s" : ""),
        this, SLOT(slot_save_light_paths()));

    menu->exec(m_light_paths_widget->mapToGlobal(point));
}
void SPPMPassCallback::post_render(
    const Frame&            frame,
    JobQueue&               job_queue,
    IAbortSwitch&           abort_switch)
{
    // Shrink the lookup radius for the next pass.
    const float k = (m_pass_number + m_params.m_alpha) / (m_pass_number + 1);
    assert(k <= 1.0);
    m_lookup_radius *= sqrt(k);

    m_stopwatch.measure();

    RENDERER_LOG_INFO(
        "sppm pass %s completed in %s.",
        pretty_uint(m_pass_number + 1).c_str(),
        pretty_time(m_stopwatch.get_seconds()).c_str());

    ++m_pass_number;
}
void LightPathsWidget::dump_selected_light_path() const
{
    if (m_selected_light_path_index == -1)
    {
        if (m_light_paths.empty())
            RENDERER_LOG_INFO("no light path to display.");
        else
        {
            RENDERER_LOG_INFO("displaying all %s light path%s.",
                pretty_uint(m_light_paths.size()).c_str(),
                m_light_paths.size() > 1 ? "s" : "");
        }
    }
    else
    {
        RENDERER_LOG_INFO("displaying light path %s:",
            pretty_int(m_selected_light_path_index + 1).c_str());

        const auto& light_path_recorder = m_project.get_light_path_recorder();
        const auto& path = m_light_paths[m_selected_light_path_index];

        for (size_t i = path.m_vertex_begin_index; i < path.m_vertex_end_index; ++i)
        {
            LightPathVertex v;
            light_path_recorder.get_light_path_vertex(i, v);

            const string entity_name =
                v.m_entity != nullptr
                    ? foundation::format("\"{0}\"", v.m_entity->get_path().c_str())
                    : "n/a";

            RENDERER_LOG_INFO("  vertex " FMT_SIZE_T ": entity: %s - position: (%f, %f, %f) - radiance: (%f, %f, %f) - total radiance: %f",
                i - path.m_vertex_begin_index + 1,
                entity_name.c_str(),
                v.m_position[0], v.m_position[1], v.m_position[2],
                v.m_radiance[0], v.m_radiance[1], v.m_radiance[2],
                v.m_radiance[0] + v.m_radiance[1] + v.m_radiance[2]);
        }
    }
}
示例#10
0
string Statistics::UnsignedIntegerEntry::to_string() const
{
    return pretty_uint(m_value);
}
示例#11
0
void LightPathsTab::create_toolbar()
{
    // Create the render toolbar.
    m_toolbar = new QToolBar();
    m_toolbar->setObjectName("render_toolbar");
    m_toolbar->setIconSize(QSize(18, 18));

    // Save Light Paths button.
    QToolButton* save_light_paths_button = new QToolButton();
    save_light_paths_button->setIcon(load_icons("lightpathstab_save_light_paths"));
    const auto light_path_count = m_project.get_light_path_recorder().get_light_path_count();
    save_light_paths_button->setToolTip(
        QString("Save %1 Light Path%2...")
            .arg(QString::fromStdString(pretty_uint(light_path_count)))
            .arg(light_path_count > 1 ? "s" : ""));
    connect(
        save_light_paths_button , SIGNAL(clicked()),
        SLOT(slot_save_light_paths()));
    m_toolbar->addWidget(save_light_paths_button);

    m_toolbar->addSeparator();

    // Previous Light Path button.
    m_prev_path_button = new QToolButton();
    m_prev_path_button->setIcon(load_icons("lightpathstab_prev_light_path"));
    m_prev_path_button->setToolTip("Display previous light path");
    m_prev_path_button->setEnabled(false);
    connect(
        m_prev_path_button, SIGNAL(clicked()),
        m_light_paths_widget, SLOT(slot_display_previous_light_path()));
    m_toolbar->addWidget(m_prev_path_button);

    // Next Light Path button.
    m_next_path_button = new QToolButton();
    m_next_path_button->setIcon(load_icons("lightpathstab_next_light_path"));
    m_next_path_button->setToolTip("Display next light path");
    m_next_path_button->setEnabled(false);
    connect(
        m_next_path_button, SIGNAL(clicked()),
        m_light_paths_widget, SLOT(slot_display_next_light_path()));
    m_toolbar->addWidget(m_next_path_button);

    m_toolbar->addSeparator();

    // Toggle Backface Culling button.
    QToolButton* backface_culling_button = new QToolButton();
    backface_culling_button->setIcon(load_icons("lightpathstab_toggle_backface_culling"));
    backface_culling_button->setToolTip("Show/hide backfacing surfaces");
    backface_culling_button->setCheckable(true);
    backface_culling_button->setChecked(false);
    connect(
        backface_culling_button, SIGNAL(toggled(bool)),
        m_light_paths_widget, SLOT(slot_toggle_backface_culling(const bool)));
    m_toolbar->addWidget(backface_culling_button);

    // Synchronize Camera button.
    QToolButton* sync_camera_button = new QToolButton();
    sync_camera_button->setIcon(load_icons("lightpathstab_synchronize_camera"));
    sync_camera_button->setToolTip("Synchronize the rendering camera with this camera");
    connect(
        sync_camera_button, SIGNAL(clicked()),
        m_light_paths_widget, SLOT(slot_synchronize_camera()));
    m_toolbar->addWidget(sync_camera_button);

    // Add stretchy spacer.
    // This places interactive widgets on the left and info on the right.
    QWidget* spacer = new QWidget();
    spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    m_toolbar->addWidget(spacer);

    // Create a label to display various information such as mouse coordinates, etc.
    m_info_label = new QLabel();
    m_info_label->setObjectName("info_label");
    m_toolbar->addWidget(m_info_label);
}