Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PACANOWSKI Romain
MRF
Commits
1890e2e3
Commit
1890e2e3
authored
May 31, 2022
by
Loic Lachiver
Browse files
update hanrahan shader and debug scene
parent
5d1a3bae
Changes
3
Hide whitespace changes
Inline
Side-by-side
libmrf/mrf_plugins/materials/hanrahan_krueger/backend/optix/hanrahan_krueger.cu
View file @
1890e2e3
...
...
@@ -96,7 +96,8 @@ float phase_henyey_greenstein(float costh)
float
hanrahan_krueger_BRDF
(
float3
ffnormal
,
float3
light
,
float3
eye
)
{
float
lightDotEye
=
dot
(
normalize
(
light
),
normalize
(
eye
));
float
lightDotEye
=
dot
(
normalize
(
-
light
),
normalize
(
eye
));
float
phase
=
phase_henyey_greenstein
(
lightDotEye
);
float
ior_in
=
getIOR_in
(
current_prd
.
id_wavelength
);
...
...
@@ -132,9 +133,9 @@ float hanrahan_krueger_BRDF(float3 ffnormal, float3 light, float3 eye)
float
hanrahan_krueger_BTDF
(
float3
ffnormal
,
float3
light
,
float3
eye
)
{
ffnormal
=
-
ffnormal
;
ffnormal
=
-
ffnormal
;
float
lightDotEye
=
dot
(
normalize
(
light
),
normalize
(
eye
));
float
lightDotEye
=
dot
(
normalize
(
-
light
),
normalize
(
eye
));
float
phase
=
phase_henyey_greenstein
(
lightDotEye
);
float
ior_in
=
getIOR_in
(
current_prd
.
id_wavelength
);
...
...
@@ -187,7 +188,7 @@ COLOR bsdf_eval(float3 ffnormal, float3 eye, float3 light, int lobe)
return
COLOR
(
0.
f
);
}
float
ret
;
ret
=
phase_henyey_greenstein
(
dot
(
light
,
eye
));
ret
=
phase_henyey_greenstein
(
dot
(
-
light
,
eye
));
if
(
dot_NL
>
0
)
//reflection
{
...
...
@@ -206,7 +207,7 @@ COLOR bsdf_eval(float3 ffnormal, float3 eye, float3 light, int lobe)
//bsdf_eval_optim should return the BSDF, already multiplied by n dot l and divided by sample pdf (bsdf_pdf).
COLOR
bsdf_eval_optim
(
float3
h
,
float3
ffnormal
,
float3
eye
,
float3
light
,
int
lobe
,
float
external_pdf
)
{
return
bsdf_eval
(
ffnormal
,
eye
,
light
,
lobe
)
*
INV_PIf
;
return
bsdf_eval
(
ffnormal
,
eye
,
light
,
lobe
)
*
dot
(
light
,
ffnormal
)
/
cosine_pdf
(
ffnormal
,
eye
,
light
)
;
}
...
...
@@ -253,7 +254,8 @@ COLOR bsdf_transmittance(float length)
*/
float2
reflection_pdf
(
float3
normal
,
float3
eye
)
{
return
make_float2
(
0.5
f
*
INV_PIf
,
-
1.
f
);
return
make_float2
(
1.
f
-
((
_mean_phase_function
+
1.
f
)
/
2.
f
),
-
1.
f
);
int
id_wavelength
=
-
1
;
float
cos_theta_i
=
dot
(
normal
,
eye
);
...
...
unit_tests/rendering/materials/all/scene/hanrahan_debug.msf
View file @
1890e2e3
<scene>
<lights>
<area_light>
<emittance name="Area" type="diffuse">
<radiance value="1.0" />
<spectrum file="../../../assets/d50div100.spd" />
</emittance>
<transformations>
<transform>
<scale x="5.0" y="25.0" z="1.0" />
<translation x="4.556416034698486" y="10.497808456420898" z="4.067174911499023" />
<rotation>
<angle value="96.25583423699537" />
<axis x="-0.8963695764541626" y="-0.3134658932685852" z="0.3134658932685852" />
</rotation>
</transform>
</transformations>
</area_light>
</lights>
<materials>
<material name="default_lambert" repetition="5.0" type="Checkerboard">
...
...
@@ -24,11 +6,8 @@
<spectrum file="../../../assets/12_orangeyellow.spd" />
</material>
<material name="hanrahan_-0.9" type="HanrahanKrueger" mean_phase_function="-0.9f" ior1="1.0f" ior2="1.4f">
<extinction>
<rgb_color b="0.9" g="0.2" r="0.9" />
<spectrum file="../../../assets/green_extinction.spd" />
</extinction>
<material name="hanrahan_-0.9" type="HanrahanKrueger" mean_phase_function="-0.9f">
<fresnel>
<eta>
<rgb_color b="1.4500000476837158" g="1.4500000476837158" r="1.4500000476837158" />
...
...
@@ -41,11 +20,8 @@
</fresnel>
</material>
<material name="hanrahan_-0.4" type="HanrahanKrueger" mean_phase_function="-0.4f" ior1="1.0f" ior2="1.4f">
<extinction>
<rgb_color b="0.9" g="0.2" r="0.9" />
<spectrum file="../../../assets/green_extinction.spd" />
</extinction>
<material name="hanrahan_-0.4" type="HanrahanKrueger" mean_phase_function="-0.4f">
<fresnel>
<eta>
<rgb_color b="1.4500000476837158" g="1.4500000476837158" r="1.4500000476837158" />
...
...
@@ -58,11 +34,8 @@
</fresnel>
</material>
<material name="hanrahan_0.0" type="HanrahanKrueger" mean_phase_function="0.0f" ior1="1.0f" ior2="1.4f">
<extinction>
<rgb_color b="0.9" g="0.2" r="0.9" />
<spectrum file="../../../assets/green_extinction.spd" />
</extinction>
<material name="hanrahan_0.0" type="HanrahanKrueger" mean_phase_function="0.0f">
<fresnel>
<eta>
<rgb_color b="1.4500000476837158" g="1.4500000476837158" r="1.4500000476837158" />
...
...
@@ -75,11 +48,8 @@
</fresnel>
</material>
<material name="hanrahan_0.4" type="HanrahanKrueger" mean_phase_function="0.4f" ior1="1.0f" ior2="1.4f">
<extinction>
<rgb_color b="0.9" g="0.2" r="0.9" />
<spectrum file="../../../assets/green_extinction.spd" />
</extinction>
<material name="hanrahan_0.4" type="HanrahanKrueger" mean_phase_function="0.4f">
<fresnel>
<eta>
<rgb_color b="1.4500000476837158" g="1.4500000476837158" r="1.4500000476837158" />
...
...
@@ -93,11 +63,8 @@
</material>
<material name="hanrahan_0.9" type="HanrahanKrueger" mean_phase_function="0.9f" ior1="1.0f" ior2="1.4f">
<extinction>
<rgb_color b="0.9" g="0.2" r="0.9" />
<spectrum file="../../../assets/green_extinction.spd" />
</extinction>
<material name="hanrahan_0.9" type="HanrahanKrueger" mean_phase_function="0.9f">
<fresnel>
<eta>
<rgb_color b="1.4500000476837158" g="1.4500000476837158" r="1.4500000476837158" />
...
...
@@ -145,24 +112,18 @@
</sphere>
</shape>
<shape ref_material="default_lambert">
<mesh>
<obj file="../../../assets/Plane.obj" />
</mesh>
</shape>
</shapes>
<background type="uniform">
<spectrum file="../../../assets/d50div100.spd" />
</background>
</scene>
<ext_resources>
<envmaps>
<panoramic power_scaling="1.0" file="./hanrahan_envmap.hdr" name="my_envmap"></panoramic>
<panoramic power_scaling="0.1" file="./hanrahan_envmap.hdr" name="my_envmap_spectral"></panoramic>
</envmaps>
</ext_resources>
<background type="envmap" ref_envmap="my_envmap" ref_envmap_spectral="my_envmap_spectral"></background>
</scene>
\ No newline at end of file
unit_tests/rendering/materials/all/scene/hanrahan_envmap.hdr
0 → 100644
View file @
1890e2e3
File added
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment