Simple Normals Rendering

This commit is contained in:
IlyaShurupov 2023-10-16 13:38:56 +03:00
parent 97525efacb
commit 0e41a6e4fd
9 changed files with 2296 additions and 156 deletions

View file

@ -4,6 +4,7 @@
#include "Buffer.hpp"
#include "RayTracer.hpp"
#include "Strings.hpp"
#include "Timing.hpp"
#include "Vec.hpp"
#include "OBJ_Loader.h"
@ -71,13 +72,24 @@ void renderCommand(const String& scenePath, RayTracer::RenderBuffer::Index2D siz
loadScene(scene, scenePath);
scene.mCamera.lookAtPoint({0, 0, 0}, {-3, -3, 3}, {1, 1, 1});
scene.mCamera.setFOV(3.14 / 4);
scene.mCamera.setRatio((halnf) size.y / (halnf) size.x);
scene.mCamera.setFar(100);
RayTracer::RenderBuffer output;
output.reserve(size);
RayTracer rayt;
auto start = get_time();
rayt.render(scene, output);
auto end = get_time();
printf("\n Render finished with average render time per sample - %i (ms)\n", end - start);
writeImage(output);
}
@ -86,7 +98,7 @@ int main() {
tp::ModuleManifest module("Rayt", nullptr, nullptr, deps);
if (module.initialize()) {
renderCommand("scene.obj", {1000, 1000});
renderCommand("scene.obj", {600, 600});
module.deinitialize();
}

View file

@ -1,12 +1,10 @@
# Blender MTL File: 'None'
# Material Count: 1
newmtl Material
Ns 323.999994
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.800000 0.800000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.450000
d 1.000000
newmtl None
Ns 500
Ka 0.8 0.8 0.8
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2

File diff suppressed because it is too large Load diff