more data generation
This commit is contained in:
parent
7a0f86c425
commit
7250fe1dd0
698 changed files with 248864 additions and 273 deletions
|
|
@ -349,27 +349,27 @@ void HelloVulkan::createPointsetImage(const VkCommandBuffer& cmdBuf)
|
|||
|
||||
|
||||
//generate blue noise points
|
||||
/*const int npoints = 262144;
|
||||
utk::CustomHeckSampler sampler(0.606f, 8.f, 0.5);
|
||||
auto pointset = utk::Pointset<float>{};
|
||||
std::cout << std::endl << "generating " << npoints << " blue noise points…" << std::endl;
|
||||
sampler.generateSamples(pointset, npoints);
|
||||
// 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);
|
||||
|
||||
utk::write_text_pointset("pointset_262144.txt", pointset);
|
||||
*/
|
||||
//load huge pointset
|
||||
auto pointset = utk::read_text_pointset<long double>("pointset_262144.txt")[0];
|
||||
//auto pointset = utk::read_text_pointset<long double>("pointset_16384_tc_0.3_0.00002f.txt")[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);
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ int main(int argc, char** argv)
|
|||
helloVk.initGUI(0); // Using sub-pass 0
|
||||
|
||||
// Creation of the example
|
||||
//FIXME: HERE WE CAN LOAD THE SCENE
|
||||
helloVk.loadScene(nvh::findFile("media/scenes/grid.gltf", defaultSearchPaths, true));
|
||||
|
||||
// Setup camera
|
||||
|
|
@ -180,6 +181,7 @@ int main(int argc, char** argv)
|
|||
}
|
||||
//set camera
|
||||
CameraManip.setLookat(eye, center, up);
|
||||
CameraManip.setFov(37.f);
|
||||
|
||||
|
||||
helloVk.createOffscreenRender();
|
||||
|
|
@ -228,7 +230,7 @@ int main(int argc, char** argv)
|
|||
helloVk.resetFrame();
|
||||
renderUI(helloVk, useRaytracer);
|
||||
ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
|
||||
ImGuiH::Control::Info("", "", "(F10) Toggle Pane", ImGuiH::Control::Flags::Disabled);
|
||||
ImGuiH::Control::Info("", "", "(F11) Toggle Pane", ImGuiH::Control::Flags::Disabled);
|
||||
ImGuiH::Panel::End();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -111,6 +111,6 @@ struct GltfShadeMaterial
|
|||
int pbrBaseColorTexture;
|
||||
};
|
||||
|
||||
#define WINDOWSIZE 512
|
||||
#define WINDOWSIZE 128
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#version 460
|
||||
#extension GL_EXT_ray_tracing : require
|
||||
#extension GL_GOOGLE_include_directive : enable
|
||||
#extension GL_ARB_shader_clock : enable
|
||||
#extension GL_EXT_shader_explicit_arithmetic_types_int64 : require
|
||||
|
||||
#include "raycommon.glsl"
|
||||
|
|
@ -40,7 +41,12 @@ layout(push_constant) uniform _PushConstantRay { PushConstantRay pcRay; };
|
|||
void main()
|
||||
{
|
||||
|
||||
const vec2 rayOriginInPix = vec2(gl_LaunchIDEXT.xy) + pointset[gl_LaunchIDEXT.x + WINDOWSIZE * gl_LaunchIDEXT.y].xy;
|
||||
//TODO: LOAD FROM BLUE NOISE POINTSET
|
||||
//const vec2 rayOriginInPix = vec2(gl_LaunchIDEXT.xy) + pointset[gl_LaunchIDEXT.x + WINDOWSIZE * gl_LaunchIDEXT.y].xy;
|
||||
uint seed = tea(gl_LaunchIDEXT.y * gl_LaunchSizeEXT.x + gl_LaunchIDEXT.x, int(clockARB()));
|
||||
float x = rnd(seed);
|
||||
float y = rnd(seed);
|
||||
const vec2 rayOriginInPix = vec2(gl_LaunchIDEXT.xy) + vec2(x, y);
|
||||
const vec2 inUV = rayOriginInPix / vec2(gl_LaunchSizeEXT.xy);
|
||||
vec2 d = inUV * 2.0 - 1.0;
|
||||
|
||||
|
|
@ -65,5 +71,18 @@ void main()
|
|||
0// payload (location = 0)
|
||||
);
|
||||
|
||||
imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(prd.hitValue, 1.0));
|
||||
|
||||
//Do accumulation over time
|
||||
if (pcRay.frame > 0)
|
||||
{
|
||||
float a = 1.0f / float(pcRay.frame + 1);
|
||||
vec3 old_color = imageLoad(image, ivec2(gl_LaunchIDEXT.xy)).xyz;
|
||||
imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(mix(old_color, prd.hitValue, a), 1.f));
|
||||
}
|
||||
else
|
||||
{
|
||||
// First frame, replace the value in the buffer
|
||||
imageStore(image, ivec2(gl_LaunchIDEXT.xy), vec4(prd.hitValue, 1.f));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue