-
Notifications
You must be signed in to change notification settings - Fork 67
IES updates #965
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
Open
AnastaZIuk
wants to merge
71
commits into
master
Choose a base branch
from
ies
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
IES updates #965
Changes from all commits
Commits
Show all changes
71 commits
Select commit
Hold shift + click to select a range
199b75a
Update CONTRIBUTING.md
devshgraphicsprogramming 36d9943
Get IES cpps to compile
AnastaZIuk e312993
cap kind args
AnastaZIuk 25c4bdc
fix a bug after my NSC rules update
AnastaZIuk 3d18b58
update examples_tests submodule, we will first make CI pass with IES …
AnastaZIuk 27de67f
update examples_tests submodule
AnastaZIuk 0110f98
update examples_tests submodule
AnastaZIuk 9ed5aee
ah IES was not added to asset manager, also correct some aspectMask s…
AnastaZIuk 35931bd
update examples_tests submodule
AnastaZIuk a892678
update examples_tests submodule
AnastaZIuk 5e236e6
update examples_tests submodule
AnastaZIuk 7b27168
update examples_tests submodule
AnastaZIuk 77e9e57
update examples_tests submodule
AnastaZIuk 699e841
update ImGUI extension to allow hijacking precompiled SPIRV shaders (…
AnastaZIuk bd6cc4d
update examples_tests submodule
AnastaZIuk 9381491
a few minor updates to NBL_CREATE_NSC_COMPILE_RULES to skip optional …
AnastaZIuk ae0b160
CP_UTF8 for dxc source buffer's encoding just like code page (experim…
AnastaZIuk d45e3a7
update examples_tests submodule
AnastaZIuk 5ecf50e
fix IES Profile average emission and domain calculations
07feaff
Update CI references
e8ea119
`-Wno-local-type-template-args` for NBL_CREATE_NSC_COMPILE_RULES, upd…
AnastaZIuk 1e9138e
make the IES octahedral maps corner sampled
be62e3a
improve how the resolution of an IES is calculated but also leave a T…
0c03e2f
Update CI references
80de6aa
update examples_tests submodule
AnastaZIuk e05478d
update examples_tests submodule
AnastaZIuk 8d0c237
add createGrid to geometry creator
AnastaZIuk dbd2805
remove debug code I forgot about
AnastaZIuk 054038f
add positions to geometry creator's grid for the polygon to be usable…
AnastaZIuk f64a8f3
update examples_tests submodule
AnastaZIuk c941991
update examples_tests submodule
AnastaZIuk 95246c4
update examples_tests submodule
AnastaZIuk 8eba4c9
pull ditt, resolve conflicts
AnastaZIuk 4bb2864
add include/nbl/builtin/hlsl/math/octahedral.hlsl
AnastaZIuk 12d608f
CONTRIBUTING.md post update
AnastaZIuk 2eadc3b
wipe CIESProfile::octahdronUVToDir and use HLSL version
AnastaZIuk ff2558b
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk 1d8aa31
wipe CIESProfile::sphericalDirToRadians and use polar.hlsl
AnastaZIuk a7287ca
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk 7105b0c
add include/nbl/builtin/hlsl/ies/profile.hlsl and include/nbl/builtin…
AnastaZIuk 811ced6
update IES .cpp files, downgrade IES internal scalar storage to float…
AnastaZIuk 53766dc
pull master, resolve conflicts
AnastaZIuk 80d4479
a few updates due to WAVE, ambiguity and DXC bugs, new ImGui/builtin/…
AnastaZIuk 0ec69a7
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk 1a25fc0
fix another ambiguity, finally my unified IES shader compiled
AnastaZIuk 83da9c5
ah I broke nabla build, this one fixes the ambiguity and compiles for…
AnastaZIuk 7c5b658
add source groups, include HLSL files in solution
AnastaZIuk 67518fe
update examples_tests submodule
AnastaZIuk 1ed5d82
add shadertoolsconfig.json, include in source group, leave some comme…
AnastaZIuk 9814b88
update examples_tests submodule
AnastaZIuk cf12cee
pull master
AnastaZIuk e605969
update dxc submodule, pull microsoft:main and s-perron:i7945
AnastaZIuk d517cf1
Merge branch 'master' of github.com:Devsh-Graphics-Programming/Nabla …
AnastaZIuk 53e4ab1
update dxc submodule, it crashes!
AnastaZIuk 5b79bb4
update examples_tests submodule
AnastaZIuk 0db984b
update examples_tests submodule
AnastaZIuk 5ce6fa2
update examples_tests submodule
AnastaZIuk 83a83a4
update ProfileProperties to tightly pack version, type and symmetry, …
AnastaZIuk b855e1c
NBL_HLSL_DEFINE_STRUCT for IESTextureInfo, update ies/profile.hlsl ca…
AnastaZIuk 2c5974e
fix optimal resolution bug, update examples_tests submodule
AnastaZIuk 777e443
update examples_tests submodule
AnastaZIuk 5331ebe
pull master, resolve conflicts
AnastaZIuk cab896a
update examples_tests submodule
AnastaZIuk 6329e3a
resolve conflicts, pull master
AnastaZIuk 80ed36a
pull master, resolve conflicts
AnastaZIuk e7a0ef4
add IES texture eval overload, remove some old code, update examples_…
AnastaZIuk 3e5f8d0
awful nsc tooling bug I didn't notice while merging https://github.co…
AnastaZIuk f95f163
update examples_tests submodule
AnastaZIuk 575136e
builtin sources & headers per configuration
AnastaZIuk 2f5de5d
wipe installation rules of builtin resource headers, they are not inc…
AnastaZIuk c71762e
BUILD_INTERFACE for builtin auto-gen include search directories
AnastaZIuk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule ci
updated
37 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule examples_tests
updated
34 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,25 +6,33 @@ | |
|
|
||
| #include <nbl/builtin/glsl/math/constants.glsl> | ||
|
|
||
| // TODO: implement proper mirroing | ||
| // MIRROR_180_BITS = 0b001, Last Angle is 180, so map V slightly differently | ||
| // MIRROR_90_BITS = 0b010, Last Angle is 90, so map both U and V slightly differently | ||
| // ISOTROPIC_BITS = 0b011, texture to sample is Nx1, pretend v=middle always | ||
| // FULL_THETA_BIT = 0b100, handle extended domain and rotate by 45 degrees for anisotropic | ||
|
|
||
| vec2 nbl_glsl_IES_convert_dir_to_uv(vec3 dir) { | ||
| float sum = dot(vec3(1.0f), abs(dir)); | ||
| // TODO: when rewriting to HLSL this is not IES namespace or folder, this should be octahedral mapping sitting somewhere where the spherical/polar sits | ||
| // NOTE: I changed it to return NDC [-1,1]^2 instead of UV coords [0,1]^2 | ||
| vec2 nbl_glsl_TODOnamespace_octahedral_mapping(vec3 dir) | ||
| { | ||
| float sum = dot(vec3(1.0f), abs(dir)); | ||
| vec3 s = dir / sum; | ||
|
|
||
| if(s.z < 0.0f) { | ||
| s.xy = sign(s.xy) * (1.0f - abs(s.yx)); | ||
| if(s.z < 0.0f) | ||
| { | ||
| const uvec2 flipSignMask = floatBitsToUint(s.xy)&0x80000000u; | ||
| s.xy = uintBitsToFloat(floatBitsToUint(1.0f - abs(s.yx))^flipSignMask); | ||
| } | ||
|
|
||
| return s.xy * 0.5f + 0.5f; | ||
| return s.xy; | ||
| } | ||
|
|
||
| // vec2 nbl_glsl_IES_convert_dir_to_uv(vec3 dir) { | ||
| // return vec2((atan(dir.x, dir.y) + nbl_glsl_PI) / (2.0*nbl_glsl_PI), acos(dir.z) / nbl_glsl_PI); | ||
| // } | ||
| // TODO: implement proper mirroing | ||
| // MIRROR_180_BITS = 0b001, Last Angle is 180, so map V with MIRROR and corner sampling off | ||
| // MIRROR_90_BITS = 0b010, Last Angle is 90, so map both U and V with MIRROR and corner sampling off | ||
| // ISOTROPIC_BITS = 0b011, texture to sample is Nx1, pretend v=middle always , and make u REPEAT or CLAMP_TO_BORDER | ||
| // FULL_THETA_BIT = 0b100, handle truncated domain and rotate by 45 degrees for anisotropic | ||
| // (certain combos wont work like 90 degree 2 symmetry domain & half theta), it really needs to be an 8 case label thing explicitly enumerated | ||
| vec2 nbl_glsl_IES_convert_dir_to_uv(vec3 dir, vec2 halfMinusHalfPixel) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: forgot to wipe, not used anymore
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. EDIT: file to remove but leaving it due to reference in material compiler glsl |
||
| { | ||
| // halfMinusHalfPixel = 0.5-0.5/texSize | ||
| // believe it or not, cornerSampled(NDC*0.5+0.5) = NDC*0.5*(1-1/texSize)+0.5 | ||
| return nbl_glsl_TODOnamespace_octahedral_mapping(dir)*halfMinusHalfPixel+0.5; | ||
| } | ||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,4 +33,5 @@ SVertexAttributes main() | |
| SVertexAttributes retval; | ||
| retval.uv = tc[gl_VertexIndex()]; | ||
| return retval; | ||
| } | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| // Copyright (C) 2018-2025 - DevSH Graphics Programming Sp. z O.O. | ||
| // This file is part of the "Nabla Engine". | ||
| // For conditions of distribution and use, see copyright notice in nabla.h | ||
|
|
||
| #ifndef _NBL_BUILTIN_HLSL_IES_PROFILE_INCLUDED_ | ||
| #define _NBL_BUILTIN_HLSL_IES_PROFILE_INCLUDED_ | ||
|
|
||
| #include "nbl/builtin/hlsl/cpp_compat.hlsl" | ||
|
|
||
| namespace nbl | ||
| { | ||
| namespace hlsl | ||
| { | ||
| namespace ies | ||
| { | ||
|
|
||
| struct ProfileProperties | ||
| { | ||
| //! max 16K resolution | ||
| NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MAX_TEXTURE_WIDTH = 15360u; | ||
| NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MAX_TEXTURE_HEIGHT = 8640u; | ||
|
|
||
| // TODO: This constraint 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 | ||
| // don't want to spend time to fix this since we'll be using descriptor indexing for the next iteration | ||
| NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MIN_TEXTURE_WIDTH = 128u; | ||
| NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_MIN_TEXTURE_HEIGHT = 128u; | ||
|
|
||
| NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_DEFAULT_TEXTURE_WIDTH = 1024u; | ||
| NBL_CONSTEXPR_STATIC_INLINE uint32_t CDC_DEFAULT_TEXTURE_HEIGHT = 1024u; | ||
|
|
||
| NBL_CONSTEXPR_STATIC_INLINE float32_t MAX_VANGLE = 180.f; | ||
| NBL_CONSTEXPR_STATIC_INLINE float32_t MAX_HANGLE = 360.f; | ||
|
|
||
| // TODO: could change to uint8_t once we get implemented | ||
| // https://github.com/microsoft/hlsl-specs/pull/538 | ||
| using packed_flags_t = uint16_t; | ||
|
|
||
| NBL_CONSTEXPR_STATIC_INLINE packed_flags_t VERSION_BITS = 2u; | ||
| NBL_CONSTEXPR_STATIC_INLINE packed_flags_t TYPE_BITS = 2u; | ||
| NBL_CONSTEXPR_STATIC_INLINE packed_flags_t SYMM_BITS = 3u; | ||
| NBL_CONSTEXPR_STATIC_INLINE packed_flags_t VERSION_MASK = (packed_flags_t(1u) << VERSION_BITS) - packed_flags_t(1u); | ||
| NBL_CONSTEXPR_STATIC_INLINE packed_flags_t TYPE_MASK = (packed_flags_t(1u) << TYPE_BITS) - packed_flags_t(1u); | ||
| NBL_CONSTEXPR_STATIC_INLINE packed_flags_t SYMM_MASK = (packed_flags_t(1u) << SYMM_BITS) - packed_flags_t(1u); | ||
|
|
||
| enum Version : packed_flags_t | ||
| { | ||
| V_1995, | ||
| V_2002, | ||
| V_SIZE | ||
| }; | ||
|
|
||
| enum PhotometricType : packed_flags_t | ||
| { | ||
| TYPE_NONE, | ||
| TYPE_C, | ||
| TYPE_B, | ||
| TYPE_A | ||
| }; | ||
|
|
||
| enum LuminairePlanesSymmetry : packed_flags_t | ||
| { | ||
| ISOTROPIC, //! Only one horizontal angle present and a luminaire is assumed to be laterally axial symmetric | ||
| QUAD_SYMETRIC, //! The luminaire is assumed to be symmetric in each quadrant | ||
| HALF_SYMETRIC, //! The luminaire is assumed to be symmetric about the 0 to 180 degree plane | ||
| OTHER_HALF_SYMMETRIC, //! HALF_SYMETRIC case for legacy V_1995 version where horizontal angles are in range [90, 270], in that case the parser patches horizontal angles to be HALF_SYMETRIC | ||
| NO_LATERAL_SYMMET //! The luminaire is assumed to exhibit no lateral symmet | ||
| }; | ||
|
|
||
| Version getVersion() NBL_CONST_MEMBER_FUNC | ||
| { | ||
| return (Version)( packed & VERSION_MASK ); | ||
| } | ||
|
|
||
| PhotometricType getType() NBL_CONST_MEMBER_FUNC | ||
| { | ||
| const packed_flags_t shift = VERSION_BITS; | ||
| return (PhotometricType)((packed >> shift) & TYPE_MASK); | ||
| } | ||
|
|
||
| LuminairePlanesSymmetry getSymmetry() NBL_CONST_MEMBER_FUNC | ||
| { | ||
| const packed_flags_t shift = VERSION_BITS + TYPE_BITS; | ||
| return (LuminairePlanesSymmetry)((packed >> shift) & SYMM_MASK); | ||
| } | ||
|
|
||
| void setVersion(Version v) | ||
| { | ||
| packed_flags_t vBits = (packed_flags_t)(v) & VERSION_MASK; | ||
| packed = (packed & ~VERSION_MASK) | vBits; | ||
| } | ||
|
|
||
| void setType(PhotometricType t) | ||
| { | ||
| const packed_flags_t shift = VERSION_BITS; | ||
| packed_flags_t tBits = ((packed_flags_t)(t) & TYPE_MASK) << shift; | ||
| packed = (packed & ~(TYPE_MASK << shift)) | tBits; | ||
| } | ||
|
|
||
| void setSymmetry(LuminairePlanesSymmetry s) | ||
| { | ||
| const packed_flags_t shift = VERSION_BITS + TYPE_BITS; | ||
| packed_flags_t sBits = ((packed_flags_t)(s) & SYMM_MASK) << shift; | ||
| packed = (packed & ~(SYMM_MASK << shift)) | sBits; | ||
| } | ||
|
|
||
| float32_t maxCandelaValue; //! Max candela sample value | ||
| float32_t totalEmissionIntegral; //! Total emitted intensity (integral over full angular domain) | ||
| float32_t fullDomainAvgEmission; //! Mean intensity over full angular domain (including I == 0) | ||
| float32_t avgEmmision; //! Mean intensity over emitting solid angle (I > 0) | ||
| packed_flags_t packed; //! Packed version, type and symmetry flags | ||
| }; | ||
|
|
||
| } | ||
| } | ||
| } | ||
|
|
||
| #endif // _NBL_BUILTIN_HLSL_IES_PROFILE_INCLUDED_ |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: forgot to wipe, not used anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: file to remove but leaving it due to reference in material compiler glsl