Skip to content

Commit affe269

Browse files
committedMay 28, 2024
Fully implemented reprojection
1 parent e1194fe commit affe269

File tree

8 files changed

+18
-13
lines changed

8 files changed

+18
-13
lines changed
 

‎README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Not so fast game engine that doesn't use rasterization.
77

88
## Installation and building
99
### Prerequirements
10-
- Any GPU with VK_KHR_Ray_Tracing_Pipeline support
10+
- Any GPU with VK_KHR_ray_tracing_pipeline support
1111
- Vulkan API with binded path to it
1212

1313
### Installation

‎rttEngine/Rendering/Vulkan/VulkanLayer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -751,8 +751,8 @@ void VulkanLayer::RecordCommandBuffer(uint32_t imageIndex)
751751

752752
vkCmdTraceRaysKHR(commandBuffer.GetBuffer(), &rgenRegion, &rmissRegion, &rchitRegion, &sbt_null, resolution[0], resolution[1], 1);
753753

754-
vkCmdBindPipeline(commandBuffer.GetBuffer(), VK_PIPELINE_BIND_POINT_COMPUTE, atrousPipeline.GetPipeline());
755-
vkCmdBindDescriptorSets(commandBuffer.GetBuffer(), VK_PIPELINE_BIND_POINT_COMPUTE, atrousPipeline.GetPipelineLayout(), 0, 1, &descSetAtrous, 0, nullptr);
754+
//vkCmdBindPipeline(commandBuffer.GetBuffer(), VK_PIPELINE_BIND_POINT_COMPUTE, atrousPipeline.GetPipeline());
755+
//vkCmdBindDescriptorSets(commandBuffer.GetBuffer(), VK_PIPELINE_BIND_POINT_COMPUTE, atrousPipeline.GetPipelineLayout(), 0, 1, &descSetAtrous, 0, nullptr);
756756
/*int atrousSize = 1;
757757
vkCmdPushConstants(commandBuffer.GetBuffer(), atrousPipeline.GetPipelineLayout(), VK_SHADER_STAGE_COMPUTE_BIT, 0, 4, &atrousSize);
758758
vkCmdDispatch(commandBuffer.GetBuffer(), resolution[0]/32.0+1, resolution[1] / 32.0 + 1, 1);

‎rttEngine/Rendering/Vulkan/VulkanLayer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class VulkanLayer : public RenderingLayer {
6767

6868
},{
6969
//"VK_LAYER_LUNARG_api_dump",
70-
"VK_LAYER_KHRONOS_validation"
70+
//"VK_LAYER_KHRONOS_validation"
7171
});
7272

7373
rttvk::DebugMessenger debugMessenger = rttvk::DebugMessenger(&instance);

‎rttEngine/Utils/MeshLoader/obj/ObjLoader.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,13 @@ OBJLoader::OBJLoader(std::string file, MeshData* mesh)
102102
materialNameLenght++;
103103
}
104104
sm = "Content/Textures/" + sm;
105+
if (sm == "Content/Textures/textures/lion.tga") {
106+
RTT_LOG("123");
107+
}
108+
;
105109
Material* currentMat = &mesh->materialsArray[currentMaterial];
106110
AssetRegistry* ar = &GetProcessInfo()->assetRegistry;
107-
currentMat->albedoTexture = GetProcessInfo()->assetRegistry.textures[sm];
111+
currentMat->albedoTexture = ar->textures[sm];
108112
}
109113
}
110114
}

‎rttGameTemplate/Content/EngineLoad/Shaders/raytracer.rgen

+7-6
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,16 @@ void main() {
204204
direction = normalize(prd.normal+sampleSphere(coords+randomValue(pixelIndex)));
205205
}
206206

207-
vec3 v0 = vec3(1,resolution.resData.x/resolution.resData.y*0.5,0.5)*matrix2;
208-
vec3 v1 = vec3(1,resolution.resData.x/resolution.resData.y*0.5,-0.5)*matrix2;
209-
vec3 v2 = vec3(1,-resolution.resData.x/resolution.resData.y*0.5,0.5)*matrix2;
210-
vec3 v3 = vec3(1,-resolution.resData.x/resolution.resData.y*0.5,-0.5)*matrix2;
207+
vec3 v0 = vec3(vec3(1.0,resolution.resData.x/resolution.resData.y*0.5,0.5)*depth)*matrix2;
208+
vec3 v1 = vec3(vec3(1.0,resolution.resData.x/resolution.resData.y*0.5,-0.5)*depth)*matrix2;
209+
vec3 v2 = vec3(vec3(1.0,-resolution.resData.x/resolution.resData.y*0.5,0.5)*depth)*matrix2;
210+
vec3 v3 = vec3(vec3(1.0,-resolution.resData.x/resolution.resData.y*0.5,-0.5)*depth)*matrix2;
211211

212212

213213
vec3 origin2 = vec3(camera.prevCameraPos[0].w,camera.prevCameraPos[1].w,camera.prevCameraPos[2].w);
214-
215-
origin = vec3(0.0);
214+
origin = vec3(camera.cameraPos[0].w,camera.cameraPos[1].w,camera.cameraPos[2].w);
215+
216+
origin = origin-origin2;
216217
direction = normalize(vec3(1,-texCoords))*matrix;
217218
vec3 proj = vec3(-1.0);
218219
if (camera.prevCameraPos==camera.cameraPos) {
Binary file not shown.
Binary file not shown.

‎rttGameTemplate/Source/Sun.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Sun::Sun()
66

77
void Sun::Tick(float deltaTime)
88
{
9-
light.pos[0] = -3000;
10-
light.pos[1] = 2000;
9+
light.pos[0] = 0000;
10+
light.pos[1] = 3500;
1111
light.pos[2] = 10000;
1212
light.size = 500;
1313

0 commit comments

Comments
 (0)
Please sign in to comment.