diff --git a/Source/OptiX/Private/OptiXContext.cpp b/Source/OptiX/Private/OptiXContext.cpp
index 537c59ce4ae2e0032300801ea54b66eb00d1c600..ffd6cf9770ff5d41def119f5f9aa091e33cd37d2 100644
--- a/Source/OptiX/Private/OptiXContext.cpp
+++ b/Source/OptiX/Private/OptiXContext.cpp
@@ -1247,6 +1247,36 @@ UOptiXBuffer * UOptiXContext::CreateCubemapBuffer(int32 Width, int32 Height)
 	return BufferPtr;
 }
 
+void UOptiXContext::SetMaxTraceDepth(int32 Depth)
+{
+	try
+	{
+		NativeContext->setMaxTraceDepth(static_cast<unsigned int>(Depth));
+	}
+	catch (optix::Exception& E)
+	{
+		FString Message = FString(E.getErrorString().c_str());
+		UE_LOG(OptiXPluginContext, Error, TEXT("OptiX Error: %s"), *Message);
+		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("OptiX Error %s"), *Message));
+	}
+}
+
+int32 UOptiXContext::GetMaxTraceDepth()
+{
+	int32 Depth = 0;
+	try
+	{
+		Depth = static_cast<int32>(NativeContext->getMaxTraceDepth()); // Loss of precision but won't happen ever anyway
+	}
+	catch (optix::Exception& E)
+	{
+		FString Message = FString(E.getErrorString().c_str());
+		UE_LOG(OptiXPluginContext, Error, TEXT("OptiX Error: %s"), *Message);
+		GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Red, FString::Printf(TEXT("OptiX Error %s"), *Message));
+	}
+	return Depth;
+}
+
 UOptiXTextureSampler * UOptiXContext::CreateTextureSampler()
 {
 	UOptiXTextureSampler* SamplerPtr = nullptr;
diff --git a/Source/OptiX/Private/OptiXContextManager.cpp b/Source/OptiX/Private/OptiXContextManager.cpp
index 66e4bd5dae1943af4f9f504bb7540ac6c4ce5507..a2c98d097cee8d1fb78018f37faf6a269b7ed100 100644
--- a/Source/OptiX/Private/OptiXContextManager.cpp
+++ b/Source/OptiX/Private/OptiXContextManager.cpp
@@ -162,37 +162,37 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
 	return;
 
 
-	// Should override it with 0s in its current state
-	cudaGraphicsResource *ppResources[1] =
-	{
-		CudaResourceDepthLeft
-	};
+	//// Should override it with 0s in its current state
+	//cudaGraphicsResource *ppResources[1] =
+	//{
+	//	CudaResourceDepthLeft
+	//};
 
-	//void* DevicePtr = NULL;
+	////void* DevicePtr = NULL;
 
 
-	//DevicePtr = OptiXContext->GetBuffer("result_depth")->GetDevicePointer(0); // 0 -> standard GPU
+	////DevicePtr = OptiXContext->GetBuffer("result_depth")->GetDevicePointer(0); // 0 -> standard GPU
 
-	cudaGraphicsMapResources(1, ppResources, 0);
-	PrintLastCudaError("cudaGraphicsMapResources");
-	// Try copying the cuda memory in the texture:
+	//cudaGraphicsMapResources(1, ppResources, 0);
+	//PrintLastCudaError("cudaGraphicsMapResources");
+	//// Try copying the cuda memory in the texture:
 
-	cudaArray *CuArray;
-	cudaGraphicsSubResourceGetMappedArray(&CuArray, CudaResourceDepthLeft, 0, 0);
-	PrintLastCudaError("cudaGraphicsSubResourceGetMappedArray");
+	//cudaArray *CuArray;
+	//cudaGraphicsSubResourceGetMappedArray(&CuArray, CudaResourceDepthLeft, 0, 0);
+	//PrintLastCudaError("cudaGraphicsSubResourceGetMappedArray");
 
-	cudaMemcpy2DToArray(
-		CuArray, // dst array
-		0, 0,    // offset
-		CudaLinearMemory, Pitch,       // src
-		Width * sizeof(float), Height, // extent
-		cudaMemcpyDeviceToDevice); // kind
-	PrintLastCudaError("cudaMemcpy2DToArray");
+	//cudaMemcpy2DToArray(
+	//	CuArray, // dst array
+	//	0, 0,    // offset
+	//	CudaLinearMemory, Pitch,       // src
+	//	Width * sizeof(float), Height, // extent
+	//	cudaMemcpyDeviceToDevice); // kind
+	//PrintLastCudaError("cudaMemcpy2DToArray");
 
-	cudaGraphicsUnmapResources(1, ppResources, 0);
-	PrintLastCudaError("cudaGraphicsUnmapResources");
+	//cudaGraphicsUnmapResources(1, ppResources, 0);
+	//PrintLastCudaError("cudaGraphicsUnmapResources");
 
-	D3DDeviceContext->Flush();
+	//D3DDeviceContext->Flush();
 }
 
 
@@ -223,6 +223,13 @@ void FOptiXContextManager::InitContext()
 
 	// Make sure that no optix context actually exists:
 
+
+	int RTXOn = 1;
+
+	RTresult Res = rtGlobalSetAttribute(RT_GLOBAL_ATTRIBUTE_ENABLE_RTX, sizeof(RTXOn), &RTXOn);
+
+	UE_LOG(LogTemp, Display, TEXT("RTX mode result, 0 means success: %i"), Res);
+
 	OptiXContext = NewObject<UOptiXContext>(GetTransientPackage(), UOptiXContext::StaticClass());
 	OptiXContext->AddToRoot();
 	NativeContext = OptiXContext->Init();
@@ -230,11 +237,36 @@ void FOptiXContextManager::InitContext()
 	// Set some default values, they can (and should) be overwritten in the game mode as they're scene specific
 	OptiXContext->SetRayTypeCount(2);
 	OptiXContext->SetEntryPointCount(1);
-	OptiXContext->SetStackSize(2000);
+	OptiXContext->SetStackSize(4640);
+
+
+	// Debug
+	OptiXContext->SetExceptionEnabled(RT_EXCEPTION_PAYLOAD_ACCESS_OUT_OF_BOUNDS, true); // WHAT THE ACTUAL FUCK OPTIX WHY DOES THIS NEED TO BE TRUE??? If it's false nothing works
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_USER_EXCEPTION_CODE_OUT_OF_BOUNDS, true);
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_TRACE_DEPTH_EXCEEDED, true);
+
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_PROGRAM_ID_INVALID, true);
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_TEXTURE_ID_INVALID, true);
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_BUFFER_ID_INVALID, true);
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_INDEX_OUT_OF_BOUNDS, true);
+	//
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_STACK_OVERFLOW, true);
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_BUFFER_INDEX_OUT_OF_BOUNDS, true);
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_INVALID_RAY, true);
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_INTERNAL_ERROR, true);
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_USER, true);
+	//OptiXContext->SetExceptionEnabled(RT_EXCEPTION_USER_MAX, true);
+
+	//OptiXContext->GetNativeContext()->setPrintEnabled(true);
+	//OptiXContext->GetNativeContext()->setPrintBufferSize(4096);
+	//OptiXContext->GetNativeContext()->setPrintLaunchIndex(100, 100, -1);
+
 
 	OptiXContext->SetInt("max_depth", 10);
 	OptiXContext->SetFloat("scene_epsilon", 1.e-2f);
 
+	OptiXContext->SetMaxTraceDepth(31);
+
 	TopObject = OptiXContext->CreateGroup();
 	TopAcceleration = OptiXContext->CreateAcceleration("Trbvh"); // Here the accel structure seems to be actually needed
 	//TopAcceleration->AddToRoot();
@@ -411,19 +443,19 @@ void FOptiXContextManager::InitCUDADX()
 	//cudaMemset(InteropTexture.CudaLinearMemory, 1, InteropTexture.Pitch * InteropTexture.Height);
 
 	// Register the unreal texture with cuda
-	cudaGraphicsD3D11RegisterResource(&CudaResourceDepthLeft, D3D11DepthLeftTexture, cudaGraphicsRegisterFlagsNone);
-	PrintLastCudaError("cudaGraphicsD3D11RegisterResource");
+	//cudaGraphicsD3D11RegisterResource(&CudaResourceDepthLeft, D3D11DepthLeftTexture, cudaGraphicsRegisterFlagsNone);
+	//PrintLastCudaError("cudaGraphicsD3D11RegisterResource");
 
-	cudaMallocPitch(&CudaLinearMemory, &Pitch, Width * sizeof(float), Height);
-	PrintLastCudaError("cudaMallocPitch");
+	//cudaMallocPitch(&CudaLinearMemory, &Pitch, Width * sizeof(float), Height);
+	//PrintLastCudaError("cudaMallocPitch");
 
-	cudaMemset(CudaLinearMemory, 1, Pitch * Height);
-	PrintLastCudaError("cudaMemset");
+	//cudaMemset(CudaLinearMemory, 1, Pitch * Height);
+	//PrintLastCudaError("cudaMemset");
 
-	OptiXContext->GetBuffer("result_depth")->SetDevicePointer(0, CudaLinearMemory);
+	//OptiXContext->GetBuffer("result_depth")->SetDevicePointer(0, CudaLinearMemory);
 
-	UE_LOG(LogTemp, Display, TEXT("Device Count: %i"), OptiXContext->GetDeviceCount());
-	UE_LOG(LogTemp, Display, TEXT("Device Name 0: %s"), *OptiXContext->GetDeviceName(0));
+	//UE_LOG(LogTemp, Display, TEXT("Device Count: %i"), OptiXContext->GetDeviceCount());
+	//UE_LOG(LogTemp, Display, TEXT("Device Name 0: %s"), *OptiXContext->GetDeviceName(0));
 
 }
 
diff --git a/Source/OptiX/Public/OptiXContext.h b/Source/OptiX/Public/OptiXContext.h
index 1f7873e35eb1abf2815753bb6e8a6a9ed5d4ae07..f134923d17eb656b1c4fb965cb02f275a6656343 100644
--- a/Source/OptiX/Public/OptiXContext.h
+++ b/Source/OptiX/Public/OptiXContext.h
@@ -53,6 +53,12 @@ public:
 
 	// TODO Begin play?
 
+	// TODO 
+	optix::Context GetNativeContext()
+	{
+		return NativeContext;
+	}
+
 	UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXContext")
 	void Reset();
 
@@ -359,6 +365,14 @@ public:
 	UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXContext")
 	UOptiXGroup* GetGroup(FString Name);
 
+	// OptiX 6.0
+
+	UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXContext")
+	void SetMaxTraceDepth(int32 Depth);
+
+	UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXContext")
+	int32 GetMaxTraceDepth();
+
 // In case I use this as a base class? TODO
 private: