Fixing ray tracing lens

This commit is contained in:
Dynamitos
2025-06-30 21:15:14 +02:00
parent 8499d418e8
commit 59b73420d6
10 changed files with 44 additions and 39 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import Scene;
import RayTracingData;
import VertexData;
import Material;
import StaticMeshVertexData;
import MATERIAL_FILE_NAME;
// simplification: all BLAS only have 1 geometry
@@ -194,7 +195,7 @@ void closestHit(inout RayPayload hitValue, in BuiltInTriangleIntersectionAttribu
}
}
// Indirect Illumination: cosine-weighted importance sampling
if(hitValue.depth < 12) {
if(hitValue.depth < 1) {
float r1 = 2 * PI * rnd.x, r2 = rnd.y, r2s = sqrt(r2);
float3 w = normalLight_WS;
float3 u = normalize(cross(abs(w.x)>0.1 ? float3(0,1,0) : float3(1,0,0), w));
+2 -1
View File
@@ -9,7 +9,6 @@ struct Ray
}
const static float S_O = 6.9;
const static float f = 0.035;
const static float A = 0.0;
struct SampleParams
@@ -69,6 +68,8 @@ void raygen()
float3 cx = -normalize(cross(cam.d, abs(cam.d.y) < 0.9 ? float3(0, 1, 0) : float3(0, 0, 1))), cy = cross(cam.d, cx);
const float2 sdim = float2(0.036, 0.024);
float f = sdim.y / (2 * tan(70.0f * 0.5f));
float S_I = (S_O * f) / (S_O - f);
//-- sample sensor