Conversation
…mek's remove_core_matrix branch, added create from mat3x3
…c cast to/from truncated quat
CMakeLists.txt
Outdated
| option(NBL_BUILD_MITSUBA_LOADER "Enable nbl::ext::MitsubaLoader?" ON) | ||
| option(NBL_BUILD_IMGUI "Enable nbl::ext::ImGui?" ON) | ||
| option(NBL_BUILD_DEBUG_DRAW "Enable Nabla Debug Draw extension?" ON) | ||
| option(NBL_BUILD_ENVMAP_IMPORTANCE_SAMPLING "Enable Nabla Envmap Importance Sampling extension?" ON) |
There was a problem hiding this comment.
no longer an extension, dont need the option
| vector2_type inverseWarp_and_deferredPdf(NBL_REF_ARG(scalar_type) pdf, vector3_type direction) NBL_CONST_MEMBER_FUNC | ||
| { | ||
| vector2_type envmapUv = PostWarpT::inverseWarp(direction); | ||
| scalar_type luma; | ||
| _lumaMap.get(envmapUv, luma); | ||
| pdf = (luma * _rcpAvgLuma) * PostWarpT::backwardDensity(direction); | ||
| return envmapUv; | ||
| } | ||
|
|
||
| scalar_type deferredPdf(vector3_type direction) NBL_CONST_MEMBER_FUNC | ||
| { | ||
| vector2_type envmapUv = PostWarpT::inverseWarp(direction); | ||
| scalar_type luma; | ||
| _lumaMap.get(envmapUv, luma); | ||
| return luma * _rcpAvgLuma * PostWarpT::backwardDensity(direction); | ||
| } | ||
|
|
||
| vector3_type generate_and_pdf(NBL_REF_ARG(scalar_type) pdf, NBL_REF_ARG(vector2_type) uv, vector2_type xi) NBL_CONST_MEMBER_FUNC |
There was a problem hiding this comment.
make it conform to #1001 's ResamplableSampler
| template <typename ScalarT, typename LuminanceAccessorT, typename HierarchicalSamplerT, typename PostWarpT | ||
| NBL_PRIMARY_REQUIRES(is_scalar_v<ScalarT> && | ||
| concepts::accessors::GenericReadAccessor<LuminanceAccessorT, ScalarT, float32_t2> && | ||
| hierarchical_image::HierarchicalSampler<HierarchicalSamplerT, ScalarT> && | ||
| concepts::Warp<PostWarpT>) | ||
| struct HierarchicalImage |
There was a problem hiding this comment.
this should be called WarpmapSampler or something like that
| const vector2_type texelCoord = xi * float32_t2(_lastWarpPixel); | ||
|
|
||
| matrix<scalar_type, 4, 2> uvs = _warpMap.sampleUvs(uint32_t2(texelCoord)); | ||
|
|
There was a problem hiding this comment.
warpmap should convert you from [0,1] normalized xi to its own texels,the sampleUvs should really work same as textureGather, it should take normalized uvs as input
|
|
||
| matrix<scalar_type, 4, 2> uvs = _warpMap.sampleUvs(uint32_t2(texelCoord)); | ||
|
|
||
| const vector2_type interpolant = frac(texelCoord); |
There was a problem hiding this comment.
make the _warpMap.gather spit out the interpolant so its cleaner (requires a specialized gather overload, adding on top of Gatherable concept)
| LuminanceAccessorT _lumaMap; | ||
| HierarchicalSamplerT _warpMap; | ||
| uint32_t2 _warpSize; | ||
| uint32_t2 _lastWarpPixel; |
There was a problem hiding this comment.
you actually only need to store the _lastWarpPixel.x * _lastWarpPixel.y prodct, I expect the warpmap to handle gathering
| if (choseSecond(wx_0, wx_1, xi.x)) | ||
| p.x |= 1; |
There was a problem hiding this comment.
btw you can get the PDF of the finally chosen texel as metadata if on the final call to choseSecond you save wx_0 or wx_1 and thats your chosen pixel luminance, you just need to know the average to and total number of texels (corner sampled edges count as half pixels) get the PDF
(obvioulsy if mip2x1 is 0, the PDF is either 1.0 or the dummy from the choice on line 64)
…ry. Assert oob access
Description
Rework environment map importance sampling to vulkan and hlsl
Testing
Rework example 0 to use vulkan and hlsl
Unit Test Pull Request
TODO list: