Skip to content
Snippets Groups Projects
Commit 33da7e00 authored by Mark Oliver Mints's avatar Mark Oliver Mints
Browse files

[#94] Soft Shadow

The implementation is a bit hacky. There is no emissive plane but 10 x 10 point light sources
parent cfdf262e
Branches
Tags
1 merge request!77Resolve "SAF-R Module"
Pipeline #27206 passed
...@@ -119,7 +119,7 @@ Intersection sceneIntersect(const vec3 rayOrigin, const vec3 rayDirection) { ...@@ -119,7 +119,7 @@ Intersection sceneIntersect(const vec3 rayOrigin, const vec3 rayDirection) {
intersection.hit = true; intersection.hit = true;
intersection.pos = pt; intersection.pos = pt;
intersection.N = vec3(0, 1, 0); intersection.N = vec3(0, 1, 0);
intersection.material = inSpheres[2].material; intersection.material = inSpheres[0].material;
} }
} }
return intersection; return intersection;
......
...@@ -12,6 +12,19 @@ ...@@ -12,6 +12,19 @@
#include "safrScene.hpp" #include "safrScene.hpp"
void createQuadraticLightCluster(std::vector<safrScene::Light>& lights, int countPerDimension, float dimension, float height, float intensity) {
float distance = dimension/countPerDimension;
for(int x = 0; x <= countPerDimension; x++) {
for (int z = 0; z <= countPerDimension; z++) {
lights.push_back(safrScene::Light(glm::vec3(x * distance, height, z * distance),
float (intensity/countPerDimension) / 10.f) // Divide by 10, because intensity is busting O.o
);
}
}
}
int main(int argc, const char** argv) { int main(int argc, const char** argv) {
const char* applicationName = "SAF_R"; const char* applicationName = "SAF_R";
...@@ -101,9 +114,13 @@ int main(int argc, const char** argv) { ...@@ -101,9 +114,13 @@ int main(int argc, const char** argv) {
//lights for the scene //lights for the scene
std::vector<safrScene::Light> lights; std::vector<safrScene::Light> lights;
/*
lights.push_back(safrScene::Light(glm::vec3(-20, 20, 20), 1.5)); lights.push_back(safrScene::Light(glm::vec3(-20, 20, 20), 1.5));
lights.push_back(safrScene::Light(glm::vec3(30, 50, -25), 1.8)); lights.push_back(safrScene::Light(glm::vec3(30, 50, -25), 1.8));
lights.push_back(safrScene::Light(glm::vec3(30, 20, 30), 1.7)); lights.push_back(safrScene::Light(glm::vec3(30, 20, 30), 1.7));
*/
createQuadraticLightCluster(lights, 10, 2.5f, 20, 1.5f);
vkcv::SamplerHandle sampler = core.createSampler( vkcv::SamplerHandle sampler = core.createSampler(
vkcv::SamplerFilterType::LINEAR, vkcv::SamplerFilterType::LINEAR,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment