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

Dummy PR to keep everyone's contributor status #547

Open
wants to merge 64 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
d3f4169
Add files via upload
nahiim Nov 7, 2022
95cc93f
Update animtation.hlsl
nahiim Nov 7, 2022
507b1a6
Update keyframe.hlsl
nahiim Nov 7, 2022
bcb9f77
Update node.hlsl
nahiim Nov 7, 2022
b9b29d2
Add files via upload
nahiim Nov 7, 2022
6d7e989
Delete animtation.hlsl
nahiim Nov 7, 2022
6c24d2c
Update node.hlsl
nahiim Nov 7, 2022
ef4f253
Add files via upload
nahiim Nov 7, 2022
b89cad1
Delete node.hlsl
nahiim Nov 7, 2022
c964e09
Add files via upload
nahiim Nov 7, 2022
bb088e9
Update keyframe.hlsl
nahiim Nov 7, 2022
2e65bbc
brdf
nahiim Nov 9, 2022
cc39ce3
geom smith
nahiim Nov 9, 2022
9f18406
fixed minor math blunder
nahiim Nov 9, 2022
bfc2143
...
nahiim Nov 9, 2022
c80b0e9
Shapes and ieee754
nahiim Nov 10, 2022
321b252
numeric_limits
nahiim Nov 10, 2022
b5d3a4c
colorspace_EOTF
nahiim Nov 11, 2022
4ecbd7c
colorspace completed
nahiim Nov 11, 2022
8eec0c0
fixed typos
nahiim Nov 12, 2022
e644e74
Create HLSL_NABLA_COMPILE_TEST target for compile-testing Nabla's new…
AnastaZIuk Nov 12, 2022
8135e46
Find a way to clean environment for clear DXC compilation, make sure …
AnastaZIuk Nov 13, 2022
4712763
link dxcompiler library to Nabla
AnastaZIuk Nov 13, 2022
a215ee3
add dxc as dependency of HLSL_NABLA_COMPILE_TEST
AnastaZIuk Nov 13, 2022
9dd660f
math
nahiim Nov 14, 2022
255f8e8
maths
nahiim Nov 14, 2022
42b19d7
Merge remote-tracking branch 'origin/hlsl' into local_hlsl
nahiim Nov 14, 2022
95e9e2d
Merge remote-tracking branch 'origin/dxcIntegration' into local_hlsl
nahiim Nov 14, 2022
f01eeee
minor fixes
nahiim Nov 15, 2022
cbf8d71
automated HLSL compilation
nahiim Nov 15, 2022
1990c18
complex and constants
nahiim Nov 17, 2022
953b681
math completed
nahiim Nov 21, 2022
7011441
shapes completed
nahiim Nov 23, 2022
a09b8ef
create random/xoroshiro.hlsl
nahiim Nov 24, 2022
d5e3189
porting hlsl/utils
nahiim Nov 29, 2022
b3a17c9
add hlsl/utils/culling
nahiim Dec 2, 2022
47c82ce
add morton, normal_encode, normal_decode, culling
nahiim Dec 6, 2022
f037e69
utils
nahiim Dec 7, 2022
5f70cca
surface_transform finishing
nahiim Dec 8, 2022
67b22f0
add utils/transform
nahiim Dec 9, 2022
9cfc8fb
update transform.hlsl
nahiim Dec 10, 2022
0efa057
utils, loader, property_pool, blit
nahiim Dec 31, 2022
9720334
Seems like all BRDF functions are ported to HLSL and compiling ok
Crisspl Mar 11, 2023
bb6ec81
ported bsdf functions to HLSL
Crisspl Mar 17, 2023
52589d2
Reworked & renamed bxdf functions to _quotient_and_pdf convention
Crisspl Mar 21, 2023
e2daa63
HLSL BxDF concepts design: common bxdf classes
Crisspl Mar 22, 2023
6853d83
HLSL BxDF concepts design: some work done on NDFs
Crisspl Mar 28, 2023
a49760c
Typo and missing create() for blinnphong
Crisspl Mar 29, 2023
758a390
Fresnels
Crisspl Mar 29, 2023
5e2bf89
Diffuse BxDFs
Crisspl Mar 29, 2023
915ef27
Generic CookTorrance BRDF implementation
Crisspl Mar 29, 2023
c81e7ab
Merge pull request #475 from Crisspl/local_hlsl
devshgraphicsprogramming Sep 19, 2023
cf68dd5
Delete include/nbl/builtin/hlsl/math/binary_operator_functions.hlsl
devshgraphicsprogramming Sep 19, 2023
2b9f418
Update complex.hlsl
devshgraphicsprogramming Sep 19, 2023
0b5adfa
Resolved conflicts
Przemog1 Sep 20, 2023
1a87eb3
Merge branch 'type_traits' of https://github.com/Devsh-Graphics-Progr…
Przemog1 Sep 21, 2023
011af04
Merge branch 'master' of https://github.com/Devsh-Graphics-Programmin…
Przemog1 Sep 23, 2023
0f44f7c
Deleted xoutput (#554)
Przemog1 Sep 29, 2023
2fa14cf
Resolved conflicts
Przemog1 Oct 11, 2023
5190699
Deleted old files
Przemog1 Oct 11, 2023
b8a4bdd
Merge pull request #566 from Devsh-Graphics-Programming/give_credit_new
Przemog1 Oct 17, 2023
03f876e
Resolved conflicts
Przemog1 Oct 17, 2023
7eab08e
Resolved conflicts
Przemog1 Oct 17, 2023
4bb3160
Merge pull request #569 from Devsh-Graphics-Programming/give_credit_new
Przemog1 Oct 17, 2023
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
1 change: 1 addition & 0 deletions 3rdparty/EGL
Submodule EGL added at 9eeb49
1 change: 1 addition & 0 deletions 3rdparty/SPIRV-Headers
Submodule SPIRV-Headers added at b8047f
1 change: 1 addition & 0 deletions 3rdparty/SPIRV-Tools
Submodule SPIRV-Tools added at 75e53b
1 change: 1 addition & 0 deletions 3rdparty/radeonrays
Submodule radeonrays added at e42145
114 changes: 114 additions & 0 deletions compile.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@

@echo off

setlocal enabledelayedexpansion


:: List of shaders to compile (paths relative to include/nbl/builtin/hlsl/)
set file_path[0]=common
set file_path[1]=algorithm
set file_path[2]=ieee754

set file_path[3]=limits/numeric

set file_path[4]=math/complex
set file_path[5]=math/constants
set file_path[6]=math/functions
set file_path[7]=math/binary_operator_functions
set file_path[8]=math/quaternions

set file_path[9]=scene/animation
set file_path[10]=scene/keyframe
set file_path[11]=scene/node

set file_path[12]=format/constants
set file_path[13]=format/decode
set file_path[14]=format/encode

set file_path[15]=colorspace/decodeCIEXYZ
set file_path[16]=colorspace/encodeCIEXYZ
set file_path[17]=colorspace/EOTF
set file_path[18]=colorspace/OETF

set file_path[19]=shapes/aabb
set file_path[20]=shapes/rectangle
set file_path[21]=shapes/triangle
set file_path[22]=shapes/frustum

set file_path[23]=random/xoroshiro

set file_path[24]=utils/compressed_normal_matrix_t
set file_path[25]=utils/acceleration_structures
set file_path[26]=utils/common
set file_path[27]=utils/culling
set file_path[28]=utils/morton
set file_path[29]=utils/normal_decode
set file_path[30]=utils/normal_encode
set file_path[31]=utils/surface_transform
set file_path[32]=utils/transform
rem set file_path[33]=utils/indirect_commands

set file_path[33]=loader/mtl/common

set file_path[34]=lod_library/structs
rem set file_path[36]=lod_library/descriptor_set

set file_path[35]=property_pool/transfer

set file_path[36]=blit/formats_encode
rem set file_path[37]=blit/blit/descriptors




rem set file_path[23]=bxdf/fresnel






set "XOUTPUT_PATH=include/nbl/builtin/hlsl/xoutput/"
set "HLSL_PATH=include/nbl/builtin/hlsl/"


:: Count elements in "file_path" array
set /a len=0
:Loop
if defined file_path[%len%] (
set /a len+=1
GOTO :Loop
)
set /a len-=1


cd include/nbl/builtin/hlsl


:: Create non-existing file paths
for /L %%a in (0, 1, %len%) do (
if not exist "xoutput\!file_path[%%a]!" (
mkdir "xoutput/!file_path[%%a]!"
rmdir "xoutput\!file_path[%%a]!"
)
)

cd ../../../../

echo:
echo:
echo Compiling HLSL shaders...
echo:
echo:
:: Compile all
for /L %%a in (0, 1, %len%) do (
3rdparty\dxc\dxc\bin\x64\dxc.exe -HV 2021 -T lib_6_7 -I include/ -Zi -Qembed_debug -Fo %XOUTPUT_PATH%!file_path[%%a]!.bin %HLSL_PATH%!file_path[%%a]!.hlsl
)
echo:
echo:
echo Done Compiling!
echo Compiled shaders are in - "%XOUTPUT_PATH%"
echo:
echo:

pause
2 changes: 1 addition & 1 deletion examples_tests
44 changes: 44 additions & 0 deletions include/nbl/builtin/hlsl/bxdf/brdf/diffuse/fresnel_correction.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Copyright (C) 2018-2020 - 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_BXDF_BRDF_DIFFUSE_FRESNEL_CORRECTION_INCLUDED_
#define _NBL_BUILTIN_HLSL_BXDF_BRDF_DIFFUSE_FRESNEL_CORRECTION_INCLUDED_

namespace nbl
{
namespace hlsl
{
namespace bxdf
{
namespace brdf
{
namespace diffuse
{

float3 diffuseFresnelCorrectionFactor(in vec3 n, in vec3 n2)
{
const float C1 = 554.33;
const float C2 = 380.7;
const float C3 = 298.25;
const float C4 = 261.38;
const float C5 = 138.43;
const float C6 = 0.8078843897748912;
const float C7 = -1.67;
const float C8 = 0.1921156102251088;


//assert(n*n==n2);
bool3 TIR = (n < 1.0);
vec3 invdenum = lerp(float3(1.0,1.0,1.0), float3(1.0,1.0,1.0)/(n2*n2*(vec3(C1,C1,C1) - C2*n)), TIR);
vec3 num = n*lerp(float3(C8,C8,C8),n*C3 - C4*n2 + C5,TIR);
num += lerp(float3(C6,C6,C6),float3(C7,C7,C7),TIR);
return num*invdenum;
}

}
}
}
}
}

#endif
130 changes: 130 additions & 0 deletions include/nbl/builtin/hlsl/bxdf/brdf/diffuse/lambert.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
// Copyright (C) 2018-2020 - 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_BXDF_BRDF_DIFFUSE_LAMBERT_INCLUDED_
#define _NBL_BUILTIN_HLSL_BXDF_BRDF_DIFFUSE_LAMBERT_INCLUDED_

#include <nbl/builtin/hlsl/bxdf/common.hlsl>
#include <nbl/builtin/hlsl/sampling/cos_weighted.hlsl>

namespace nbl
{
namespace hlsl
{
namespace bxdf
{
namespace brdf
{
namespace diffuse
{

float lambertian()
{
return math::RECIPROCAL_PI;
}

float lambertian_cos_eval_rec_pi_factored_out_wo_clamps(in float maxNdotL)
{
return maxNdotL;
}
float lambertian_cos_eval_rec_pi_factored_out(in float NdotL)
{
return lambertian_cos_eval_rec_pi_factored_out_wo_clamps(max(NdotL,0.0f));
}

float lambertian_cos_eval_wo_clamps(in float maxNdotL)
{
return lambertian_cos_eval_rec_pi_factored_out_wo_clamps(maxNdotL)*lambertian();
}
template <class IncomingRayDirInfo>
float lambertian_cos_eval(in LightSample<IncomingRayDirInfo> _sample)
{
return lambertian_cos_eval_rec_pi_factored_out(_sample.NdotL)*lambertian();
}

template <class IncomingRayDirInfo>
LightSample<IncomingRayDirInfo> lambertian_cos_generate_wo_clamps(in float3 tangentSpaceV, in float3x3 m, in float2 u)
{
float3 L = sampling::projected_hemisphere_generate(u);

return LightSample<IncomingRayDirInfo>::createTangentSpace(tangentSpaceV,IncomingRayDirInfo::create(L),m);
}
template <class IncomingRayDirInfo>
LightSample<IncomingRayDirInfo> lambertian_cos_generate(in surface_interactions::Anisotropic<IncomingRayDirInfo> interaction, in float2 u)
{
return lambertian_cos_generate_wo_clamps(interaction.getTangentSpaceV(),interaction.getTangentFrame(),u);
}



float lambertian_pdf_wo_clamps(in float maxNdotL)
{
return sampling::projected_hemisphere_pdf(maxNdotL);
}

template <class IncomingRayDirInfo>
float lambertian_pdf(in LightSample<IncomingRayDirInfo> s, in surface_interactions::Isotropic<IncomingRayDirInfo> i)
{
return lambertian_pdf_wo_clamps(max(s.NdotL,0.0f));
}


quotient_and_pdf_scalar lambertian_cos_quotient_and_pdf_wo_clamps(in float maxNdotL)
{
float pdf;
float q = sampling::projected_hemisphere_quotient_and_pdf(pdf, maxNdotL);

return quotient_and_pdf_scalar::create(q, pdf);
}
template <class IncomingRayDirInfo>
quotient_and_pdf_scalar lambertian_cos_quotient_and_pdf(in LightSample<IncomingRayDirInfo> s)
{
float pdf;
float q = sampling::projected_hemisphere_quotient_and_pdf(pdf, max(s.NdotL,0.0f));

return quotient_and_pdf_scalar::create(q, pdf);
}

template <class IncomingRayDirInfo>
struct Lambertian : BxDFBase<float, float, LightSample<IncomingRayDirInfo>, surface_interactions::Isotropic<IncomingRayDirInfo> >
{
using base_t = BxDFBase<float, float, LightSample<IncomingRayDirInfo>, surface_interactions::Isotropic<IncomingRayDirInfo> >;

static Lambertian create()
{
Lambertian lambertian;
return lambertian;
}

typename base_t::spectrum_t cos_eval(in typename base_t::sample_t s, in typename base_t::interaction_t interaction)
{
return math::RECIPROCAL_PI * max(s.NdotL, 0.0f);
}

static
typename base_t::sample_t generate(in surface_interactions::Anisotropic<IncomingRayDirInfo> interaction, inout float3 u)
{
float3 L = sampling::projected_hemisphere_generate(u.xy);

const float3 tangentSpaceV = interaction.getTangentSpaceV();
const float3x3 tangentFrame = interaction.getTangentFrame();

return LightSample<IncomingRayDirInfo>::createTangentSpace(tangentSpaceV, IncomingRayDirInfo::create(L), tangentFrame);
}

typename base_t::q_pdf_t cos_quotient_and_pdf(in typename base_t::sample_t s, in typename base_t::interaction_t interaction)
{
float pdf;
float q = sampling::projected_hemisphere_quotient_and_pdf(pdf, max(s.NdotL, 0.0f));

return quotient_and_pdf_scalar::create(q, pdf);
}
};

}
}
}
}
}

#endif
Loading