diff options
author | Szymon Ulatowski <szulat> | 2020-07-09 18:19:52 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-07-09 18:31:36 +0300 |
commit | 9de09220fc5fcae72bba203c641f67e75eb7ebc5 (patch) | |
tree | 7b637bcc8037e2db7a31b7e9246e0a007bf075b8 /intern/cycles/render/nodes.cpp | |
parent | 42c99ec15bfb9fb43127392cc5995ab78246d66e (diff) |
EEVEE: Implement the missing Sky texture
I'm not sure if the Sky was deliberately left out or was just waiting for a
better moment, but so many I was disappointed that Sky in EEVEE is
completely white.
There are already 2 implementations (osl and gpu) so this is the third one.
Looking at other cases it seems that we are not supposed to share sources
between cycles and the rest? So the new util_sky_model files are just
copies of what is already in cycles, except that the data file uses the RGB
variant of the Hosek/Wilkie model, because we output RGB anyway (but can be
easily changed to XYZ if desired - the results are nearly identical).
I am not sure if it is okay to pass 3*9 float values as 3 mat4 uniforms (I
wanted to use mat3 but it does not work).
Also, should I cache the sky model data between renders if the parameters
do not change?
Reviewed By: fclem, brecht
Differential Revision: https://developer.blender.org/D7108
Diffstat (limited to 'intern/cycles/render/nodes.cpp')
-rw-r--r-- | intern/cycles/render/nodes.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp index ab392839e52..1e09b71b340 100644 --- a/intern/cycles/render/nodes.cpp +++ b/intern/cycles/render/nodes.cpp @@ -27,9 +27,10 @@ #include "render/scene.h" #include "render/svm.h" +#include "sky_model.h" + #include "util/util_foreach.h" #include "util/util_logging.h" -#include "util/util_sky_model.h" #include "util/util_transform.h" #include "kernel/svm/svm_color_util.h" @@ -726,8 +727,8 @@ static void sky_texture_precompute_hosek(SunSky *sunsky, float solarElevation = M_PI_2_F - theta; /* Initialize Sky Model */ - ArHosekSkyModelState *sky_state; - sky_state = arhosek_xyz_skymodelstate_alloc_init( + SKY_ArHosekSkyModelState *sky_state; + sky_state = SKY_arhosek_xyz_skymodelstate_alloc_init( (double)turbidity, (double)ground_albedo, (double)solarElevation); /* Copy values from sky_state to SunSky */ @@ -741,7 +742,7 @@ static void sky_texture_precompute_hosek(SunSky *sunsky, sunsky->radiance_z = (float)sky_state->radiances[2]; /* Free sky_state */ - arhosekskymodelstate_free(sky_state); + SKY_arhosekskymodelstate_free(sky_state); } /* Nishita improved */ @@ -758,7 +759,7 @@ static void sky_texture_precompute_nishita(SunSky *sunsky, float pixel_bottom[3]; float pixel_top[3]; float altitude_f = (float)altitude; - nishita_skymodel_precompute_sun( + SKY_nishita_skymodel_precompute_sun( sun_elevation, sun_size, altitude_f, air_density, dust_density, pixel_bottom, pixel_top); /* send data to svm_sky */ sunsky->nishita_data[0] = pixel_bottom[0]; |