more data generation

This commit is contained in:
CDaut 2024-08-26 13:43:19 +02:00
parent 7a0f86c425
commit 7250fe1dd0
Signed by: clara
GPG key ID: 223391B52FAD4463
698 changed files with 248864 additions and 273 deletions

View file

@ -111,6 +111,6 @@ struct GltfShadeMaterial
int pbrBaseColorTexture;
};
#define WINDOWSIZE 512
#define WINDOWSIZE 128
#endif

View file

@ -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));
}
}