diff --git a/Content/Laser/LaserMaterial.uasset b/Content/Laser/LaserMaterial.uasset
index 98c03797edda6fe7d2295748e944e8725223cd3c..3b9e1a257db445b1203e88822864e4abdec10d6d 100644
Binary files a/Content/Laser/LaserMaterial.uasset and b/Content/Laser/LaserMaterial.uasset differ
diff --git a/Source/OptiX/Private/LineInstancedStaticMeshComponent.cpp b/Source/OptiX/Private/LineInstancedStaticMeshComponent.cpp
index 1ec0d34099f84ee1c6870128e537ec15b5e6b0a9..dde61225c081e6f86db7d53bbe14c8819a406088 100644
--- a/Source/OptiX/Private/LineInstancedStaticMeshComponent.cpp
+++ b/Source/OptiX/Private/LineInstancedStaticMeshComponent.cpp
@@ -77,13 +77,15 @@ FPrimitiveSceneProxy* ULineInstancedStaticMeshComponent::CreateSceneProxy()
 	return Proxy;
 }
 
-void ULineInstancedStaticMeshComponent::InitLineSegments(int32 NumberOfLines, int32 NumberOfSegmentsPerLine, float LineW)
+// todo currently copies the array, save a reference/ptr instead
+void ULineInstancedStaticMeshComponent::InitLineSegments(TArray<int32> Indices, int32 NumberOfSegmentsPerLine, float LineW)
 {
 
 	ClearInstances();
+	
+	LaserIndices = Indices;
 
-
-	LineNumber = NumberOfLines;
+	LineNumber = LaserIndices.Num();
 	SegmentsPerLine = NumberOfSegmentsPerLine;
 	LineWidth = LineW;
 
@@ -106,9 +108,13 @@ void ULineInstancedStaticMeshComponent::InitLineSegments(int32 NumberOfLines, in
 			}
 
 			int32 Index = AddInstanceWorldSpace(LineTransform);
+			UE_LOG(LogTemp, Display, TEXT("Line Instance Index: %i"), Index);
 		}
 	}
 
+	UE_LOG(LogTemp, Display, TEXT("Created #%i Lines with #%i Segments."), LineNumber, SegmentsPerLine);
+
+
 	if (DynamicLaserMaterial != NULL)
 	{
 		DynamicLaserMaterial->SetScalarParameterValue("Segments", SegmentsPerLine);
@@ -128,7 +134,12 @@ void  ULineInstancedStaticMeshComponent::UpdateLUT(TArray<FColor> ColorMap)
 
 		ColorArray = ColorMap;
 
+		// Store the actual laser index in the alpha component of the LUT - bit hacky but should do the trick for now.
+			
+
+		// first column stores the 
 		ColorLUT = UTexture2D::CreateTransient(1, LineNumber);
+
 		ColorLUT->UpdateResource();
 
 		UE_LOG(LogTemp, Display, TEXT("ColorLUT | LineNumber (%i | %i "), ColorLUT->GetSizeX(), LineNumber);
diff --git a/Source/OptiX/Private/OptiXContext.cpp b/Source/OptiX/Private/OptiXContext.cpp
index 1c1ed34d2cef79c6b5020a0d5a04a20d94ae727f..c084ecbe2e2eca2b48bfb59ba78c2063dc267006 100644
--- a/Source/OptiX/Private/OptiXContext.cpp
+++ b/Source/OptiX/Private/OptiXContext.cpp
@@ -1155,13 +1155,13 @@ UOptiXBuffer * UOptiXContext::CreateBufferUByte3D(uint8 Type, int32 Width, int32
 	return BufferPtr;
 }
 
-UOptiXBuffer * UOptiXContext::CreateOutputBufferIntersections(int32 Width)
+UOptiXBuffer * UOptiXContext::CreateOutputBufferIntersections(int32 Width, int32 Height)
 {
 	UOptiXBuffer* BufferPtr = nullptr;
 	try
 	{
 		BufferPtr = NewObject<UOptiXBuffer>(this, UOptiXBuffer::StaticClass());
-		BufferPtr->SetBuffer(NativeContext->createBufferForCUDA(RT_BUFFER_INPUT_OUTPUT | RT_BUFFER_GPU_LOCAL, RT_FORMAT_FLOAT4, Width));
+		BufferPtr->SetBuffer(NativeContext->createBufferForCUDA(RT_BUFFER_INPUT_OUTPUT | RT_BUFFER_GPU_LOCAL, RT_FORMAT_FLOAT4, Width, Height));
 	}
 	catch (optix::Exception& E)
 	{
diff --git a/Source/OptiX/Private/OptiXContextManager.cpp b/Source/OptiX/Private/OptiXContextManager.cpp
index 43436c30df5660c517ffbaa74d2180bc311c7935..3754e7f9599802db3dc345317085bc6020e1ea32 100644
--- a/Source/OptiX/Private/OptiXContextManager.cpp
+++ b/Source/OptiX/Private/OptiXContextManager.cpp
@@ -49,7 +49,11 @@ FOptiXContextManager::FOptiXContextManager(const FAutoRegister& AutoRegister)
 
 	LaserMaxDepth = 20;
 	LaserEntryPoint = 1; // Default, will be overwritten anyway
-	LaserBufferSize = LaserMaxDepth * 50 * 50 * 2;
+
+	LaserBufferWidth = 50 * 50;
+	LaserBufferHeight = LaserMaxDepth * 2;
+
+	LaserBufferSize = LaserBufferHeight * LaserBufferWidth;
 
 	bValidCubemap.AtomicSet(false);
 
@@ -109,7 +113,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
 	// Init the yet uninitialized optix components - this queue should be empty and do nothing if no new components are registered.
 	InitOptiXComponents(RHICmdList);
 
-	// Update the remaining variables TODO this needs to be only done once per eye!
+	// Update the remaining variables TODO this needs to be only done once not once per eye!
 	OptiXContext->UpdateVariables();
 	UpdateOptiXComponentVariables();
 	UpdateRequestedCubemaps(RHICmdList);
@@ -164,7 +168,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
 		}
 
 		cudaGraphicsMapResources(2, Resources, 0);
-		//PrintLastCudaError("cudaGraphicsMapResources");
+		PrintLastCudaError("cudaGraphicsMapResources");
 
 		if (CudaResourceDepthLeft == NULL)
 		{
@@ -175,7 +179,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
 		// Copy Depth
 		cudaArray *CuArrayDepth;
 		cudaGraphicsSubResourceGetMappedArray(&CuArrayDepth, CudaResourceDepthLeft, 0, 0);
-		//PrintLastCudaError("cudaGraphicsSubResourceGetMappedArray");
+		PrintLastCudaError("cudaGraphicsSubResourceGetMappedArray");
 
 		cudaMemcpy2DToArray(
 			CuArrayDepth, // dst array
@@ -197,11 +201,11 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
 			CudaLinearMemoryColor, Width * 4 * sizeof(float),       // src
 			Width * 4 * sizeof(float), Height, // extent
 			cudaMemcpyDeviceToDevice); // kind
-		//PrintLastCudaError("cudaMemcpy2DToArray");
+		PrintLastCudaError("cudaMemcpy2DToArray");
 
 
 		cudaGraphicsUnmapResources(2, Resources, 0);
-		//PrintLastCudaError("cudaGraphicsUnmapResources");
+		PrintLastCudaError("cudaGraphicsUnmapResources");
 
 		//D3DDeviceContext->Flush();
 		LaunchLaser();
@@ -223,7 +227,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
 			return;
 		}
 		cudaGraphicsMapResources(2, Resources + 2, 0);
-		//PrintLastCudaError("cudaGraphicsMapResources");
+		PrintLastCudaError("cudaGraphicsMapResources");
 
 		if (CudaResourceDepthRight == NULL)
 		{
@@ -233,7 +237,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
 		// Depth
 		cudaArray *CuArrayDepth;
 		cudaGraphicsSubResourceGetMappedArray(&CuArrayDepth, CudaResourceDepthRight, 0, 0);
-		//PrintLastCudaError("cudaGraphicsSubResourceGetMappedArray");
+		PrintLastCudaError("cudaGraphicsSubResourceGetMappedArray");
 
 		cudaMemcpy2DToArray(
 			CuArrayDepth, // dst array
@@ -247,7 +251,7 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
 		// Color
 		cudaArray *CuArrayColor;
 		cudaGraphicsSubResourceGetMappedArray(&CuArrayColor, CudaResourceColorRight, 0, 0);
-		//PrintLastCudaError("cudaGraphicsSubResourceGetMappedArray");
+		PrintLastCudaError("cudaGraphicsSubResourceGetMappedArray");
 
 		cudaMemcpy2DToArray(
 			CuArrayColor, // dst array
@@ -255,10 +259,10 @@ void FOptiXContextManager::PostRenderView_RenderThread(FRHICommandListImmediate
 			CudaLinearMemoryColor, Width * 4 * sizeof(float),       // src
 			Width * 4 * sizeof(float), Height, // extent
 			cudaMemcpyDeviceToDevice); // kind
-		//PrintLastCudaError("cudaMemcpy2DToArray");
+		PrintLastCudaError("cudaMemcpy2DToArray");
 
 		cudaGraphicsUnmapResources(2, Resources + 2, 0);
-		//PrintLastCudaError("cudaGraphicsUnmapResources");
+		PrintLastCudaError("cudaGraphicsUnmapResources");
 	}
 	//D3DDeviceContext->Flush();
 	//end = FPlatformTime::Seconds();
@@ -290,7 +294,7 @@ void FOptiXContextManager::LaunchLaser()
 		}
 
 		cudaGraphicsMapResources(1, Resources + 4, 0);
-		//PrintLastCudaError("cudaGraphicsMapResources");
+		PrintLastCudaError("cudaGraphicsMapResources");
 
 		if (CudaResourceIntersections == NULL)
 		{
@@ -305,13 +309,14 @@ void FOptiXContextManager::LaunchLaser()
 		cudaMemcpy2DToArray(
 			CuArrayIntersections, // dst array
 			0, 0,    // offset
-			CudaLinearMemoryColor, LaserBufferSize * 4 * sizeof(float),       // src
-			LaserBufferSize * 4 * sizeof(float), 1, // extent
+			CudaLinearMemoryIntersections, LaserBufferWidth * 4 * sizeof(float),       // src
+			LaserBufferWidth * 4 * sizeof(float), LaserBufferHeight, // extent
 			cudaMemcpyDeviceToDevice); // kind
-		//PrintLastCudaError("cudaMemcpy2DToArray");
+		PrintLastCudaError("cudaMemcpy2DToArray");
 
 
 		cudaGraphicsUnmapResources(1, Resources + 4, 0);
+		PrintLastCudaError("cudaGraphicsUnmapResources");
 
 		//optix::float4* DataLaser = static_cast<optix::float4*>(LaserOutputBuffer->MapNative(0, RT_BUFFER_MAP_READ));
 		////FMemory::Memcpy(IntersectionData.GetData(), DataLaser, LaserOutputBuffer->GetSize1D() * sizeof(FVector4));
@@ -559,7 +564,7 @@ void FOptiXContextManager::InitRendering()
 	UE_LOG(LogTemp, Display, TEXT("Created the Textures"));
 
 	// Laser Texture
-	LaserIntersectionTexture = UTexture2D::CreateTransient(50, 20, PF_A32B32G32R32F); // TODO Hardcoded values
+	LaserIntersectionTexture = UTexture2D::CreateTransient(LaserBufferWidth, LaserBufferHeight, PF_A32B32G32R32F); // TODO Hardcoded values
 	LaserIntersectionTexture->AddToRoot();
 	//// Allocate the texture HRI
 	LaserIntersectionTexture->UpdateResource();
@@ -694,7 +699,7 @@ void FOptiXContextManager::InitLaser()
 	OptiXContext->SetMissProgram(1 /*LaserEntryPoint /* this is 1 in the original application, why? TODO*/, LaserMissProgram.Get());
 
 	//LaserOutputBuffer = OptiXContext->CreateBuffer(RT_BUFFER_OUTPUT, RT_FORMAT_FLOAT4, LaserBufferSize);
-	LaserOutputBuffer = OptiXContext->CreateOutputBufferIntersections(LaserBufferSize);
+	LaserOutputBuffer = OptiXContext->CreateOutputBufferIntersections(LaserBufferWidth, LaserBufferHeight);
 	LaserOutputBuffer->AddToRoot();
 	OptiXContext->SetBuffer("result_laser", LaserOutputBuffer.Get());
 
@@ -916,7 +921,7 @@ void FOptiXContextManager::InitCUDADX()
 	cudaMalloc(&CudaLinearMemoryColor, Width * Height * 4 * sizeof(float));
 	PrintLastCudaError("cudaMalloc");
 
-	cudaMalloc(&CudaLinearMemoryIntersections, LaserBufferSize * 4 * sizeof(float));
+	cudaMalloc(&CudaLinearMemoryIntersections, LaserBufferWidth * LaserBufferHeight * 4 * sizeof(float));
 	PrintLastCudaError("cudaMalloc");
 
 	//cudaMallocPitch(&CudaLinearMemoryColorRight, &Pitch, Width * sizeof(optix::uchar4), Height);
diff --git a/Source/OptiX/Private/OptiXLaserActor.cpp b/Source/OptiX/Private/OptiXLaserActor.cpp
index 9ac19d0d521c4fb66978721ee6c05ac13843113b..3e8797e55a5722b86237b0172d016c42402240e9 100644
--- a/Source/OptiX/Private/OptiXLaserActor.cpp
+++ b/Source/OptiX/Private/OptiXLaserActor.cpp
@@ -16,7 +16,7 @@ AOptiXLaserActor::AOptiXLaserActor(const FObjectInitializer& ObjectInitializer)
 {
 	UE_LOG(LogTemp, Display, TEXT("OptiX Laser Actor Constructor"));
 
-	PrimaryActorTick.bCanEverTick = true;
+	PrimaryActorTick.bCanEverTick = false;
 
 	static ConstructorHelpers::FObjectFinder<UStaticMesh>MeshAsset(TEXT("StaticMesh'/OptiX/Laser/laser3.laser3'"));
 	UStaticMesh* Asset = MeshAsset.Object;
@@ -80,7 +80,7 @@ void AOptiXLaserActor::BeginPlay()
 	//InstancedStaticMeshComponent->GetStaticMesh()->SetMaterial(0, DynamicLaserMaterial);
 	//InstancedStaticMeshComponent->SetMaterial(0, DynamicLaserMaterial);
 	//InitInstancedMeshData();
-	LineInstancedStaticMeshComponent->InitLineSegments(OptiXLaserComponent->LaserIndices.Num(), 20);
+	LineInstancedStaticMeshComponent->InitLineSegments(OptiXLaserComponent->LaserIndices, 20);
 	LineInstancedStaticMeshComponent->UpdateLUT(OptiXLaserComponent->LaserIndexColorMap);
 
 
@@ -100,23 +100,17 @@ void AOptiXLaserActor::Tick(float DeltaTime)
 	// We don't need to trace each tick, but only if either the optix scene changed, or the laser position moved. 
 	Super::Tick(DeltaTime);
 
-	if (bLaserTraceEnabled)
-	{		
-		// Check if there's anything in the queue
+	//if (bLaserTraceEnabled)
+	//{		
+	//	// Check if there's anything in the queue
 
-		if (!FOptiXModule::Get().GetOptiXContextManager()->LaserIntersectionQueue.IsEmpty())
-		{
-			DisplayLines();
-		}
-	}
-
-	//else if (FOptiXModule::Get().bSceneChanged) // TODO
-	//{
-		//Trace();
-		//DisplayLines();
-		//LaserTraceFinishedEvent.Broadcast();
-		//FOptiXModule::Get().bSceneChanged = false;
+	//	if (!FOptiXModule::Get().GetOptiXContextManager()->LaserIntersectionQueue.IsEmpty())
+	//	{
+	//		DisplayLines();
+	//	}
 	//}
+
+
 }
 
 //void AOptiXLaserActor::InitInstancedMeshData()
@@ -186,7 +180,7 @@ void AOptiXLaserActor::UpdateLaserPattern(EPatternTypes Pattern)
 
 
 	OptiXLaserComponent->SetLaserPattern(Pattern);
-	LineInstancedStaticMeshComponent->InitLineSegments(OptiXLaserComponent->LaserIndices.Num(), 20);
+	LineInstancedStaticMeshComponent->InitLineSegments(OptiXLaserComponent->LaserIndices, 20);
 
 	UE_LOG(LogTemp, Display, TEXT("#Colors: %i"), OptiXLaserComponent->LaserIndexColorMap.Num());
 
diff --git a/Source/OptiX/Private/OptiXLaserComponent.cpp b/Source/OptiX/Private/OptiXLaserComponent.cpp
index f4ef461ffd351d7cae8c92a23aa94edfaa1f6743..6629a7dc10ff097091c281f32cbb738796ca2f33 100644
--- a/Source/OptiX/Private/OptiXLaserComponent.cpp
+++ b/Source/OptiX/Private/OptiXLaserComponent.cpp
@@ -18,7 +18,11 @@ UOptiXLaserComponent::UOptiXLaserComponent()
 
 	LaserMaxDepth = 20;
 	LaserEntryPoint = 1; // Default, will be overwritten anyway
-	LaserBufferSize = LaserMaxDepth * 50 * 50 * 2;
+
+	LaserBufferWidth = 50 * 50;
+	LaserBufferHeight = LaserMaxDepth * 2;
+
+	LaserBufferSize = LaserBufferHeight * LaserBufferWidth;
 
 
 	RayTIR = false;
@@ -41,6 +45,7 @@ UOptiXLaserComponent::UOptiXLaserComponent()
 	static ConstructorHelpers::FObjectFinder<UTexture2D> QuadTextureDir(TEXT("Texture2D'/OptiX/Laser/Quad_dir.Quad_dir'"));
 
 
+
 	if (CrossTexture.Object != NULL)
 	{
 		Patterns.Add(EPatternTypes::CROSS, CrossTexture.Object);
diff --git a/Source/OptiX/Private/cuda/laser_caster.cu b/Source/OptiX/Private/cuda/laser_caster.cu
new file mode 100644
index 0000000000000000000000000000000000000000..36fe02f4a3444fe9b9933ecdb0644039a72bbeb4
--- /dev/null
+++ b/Source/OptiX/Private/cuda/laser_caster.cu
@@ -0,0 +1,107 @@
+//------------------------------------------------------------------------------
+// Project Phoenix
+//
+// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
+// Virtual Reality & Immersive Visualization Group.
+//------------------------------------------------------------------------------
+//                                 License
+//
+// Licensed under the 3-Clause BSD License (the "License");
+// you may not use this file except in compliance with the License.
+// See the file LICENSE for the full text.
+// You may obtain a copy of the License at
+//
+//     https://opensource.org/licenses/BSD-3-Clause
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//------------------------------------------------------------------------------
+
+#include <optix.h>
+#include <optixu/optixu_math_namespace.h>
+#include <optixu/optixu_matrix_namespace.h>
+#include "prd.h"
+#include "helpers.h"
+#include "random.h"
+
+
+#define PERCENTILE 1.47579f
+
+using namespace optix;
+
+rtDeclareVariable(uint3, launch_index, rtLaunchIndex, );
+rtDeclareVariable(uint3, launch_dim,   rtLaunchDim, );
+rtDeclareVariable(rtObject,      top_object, , );
+rtDeclareVariable(float,         scene_epsilon, , );
+rtDeclareVariable(int,           max_depth_laser, , );
+
+rtDeclareVariable(unsigned int,           random_frame_seed, , );
+
+rtDeclareVariable(float3,         laser_origin, , );
+rtDeclareVariable(float3,         laser_forward, , );
+rtDeclareVariable(float3,         laser_right, , );
+rtDeclareVariable(float3,         laser_up, , );
+rtDeclareVariable(Matrix4x4,      laser_rot, , );
+
+rtDeclareVariable(float,          laserBeamWidth, , );
+rtDeclareVariable(float,          laserSize, , );
+
+rtBuffer<int, 2>   			laserIndex;
+rtBuffer<float3, 2>   		laserDir;
+rtBuffer<float4, 2>			result_laser;
+
+
+RT_PROGRAM void laser_caster(){
+
+	float2 d = make_float2(launch_index.x, launch_index.y) / make_float2(launch_dim.x, launch_dim.y) - make_float2(0.5f, 0.5f);
+	float3 ray_origin = laser_origin + laser_right * laserSize * d.x + laser_up * laserSize * d.y;
+
+	//Uniform random
+	unsigned int seed = tea<16>(launch_dim.x*launch_index.y+launch_index.x*launch_index.z, random_frame_seed);
+	float2 random = make_float2(rnd(seed), rnd(seed));
+	//convert to normal distrubution
+	float r = sqrtf(-2*log(random.x));
+	float theta = 2*3.141592654f*random.y;
+	random = clamp(make_float2(r*cosf(theta), r*sinf(theta)), -4.5f, 4.5f) * laserBeamWidth * 0.5 /PERCENTILE;
+	ray_origin += (launch_index.z != 0) * (laser_right * random.x + laser_up * random.y);
+	
+	PerRayData_radiance_iterative prd;
+	optix::Ray ray(ray_origin, laser_forward, /*ray type*/ 1, scene_epsilon );
+	prd.depth = 0;
+	prd.done = false;
+	prd.hit_lens = 0; //track if the ray ever hit the lens
+	prd.power = (launch_index.z > 0) * 1; //No power for launch index 0
+	
+	// next ray to be traced
+	prd.origin = ray_origin;
+
+	Matrix3x3 laser_rot3x3 = make_matrix3x3(laser_rot);
+
+	prd.direction = laser_rot3x3 * normalize(make_float3(1,1,-1)*laserDir[make_uint2(launch_index)]);		   
+
+
+	unsigned int widthIndex = launch_index.y * 50 + launch_index.x;
+	//unsigned int startIndex = widthIndex * max_depth_laser * 2;
+	
+	bool cast_ray = laserIndex[make_uint2(launch_index)] < 0;
+	for(int i = 0; i < max_depth_laser * 2; i += 2){
+		//Determine if this launch_index, depth or last ray should trigger new cast
+		if(cast_ray || prd.done || prd.depth >= max_depth_laser){ // just write rest of data as "invalid"
+			if(launch_index.z == 0) result_laser[make_uint2(widthIndex, i)] = make_float4(0,-1,0,1);
+			if(launch_index.z == 0) result_laser[make_uint2(widthIndex, i + 1)] = make_float4(0,-1,0,1);
+			continue;
+		}
+		if(launch_index.z == 0) result_laser[make_uint2(widthIndex, i)] = make_float4(prd.origin,1);
+		
+		ray.origin = prd.origin;
+		ray.direction = prd.direction;
+		rtTrace(top_object, ray, prd);
+		
+		// Update ray data for the next path segment
+		prd.depth++;
+		if(launch_index.z == 0) result_laser[make_uint2(widthIndex, i + 1)] = make_float4(prd.origin,1);
+	}
+}
\ No newline at end of file
diff --git a/Source/OptiX/Private/cuda/miss.cu b/Source/OptiX/Private/cuda/miss.cu
deleted file mode 100644
index 6cc7415f2f0dd6e19d2af3f546974549241a496f..0000000000000000000000000000000000000000
--- a/Source/OptiX/Private/cuda/miss.cu
+++ /dev/null
@@ -1,33 +0,0 @@
-//------------------------------------------------------------------------------
-// Project Phoenix
-//
-// Copyright (c) 2017-2018 RWTH Aachen University, Germany,
-// Virtual Reality & Immersive Visualization Group.
-//------------------------------------------------------------------------------
-//                                 License
-//
-// Licensed under the 3-Clause BSD License (the "License");
-// you may not use this file except in compliance with the License.
-// See the file LICENSE for the full text.
-// You may obtain a copy of the License at
-//
-//     https://opensource.org/licenses/BSD-3-Clause
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//------------------------------------------------------------------------------
-
-#include <optix_world.h>
-#include "prd.h"
-
-rtDeclareVariable(PerRayData_radiance_iterative, prd_radiance_it, rtPayload, );
-rtDeclareVariable(optix::Ray, ray, rtCurrentRay, );
-
-RT_PROGRAM void miss_iterative()
-{
-	prd_radiance_it.origin = ray.origin + ray.direction * 1500.0f;
-	prd_radiance_it.done = true;
-}
diff --git a/Source/OptiX/Public/LineInstancedStaticMeshComponent.h b/Source/OptiX/Public/LineInstancedStaticMeshComponent.h
index c899ee3638d42bfa8a8abb5d7476cebcea984760..61df8719750ff756a2b4d40764c52bd6ae59c81d 100644
--- a/Source/OptiX/Public/LineInstancedStaticMeshComponent.h
+++ b/Source/OptiX/Public/LineInstancedStaticMeshComponent.h
@@ -28,7 +28,7 @@ public:
 
 	virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
 
-	void InitLineSegments(int32 NumberOfLines, int32 NumberOfSegmentsPerLine, float LineW = 0.01);
+	void InitLineSegments(TArray<int32> LaserIndices, int32 NumberOfSegmentsPerLine, float LineW = 0.01);
 
 	void UpdateLines(float NewLineWidth);
 
@@ -56,6 +56,9 @@ public:
 	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = OptiX)
 	TArray<FColor> ColorArray;
 
+	//UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = OptiX)
+	TArray<int32> LaserIndices;
+
 	TUniquePtr<FUpdateTextureRegion2D> TextureRegion;
 
 //protected:
diff --git a/Source/OptiX/Public/OptiXContext.h b/Source/OptiX/Public/OptiXContext.h
index 47080534857124439c361bddbc215f68ed3d4ea3..9575de5eb4888eed04f95a021843059f8985a8f9 100644
--- a/Source/OptiX/Public/OptiXContext.h
+++ b/Source/OptiX/Public/OptiXContext.h
@@ -335,7 +335,7 @@ public:
 	UOptiXBuffer* CreateOutputBufferDepth(int32 Width, int32 Height);
 
 	UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXContext")
-	UOptiXBuffer* CreateOutputBufferIntersections(int32 Width);
+	UOptiXBuffer* CreateOutputBufferIntersections(int32 Width, int32 Height);
 
 	UFUNCTION(BlueprintCallable, /*meta = (BlueprintProtected)*/ Category = "OptiXContext")
 	UOptiXBuffer* CreateInputBufferFloat(int32 Width);
diff --git a/Source/OptiX/Public/OptiXContextManager.h b/Source/OptiX/Public/OptiXContextManager.h
index 74e3d6d6c3b1c9a487ff239e48af4eb776708d22..2b0b241c8d3a57389be188b2f1e25a4493b7490c 100644
--- a/Source/OptiX/Public/OptiXContextManager.h
+++ b/Source/OptiX/Public/OptiXContextManager.h
@@ -678,6 +678,9 @@ private:
 	int32 LaserEntryPoint;
 	int32 LaserBufferSize;
 
+	int32 LaserBufferWidth;
+	int32 LaserBufferHeight;
+
 
 	// ---------------------------------------------------------------------------------------------------
 	// DX <-> CUDA stuff
diff --git a/Source/OptiX/Public/OptiXLaserComponent.h b/Source/OptiX/Public/OptiXLaserComponent.h
index 9f1d9cee5cfce97e37f705f796527a5842809b9a..fda6964c7b962e487ebd9527a263affa867617f0 100644
--- a/Source/OptiX/Public/OptiXLaserComponent.h
+++ b/Source/OptiX/Public/OptiXLaserComponent.h
@@ -106,6 +106,12 @@ public:
 	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = OptiX)
 	int32 LaserBufferSize;
 
+	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = OptiX)
+	int32 LaserBufferWidth;
+
+	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = OptiX)
+	int32 LaserBufferHeight;
+
 	UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = OptiX)
 	int32 LaserTracesPerFrame;