You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: include/nbl/builtin/glsl/ies/functions.glsl
+22-14Lines changed: 22 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -6,25 +6,33 @@
6
6
7
7
#include <nbl/builtin/glsl/math/constants.glsl>
8
8
9
-
// TODO: implement proper mirroing
10
-
// MIRROR_180_BITS = 0b001, Last Angle is 180, so map V slightly differently
11
-
// MIRROR_90_BITS = 0b010, Last Angle is 90, so map both U and V slightly differently
12
-
// ISOTROPIC_BITS = 0b011, texture to sample is Nx1, pretend v=middle always
13
-
// FULL_THETA_BIT = 0b100, handle extended domain and rotate by 45 degrees for anisotropic
14
-
15
-
vec2 nbl_glsl_IES_convert_dir_to_uv(vec3 dir) {
16
-
float sum =dot(vec3(1.0f), abs(dir));
9
+
// TODO: when rewriting to HLSL this is not IES namespace or folder, this should be octahedral mapping sitting somewhere where the spherical/polar sits
10
+
// NOTE: I changed it to return NDC [-1,1]^2 instead of UV coords [0,1]^2
// TODO: If no symmetry (no folding in half and abuse of mirror sampler) make dimensions odd-sized so middle texel taps the south pole
120
+
121
+
// TODO: This is hack because the mitsuba loader and its material compiler use Virtual Texturing, and there's some bug with IES not sampling sub 128x128 mip levels
122
+
// don't want to spend time to fix this since we'll be using descriptor indexing for the next iteration
// TODO: in reality one should transform the 4 vertices (or 3) into octahedral map, work out the dUV/dPhi and dUV/dTheta vectors as-if for Anisotropic Filtering
195
+
// then choose the minor axis length, and use that as a pixel size (since looking for smallest thing, dont have to worry about handling discont)
if (nonZeroEmissionDomainSize <= std::numeric_limits<float>::min()) // protect us from division by small numbers (just in case, we should never hit it)
0 commit comments