Improved particles and trajectory rendering #430

Merged
Xenosas1337 merged 19 commits from SP3-1-Rendering into main 2023-03-20 16:55:29 +08:00
4 changed files with 22 additions and 21 deletions
Showing only changes of commit 6a1ae5fac8 - Show all commits

View File

@ -8,7 +8,7 @@ const int ROTATION_KERNEL_W = 4;
const int ROTATION_KERNEL_H = 4;
// can perhaps pass in as push constant.
const float RADIUS = 0.2f;
const float RADIUS = 0.35f;
const float BIAS = 0.0025f;
layout(local_size_x = 16, local_size_y = 16) in;

Binary file not shown.

View File

@ -145,10 +145,10 @@ namespace SHADE
//SHAssetManager::CompileAsset("../../Assets/Shaders/Trajectory_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMapBlur_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/Anim_VS.glsl", false);
SHAssetManager::CompileAsset("../../Assets/Shaders/Particle_VS.glsl", false);
SHAssetManager::CompileAsset("../../Assets/Shaders/Particle_FS.glsl", false);
SHAssetManager::CompileAsset("../../Assets/Shaders/ParticleEmit_CS.glsl", false);
SHAssetManager::CompileAsset("../../Assets/Shaders/ParticleUpdate_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/Particle_VS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/Particle_FS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/ParticleEmit_CS.glsl", false);
//SHAssetManager::CompileAsset("../../Assets/Shaders/ParticleUpdate_CS.glsl", false);
// Load Built In Shaders
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);

View File

@ -19,15 +19,16 @@ namespace SHADE
// generate samples
for (uint32_t i = 0; i < NUM_SAMPLES; ++i)
{
//SHVec3 temp
//{
// distrib(generator) * 2.0f - 1.0f, // -1.0f - 1.0f
// distrib(generator) * 2.0f - 1.0f, // -1.0f - 1.0f
// distrib(generator), // 0.0f - 1.0f so that sample space is a hemisphere
//};
SHVec3 temp
{
distrib(generator) * 2.0f - 1.0f, // -1.0f - 1.0f
distrib(generator) * 2.0f - 1.0f, // -1.0f - 1.0f
distrib(generator), // 0.0f - 1.0f so that sample space is a hemisphere
};
//temp = SHVec3::Normalise(temp);
//temp *= distrib(generator);
temp = SHVec3::Normalise(temp);
temp *= distrib(generator);
samples[i] = SHVec4 (temp.x, temp.y, temp.z, 0.0f);
//// This makes sure that most points are closer to fragment's position
//float scale = 1.0f / static_cast<float>(NUM_SAMPLES);
@ -36,16 +37,16 @@ namespace SHADE
//samples[i] = SHVec4 (temp.x, temp.y, temp.z, 0.0f);
samples[i] = SHVec4
{
distrib(generator) * 2.0f - 1.0f, // -1.0f - 1.0f
distrib(generator) * 2.0f - 1.0f, // -1.0f - 1.0f
distrib(generator), // 0.0f - 1.0f so that sample space is a hemisphere
0.0f
};
//samples[i] = SHVec4
//{
// distrib(generator) * 2.0f - 1.0f, // -1.0f - 1.0f
// distrib(generator) * 2.0f - 1.0f, // -1.0f - 1.0f
// distrib(generator), // 0.0f - 1.0f so that sample space is a hemisphere
// 0.0f
//};
// This makes sure that most points are closer to fragment's position
float scale = 1.0f / static_cast<float>(NUM_SAMPLES);
float scale = static_cast<float>(i) / static_cast<float>(NUM_SAMPLES);
scale = std::lerp(0.1f, 1.0f, scale * scale);
samples[i] *= scale;
}