collect result images

This commit is contained in:
CDaut 2024-08-28 11:15:32 +02:00
parent 7250fe1dd0
commit 3300437294
Signed by: clara
GPG key ID: 223391B52FAD4463
343 changed files with 536 additions and 151 deletions

View file

@ -29,14 +29,14 @@
"name":"Camera",
"rotation":[
0,
0.7071068286895752,
0.7071067094802856,
0,
0.7071068286895752
],
"translation":[
15,
0,
0
5.538400650024414,
2.8199868202209473,
-2.0413269996643066
]
}
],

View file

@ -365,7 +365,7 @@ protected:
// Other
bool m_showHelp{false}; // Show help, pressing
bool m_show_gui{true};
bool m_show_gui{false};
bool m_useDynamicRendering{false}; // Using VK_KHR_dynamic_rendering
float m_sceneRadius{1.f};
};

View file

@ -194,7 +194,7 @@ void HelloVulkan::createGraphicsPipeline()
//--------------------------------------------------------------------------------------------------
// Loading the OBJ file and setting up all buffers
//
void HelloVulkan::loadScene(const std::string& filename)
void HelloVulkan::loadScene(const std::string& filename, const std::string &pointset_path)
{
using vkBU = VkBufferUsageFlagBits;
tinygltf::Model tmodel;
@ -261,7 +261,7 @@ void HelloVulkan::loadScene(const std::string& filename)
// Creates all textures found
createTextureImages(cmdBuf, tmodel);
//generate and submit pointset
createPointsetImage(cmdBuf);
createPointsetImage(cmdBuf, pointset_path);
cmdBufGet.submitAndWait(cmdBuf);
m_alloc.finalizeAndReleaseStaging();
@ -342,34 +342,35 @@ void HelloVulkan::createTextureImages(const VkCommandBuffer& cmdBuf, tinygltf::M
}
}
void HelloVulkan::createPointsetImage(const VkCommandBuffer& cmdBuf)
void HelloVulkan::createPointsetImage(const VkCommandBuffer& cmdBuf, const std::string& pointset_path)
{
//load pointset instead of generating it
std::vector<vec2> points(m_size.height * m_size.width, vec2(0.f));
//generate blue noise points
// const int npoints = 16384;
// utk::CustomHeckSampler sampler(0.606f, 8.f, 0.3, true);
// auto pointset = utk::Pointset<float>{};
// std::cout << std::endl << "generating " << npoints << " blue noise points…" << std::endl;
// sampler.generateSamples(pointset, npoints);
//
// utk::write_text_pointset("pointset_16384_tc_0.3_0.00002f.txt", pointset);
// const int npoints = 16384;
// utk::CustomHeckSampler sampler(0.606f, 8.f, 0.3, true);
// auto pointset = utk::Pointset<float>{};
// std::cout << std::endl << "generating " << npoints << " blue noise points…" << std::endl;
// sampler.generateSamples(pointset, npoints);
//
// utk::write_text_pointset("pointset_16384_tc_0.3_0.00002f.txt", pointset);
//load huge pointset
//auto pointset = utk::read_text_pointset<long double>("pointset_16384_tc_0.3_0.00002f.txt")[0];
auto pointset = utk::read_text_pointset<long double>(pointset_path.c_str())[0];
//iterate pointset and fill texture
// for(int i = 0; i < pointset.Npts(); ++i)
// {
// auto point = std::make_pair(pointset[i][0] * (m_size.width - 1), pointset[i][1] * ((m_size.height) - 1));
// float_t wholex, wholey, fractionalx, fractionaly;
// fractionalx = std::modf(point.first, &wholex);
// fractionaly = std::modf(point.second, &wholey);
//
// points[wholex + wholey * m_size.width] = vec2{fractionalx, fractionaly};
// }
for(int i = 0; i < pointset.Npts(); ++i)
{
auto point = std::make_pair(pointset[i][0] * (m_size.width - 1), pointset[i][1] * ((m_size.height) - 1));
float_t wholex, wholey, fractionalx, fractionaly;
fractionalx = std::modf(point.first, &wholex);
fractionaly = std::modf(point.second, &wholey);
points[wholex + wholey * m_size.width] = vec2{fractionalx, fractionaly};
}
m_pointsetBuffer = m_alloc.createBuffer(cmdBuf, sizeof(glm::vec2) * points.size(), points.data(),
VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT);

View file

@ -45,11 +45,11 @@ public:
void setup(const VkInstance& instance, const VkDevice& device, const VkPhysicalDevice& physicalDevice, uint32_t queueFamily) override;
void createDescriptorSetLayout();
void createGraphicsPipeline();
void loadScene(const std::string& filename);
void loadScene(const std::string& filename, const std::string &pointset_path);
void updateDescriptorSet();
void createUniformBuffer();
void createTextureImages(const VkCommandBuffer& cmdBuf, tinygltf::Model& gltfModel);
void createPointsetImage(const VkCommandBuffer& cmdBuf);
void createPointsetImage(const VkCommandBuffer& cmdBuf, const std::string &pointset_image);
void updateUniformBuffer(const VkCommandBuffer& cmdBuf);
void onResize(int /*w*/, int /*h*/) override;
void destroyResources();
@ -69,10 +69,10 @@ public:
// Information pushed at each draw call
PushConstantRaster m_pcRaster{
{1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1}, // Identity matrix
{0.f, 100.f, 0.f}, // light position
{0.f, 1.f, 0.f}, // light position
0, // instance Id
1000.f, // light intensity
0, // light type
1.f, // light intensity
1, // light type
0 // material id
};

View file

@ -23,6 +23,7 @@
// at the top of imgui.cpp.
#include <array>
#include <iostream>
#define IMGUI_DEFINE_MATH_OPERATORS
#include "backends/imgui_impl_glfw.h"
@ -160,7 +161,8 @@ int main(int argc, char** argv)
// Creation of the example
//FIXME: HERE WE CAN LOAD THE SCENE
helloVk.loadScene(nvh::findFile("media/scenes/grid.gltf", defaultSearchPaths, true));
std::cout << "Using pointset " << argv[1] << std::endl;
helloVk.loadScene(nvh::findFile("media/scenes/lumberyard.gltf", defaultSearchPaths, true), argv[1]);
// Setup camera
CameraManip.setWindowSize(SAMPLE_WIDTH, SAMPLE_HEIGHT);