Cycles: change preview "resolution divider" that gave the number of lower
resolutions to render, to a "start resolution" which gives the resolution to start at. This avoids unnecessary rendering of small resolutions in small viewports, and avoids long waiting on big viewports.
This commit is contained in:
parent
bd4de709fd
commit
89eeae955b
@ -242,11 +242,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
|
||||
default=1024,
|
||||
)
|
||||
|
||||
cls.resolution_divider = IntProperty(
|
||||
name="Resolution Divider",
|
||||
description="For viewport render, the number of lower resolutions to render before the full resolution",
|
||||
min=1, max=512,
|
||||
default=4,
|
||||
cls.preview_start_resolution = IntProperty(
|
||||
name="Start Resolution",
|
||||
description="Resolution to start rendering preview at, progressively increasing it to the full viewport size",
|
||||
min=8, max=16384,
|
||||
default=64,
|
||||
)
|
||||
|
||||
cls.debug_reset_timeout = FloatProperty(
|
||||
|
@ -216,7 +216,7 @@ class CyclesRender_PT_performance(CyclesButtonsPanel, Panel):
|
||||
|
||||
sub = col.column(align=True)
|
||||
sub.label(text="Viewport:")
|
||||
sub.prop(cscene, "resolution_divider")
|
||||
sub.prop(cscene, "preview_start_resolution")
|
||||
|
||||
|
||||
class CyclesRender_PT_layers(CyclesButtonsPanel, Panel):
|
||||
|
@ -368,7 +368,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
|
||||
params.tile_size = make_int2(tile_x, tile_y);
|
||||
}
|
||||
|
||||
params.resolution = 1 << get_int(cscene, "resolution_divider");
|
||||
params.start_resolution = get_int(cscene, "preview_start_resolution");
|
||||
|
||||
/* other parameters */
|
||||
params.threads = b_scene.render().threads();
|
||||
@ -379,7 +379,7 @@ SessionParams BlenderSync::get_session_params(BL::RenderEngine b_engine, BL::Use
|
||||
|
||||
if(background) {
|
||||
params.progressive = false;
|
||||
params.resolution = 1;
|
||||
params.start_resolution = INT_MAX;
|
||||
}
|
||||
else
|
||||
params.progressive = true;
|
||||
|
@ -36,7 +36,7 @@ CCL_NAMESPACE_BEGIN
|
||||
|
||||
Session::Session(const SessionParams& params_)
|
||||
: params(params_),
|
||||
tile_manager(params.progressive, params.samples, params.tile_size, params.resolution,
|
||||
tile_manager(params.progressive, params.samples, params.tile_size, params.start_resolution,
|
||||
(params.background)? 1: max(params.device.multi_devices.size(), 1))
|
||||
{
|
||||
device_use_gl = ((params.device.type != DEVICE_CPU) && !params.background);
|
||||
@ -343,7 +343,7 @@ bool Session::acquire_tile(Device *tile_device, RenderTile& rtile)
|
||||
rtile.h = tile.h;
|
||||
rtile.start_sample = tile_manager.state.sample;
|
||||
rtile.num_samples = tile_manager.state.num_samples;
|
||||
rtile.resolution = tile_manager.state.resolution;
|
||||
rtile.resolution = tile_manager.state.resolution_divider;
|
||||
|
||||
tile_lock.unlock();
|
||||
|
||||
@ -668,7 +668,7 @@ void Session::update_scene()
|
||||
void Session::update_status_time(bool show_pause, bool show_done)
|
||||
{
|
||||
int sample = tile_manager.state.sample;
|
||||
int resolution = tile_manager.state.resolution;
|
||||
int resolution = tile_manager.state.resolution_divider;
|
||||
int num_tiles = tile_manager.state.num_tiles;
|
||||
int tile = tile_manager.state.num_rendered_tiles;
|
||||
|
||||
@ -757,7 +757,7 @@ void Session::tonemap()
|
||||
task.rgba = display->rgba.device_pointer;
|
||||
task.buffer = buffers->buffer.device_pointer;
|
||||
task.sample = tile_manager.state.sample;
|
||||
task.resolution = tile_manager.state.resolution;
|
||||
task.resolution = tile_manager.state.resolution_divider;
|
||||
tile_manager.state.buffer.get_offset_stride(task.offset, task.stride);
|
||||
|
||||
if(task.w > 0 && task.h > 0) {
|
||||
|
@ -48,7 +48,7 @@ public:
|
||||
bool experimental;
|
||||
int samples;
|
||||
int2 tile_size;
|
||||
int resolution;
|
||||
int start_resolution;
|
||||
int threads;
|
||||
|
||||
double cancel_timeout;
|
||||
@ -64,7 +64,7 @@ public:
|
||||
experimental = false;
|
||||
samples = INT_MAX;
|
||||
tile_size = make_int2(64, 64);
|
||||
resolution = 4;
|
||||
start_resolution = INT_MAX;
|
||||
threads = 0;
|
||||
|
||||
cancel_timeout = 0.1;
|
||||
@ -81,7 +81,7 @@ public:
|
||||
&& progressive == params.progressive
|
||||
&& experimental == params.experimental
|
||||
&& tile_size == params.tile_size
|
||||
&& resolution == params.resolution
|
||||
&& start_resolution == params.start_resolution
|
||||
&& threads == params.threads
|
||||
&& cancel_timeout == params.cancel_timeout
|
||||
&& reset_timeout == params.reset_timeout
|
||||
|
@ -23,11 +23,11 @@
|
||||
|
||||
CCL_NAMESPACE_BEGIN
|
||||
|
||||
TileManager::TileManager(bool progressive_, int num_samples_, int2 tile_size_, int resolution_, int num_devices_)
|
||||
TileManager::TileManager(bool progressive_, int num_samples_, int2 tile_size_, int start_resolution_, int num_devices_)
|
||||
{
|
||||
progressive = progressive_;
|
||||
tile_size = tile_size_;
|
||||
resolution = resolution_;
|
||||
start_resolution = start_resolution_;
|
||||
num_devices = num_devices_;
|
||||
|
||||
BufferParams buffer_params;
|
||||
@ -42,6 +42,18 @@ void TileManager::reset(BufferParams& params_, int num_samples_)
|
||||
{
|
||||
params = params_;
|
||||
|
||||
int divider = 1;
|
||||
int w = params.width, h = params.height;
|
||||
|
||||
if(start_resolution != INT_MAX) {
|
||||
while(w*h > start_resolution*start_resolution) {
|
||||
w = max(1, w/2);
|
||||
h = max(1, h/2);
|
||||
|
||||
divider *= 2;
|
||||
}
|
||||
}
|
||||
|
||||
num_samples = num_samples_;
|
||||
|
||||
state.buffer = BufferParams();
|
||||
@ -49,7 +61,7 @@ void TileManager::reset(BufferParams& params_, int num_samples_)
|
||||
state.num_tiles = 0;
|
||||
state.num_rendered_tiles = 0;
|
||||
state.num_samples = 0;
|
||||
state.resolution = resolution;
|
||||
state.resolution_divider = divider;
|
||||
state.tiles.clear();
|
||||
}
|
||||
|
||||
@ -60,7 +72,7 @@ void TileManager::set_samples(int num_samples_)
|
||||
|
||||
void TileManager::set_tiles()
|
||||
{
|
||||
int resolution = state.resolution;
|
||||
int resolution = state.resolution_divider;
|
||||
int image_w = max(1, params.width/resolution);
|
||||
int image_h = max(1, params.height/resolution);
|
||||
|
||||
@ -104,7 +116,7 @@ list<Tile>::iterator TileManager::next_center_tile(int device)
|
||||
{
|
||||
list<Tile>::iterator iter, best = state.tiles.end();
|
||||
|
||||
int resolution = state.resolution;
|
||||
int resolution = state.resolution_divider;
|
||||
int image_w = max(1, params.width/resolution);
|
||||
int image_h = max(1, params.height/resolution);
|
||||
|
||||
@ -167,7 +179,7 @@ bool TileManager::next_tile(Tile& tile, int device)
|
||||
|
||||
bool TileManager::done()
|
||||
{
|
||||
return (state.sample+state.num_samples >= num_samples && state.resolution == 1);
|
||||
return (state.sample+state.num_samples >= num_samples && state.resolution_divider == 1);
|
||||
}
|
||||
|
||||
bool TileManager::next()
|
||||
@ -175,9 +187,9 @@ bool TileManager::next()
|
||||
if(done())
|
||||
return false;
|
||||
|
||||
if(progressive && state.resolution > 1) {
|
||||
if(progressive && state.resolution_divider > 1) {
|
||||
state.sample = 0;
|
||||
state.resolution /= 2;
|
||||
state.resolution_divider /= 2;
|
||||
state.num_samples = 1;
|
||||
set_tiles();
|
||||
}
|
||||
@ -189,7 +201,7 @@ bool TileManager::next()
|
||||
else
|
||||
state.num_samples = num_samples;
|
||||
|
||||
state.resolution = 1;
|
||||
state.resolution_divider = 1;
|
||||
set_tiles();
|
||||
}
|
||||
|
||||
|
@ -51,13 +51,13 @@ public:
|
||||
BufferParams buffer;
|
||||
int sample;
|
||||
int num_samples;
|
||||
int resolution;
|
||||
int resolution_divider;
|
||||
int num_tiles;
|
||||
int num_rendered_tiles;
|
||||
list<Tile> tiles;
|
||||
} state;
|
||||
|
||||
TileManager(bool progressive, int num_samples, int2 tile_size, int resolution, int num_devices = 1);
|
||||
TileManager(bool progressive, int num_samples, int2 tile_size, int start_resolution, int num_devices = 1);
|
||||
~TileManager();
|
||||
|
||||
void reset(BufferParams& params, int num_samples);
|
||||
@ -72,10 +72,8 @@ protected:
|
||||
bool progressive;
|
||||
int num_samples;
|
||||
int2 tile_size;
|
||||
int resolution;
|
||||
int num_devices;
|
||||
|
||||
int start_resolution;
|
||||
int num_devices;
|
||||
|
||||
list<Tile>::iterator next_center_tile(int device = 0);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user