Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging dev into main #74

Merged
merged 35 commits into from
Dec 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
e91fbe3
Version bump before sync to main.
jbikker Dec 18, 2024
115f2a3
Update README.md
jbikker Dec 18, 2024
2aaff3e
Merge branch 'dev' of https://github.com/jbikker/tinybvh into dev
jbikker Dec 18, 2024
e89bf4c
Minimalist wavefront code.
jbikker Dec 18, 2024
2a49133
Error in windows window.
jbikker Dec 18, 2024
dd8dc99
Disabling BuildNEON for now.
jbikker Dec 19, 2024
299bc27
Functional basic gpu wavefront path tracer.
jbikker Dec 19, 2024
f8098a2
Next Event Estimation for wavefront pt.
jbikker Dec 19, 2024
e554bbf
New screenshot.
jbikker Dec 19, 2024
e711d22
Update README.md
jbikker Dec 19, 2024
2affe64
Fix for second bounce.
jbikker Dec 20, 2024
c8c6093
NEE now accounts for BRDF.
jbikker Dec 20, 2024
f204b7f
Specular support in wavefront pt.
jbikker Dec 20, 2024
2372756
native_recip and fast_normalize
benanil Dec 20, 2024
9bca1e9
Merge pull request #71 from benanil/dev
jbikker Dec 20, 2024
71e50d4
Blue noise to play with.
jbikker Dec 20, 2024
c86ac2a
Blue noise sampling for NEE & bounce.
jbikker Dec 20, 2024
a848a16
Update README.md
jbikker Dec 21, 2024
392d450
Optimized cwbvh for ~10% faster traversal.
jbikker Dec 21, 2024
8feb5c2
Merge branch 'dev' of https://github.com/jbikker/tinybvh into dev
jbikker Dec 21, 2024
d73d549
Merge branch 'dev' of https://github.com/jbikker/tinybvh into dev
jbikker Dec 21, 2024
4e51514
Save/load for cwbvh, proper path state in wavefront.
jbikker Dec 22, 2024
8846bbe
Merged.
jbikker Dec 22, 2024
d04ae10
MIS for wavefront path tracer.
jbikker Dec 22, 2024
91d1a1a
Better documented code.
jbikker Dec 22, 2024
ed3451c
Minor comments.
jbikker Dec 22, 2024
cc624f9
Fixed MIS.
jbikker Dec 23, 2024
473fbc4
Update README.md
jbikker Dec 23, 2024
b1db88a
Update README.md
jbikker Dec 23, 2024
e22f885
Update README.md
jbikker Dec 23, 2024
36caa36
Update README.md
jbikker Dec 23, 2024
38e50d5
More MIS fixes.
jbikker Dec 23, 2024
a659545
Merge branch 'dev' of https://github.com/jbikker/tinybvh into dev
jbikker Dec 23, 2024
87b9189
tinby_bvh_gpu now compiles on Linux; CodeMaid applied.
jbikker Dec 26, 2024
437ce4f
Update README.md
jbikker Dec 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed MIS.
  • Loading branch information
jbikker committed Dec 23, 2024
commit cc624f9b396216eb78a73c59cff7e4fa6962ab64
17 changes: 12 additions & 5 deletions wavefront.cl
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ struct RenderData
global float4* cwbvhTris;
global uint* blueNoise;
};
const float3 lightColor = (float3)(20,20,18);
const float3 lightColor = (float3)(1.7f,1.7f,1.5f);

__global volatile int extendTasks, shadeTasks, connectTasks;
__global struct RenderData rd;
@@ -154,7 +154,7 @@ void kernel Shade( global float4* accumulator,
uint vertIdx = as_uint( hit.w ) * 3;
float4 v0 = verts[vertIdx];
uint materialType = as_uint( v0.w ) >> 24;
float hemiPDF = T4.w;
float brdfPDF = T4.w;
float3 D = D4.xyz;
// end path on light
if (materialType == MATERIAL_LIGHT)
@@ -171,13 +171,13 @@ void kernel Shade( global float4* accumulator,
float lightDistance = D4.w, lightArea = 9 * 5, NLdotL = fabs( D.y ); // actually: dot( D, NL ).
float solidAngle = min( TWOPI, lightArea * (1.0f / (lightDistance * lightDistance)) * NLdotL );
float lightPDF = 1 / solidAngle;
MISweight = 1 / (lightPDF + hemiPDF);
MISweight = 1 / (lightPDF + brdfPDF);
}
accumulator[pixelIdx] += (float4)(T * MISweight * lightColor, 1);
continue;
}
// apply postponed hemisphere PDF
T *= 1.0f / hemiPDF;
T *= 1.0f / brdfPDF;
// generate four random numbers
float r0, r1, r2, r3;
if (depth == 0 && sampleIdx < 4)
@@ -211,7 +211,14 @@ void kernel Shade( global float4* accumulator,
float dist2 = dot( L, L ), dist = sqrt( dist2 );
L *= native_recip( dist );
float NLdotL = fabs( L.y ); // actually, fabs( dot( L, LN ) )
shadowOut[newShadowIdx].T = (float4)(lightColor * BRDF * T * NdotL * NLdotL * native_recip( dist2 ), 0);
float solidAngle = min( TWOPI, 9 * 5 * NLdotL / dist2 );
float lightPDF = 1.0f / solidAngle;
// calculate the pdf for the alternative technique: brdf sampling
float brdfPDF = dot( L, N ) * INVPI;
// use MIS pdf to calculate potential direct light contribution
float MISPDF = lightPDF + brdfPDF;
float3 contribution = T * lightColor * BRDF * (NdotL / MISPDF);
shadowOut[newShadowIdx].T = (float4)(contribution, 0);
shadowOut[newShadowIdx].O = (float4)(I + L * EPSILON, as_float( pixelIdx ));
shadowOut[newShadowIdx].D = (float4)(L, dist - 2 * EPSILON);
}
Loading