-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datagenerator library #200
Datagenerator library #200
Conversation
/// @param lights - lights range | ||
/// 'spp' - spp vector | ||
/// 'gamma_correction_enabled' - flag to enable/disable gamma correction | ||
/// 'start_cam_id' - the number starting from will be named generated samples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, actualize options description
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
std::uint32_t num_bounces, | ||
unsigned device_idx); | ||
|
||
void AttachLight(LightObject* light); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need this function. it should be done before datagenerator creation in the client code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope
|
||
DataGeneratorImpl::DataGeneratorImpl(SceneObject* scene, | ||
size_t output_width, | ||
size_t output_height, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
output_width -> width, output_height -> height
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
rpr_camera* cameras; | ||
unsigned cameras_num; | ||
int cameras_start_output_idx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int -> unsigned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
int cameras_start_output_idx; | ||
|
||
rpr_light* lights; | ||
unsigned lights_num; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this section before cameras
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
{ | ||
public: | ||
explicit ConfigLoader(const DGenConfig& config); | ||
char const* output_dir; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it before progress callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Already done
#include <vector> | ||
|
||
|
||
struct OutputInfo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it to anonymous namespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
void DataGeneratorImpl::GenerateSample(CameraObject* camera, | ||
int camera_idx, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
int -> unsigned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
DataGeneratorImpl::DataGeneratorImpl(SceneObject* scene, | ||
size_t output_width, | ||
size_t output_height, | ||
std::uint32_t num_bounces, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsigned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
const std::filesystem::path& output_dir); | ||
|
||
SceneObject* m_scene = nullptr; | ||
std::uint32_t m_width, m_height; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsigned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
SceneObject* m_scene = nullptr; | ||
std::uint32_t m_width, m_height; | ||
std::uint32_t m_num_bounces; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsigned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
bool gamma_correction_enabled) const; | ||
|
||
void GenerateSample(CameraObject* camera, | ||
int camera_idx, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsigned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
// log render settings | ||
auto* render_attribute = doc.NewElement("renderer"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renderer_attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
const std::string& scene_name, | ||
unsigned cameras_start_idx, | ||
unsigned cameras_end_idx, | ||
int cameras_index_offset, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cameras_start_idx, cameras_end_idx and cameras_index_offset are not used here. Please, remove them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc.SaveFile(bdg_metadata_file_name.string().c_str()); | ||
} | ||
|
||
void DataGeneratorImpl::GenerateSample(CameraObject* camera, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GenerateSample -> GenerateCameraData
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
{ | ||
assert(m_width); | ||
assert(m_height); | ||
assert(num_bounces); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless asserts, because checks are done in the data_generator.cpp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
int camera_idx, | ||
const std::vector<unsigned>& spp, | ||
const std::filesystem::path& output_dir, | ||
bool gamma_correction_enabled); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
output_dir, gamma_correction_enabled and spp should be members of class
/// 'start_cam_id' - the number starting from will be named generated samples | ||
|
||
void SaveMetadata(const std::filesystem::path& output_dir, | ||
const std::string& scene_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
output_dir and scene_name should be member of class
// 'scene_file' - full path till .obj/.objm or some kind of this files with scene | ||
// 'output_width' - width of outputs which will be saved on disk | ||
// 'output_height' - height of outputs which will be saved on disk | ||
// 'num_bounces' - number of bounces for each ray |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, actualize options descriptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They're correct
|
||
// Render outputs for every specified SPP at the given | ||
// camera position and save them to separate files | ||
int camera_idx = params->cameras_start_output_idx + i; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsigned
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
unsigned gamma_correction; | ||
|
||
void (*progress_callback)(int /* camera_idx */); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets change signature to:
void (*progress_callback)(unsigned start_idx, unsigned current_idx, end_idx);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
auto app_metadata_file_name = m_app_config.output_dir; | ||
app_metadata_file_name.append("app_metadata.xml"); | ||
|
||
auto* root = doc.NewElement("app_metadata"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
app_metadata -> metadata
m_rpr_cameras.push_back(&camera); | ||
} | ||
|
||
SaveAppMetadata(range.begin, range.end); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
range.end - 1
params->gamma_correction != 0); | ||
|
||
// Attach given lights to the scene | ||
for (size_t i = 0; i < params->lights_num; ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move it before data_generator creation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
} | ||
|
||
// camera_end_idx is index of the last rendered camera | ||
unsigned camera_end_idx = params->cameras_num - 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
auto* camera = CameraObject::Cast<CameraObject>(params->cameras[i]); | ||
if (camera == nullptr) | ||
{ | ||
return kDataGeneratorBadCameras; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets check all cameras before data generator creation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
bool gamma_correction_enable) | ||
: m_scene(scene), | ||
m_scene_name(scene_name), | ||
m_width(width), m_height(height), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move m_height on next line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
m_renderer->SetMaxBounces(num_bounces); | ||
} | ||
|
||
void DataGeneratorImpl::AttachLight(LightObject* light) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
#include <vector> | ||
|
||
#define DEFAULT_START_OUTPUT_IDX (-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets use const int
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
{ | ||
params->progress_callback(0, | ||
i + 1, | ||
params->cameras_num); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong indices
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
No description provided.