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

Blender 2.9 LTS support #2082

Merged
merged 79 commits into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
79 commits
Select commit Hold shift + click to select a range
6a6d383
Update "Armory Props" object panel to Blender 2.9 layouts
MoritzBrueckner Dec 30, 2020
a647263
Update "Armory Proxy" object panel to Blender 2.9 layouts
MoritzBrueckner Dec 30, 2020
257f295
Update "Armory Lod" object panel to Blender 2.9 layouts
MoritzBrueckner Dec 30, 2020
52cee7f
Update "Armory Traits" object panel to Blender 2.9 layouts
MoritzBrueckner Dec 30, 2020
4862054
Reorder trait type selection
MoritzBrueckner Dec 30, 2020
14bca0e
Shorten too long node trait operator labels
MoritzBrueckner Dec 30, 2020
5838401
Merge pull request #2077 from MoritzBrueckner/2.9-UI-ObjectPanel
luboslenco Jan 1, 2021
cab20d0
Principled BSDF: update input socket indices to Blender 2.9
MoritzBrueckner Jan 4, 2021
bf7592a
Merge pull request #2081 from MoritzBrueckner/2.9-PrincipledBSDF
luboslenco Jan 5, 2021
c5e9522
Blender 2.9: Update operator options
MoritzBrueckner Jan 6, 2021
80ea096
Fix Exporter and conversions for Physics World in Blender 2.9.X
QuantumCoderQC Jan 6, 2021
ad12af6
Merge pull request #2083 from MoritzBrueckner/2.9-Operators
luboslenco Jan 7, 2021
833b513
Merge pull request #2084 from QuantumCoderQC/29RBFix
luboslenco Jan 7, 2021
c697744
Blender 2.9: Fix tilesheet operator exceptions when using the search …
MoritzBrueckner Jan 11, 2021
4f25af4
Cleanup
MoritzBrueckner Jan 11, 2021
4920098
Blender 2.9: Fix another exception when using the search menu
MoritzBrueckner Jan 11, 2021
9bab721
Merge pull request #2086 from MoritzBrueckner/2.9-Search-Fixes
luboslenco Jan 11, 2021
1b9f010
Blender 2.9: Improve project window panel UI
MoritzBrueckner Jan 14, 2021
a98559e
Blender 2.9: Improve material blending panel UI
MoritzBrueckner Jan 14, 2021
4c0f0f4
Blender 2.9: slightly improve renderpath "Renderer" panel UI
MoritzBrueckner Jan 14, 2021
406d48e
Blender 2.9: Improve renderpath world panel UI
MoritzBrueckner Jan 14, 2021
133777f
Blender 2.9: Improve renderpath postprocess panel UI
MoritzBrueckner Jan 14, 2021
b4f0df6
Blender 2.9: Redesign renderpath compositor panel UI
MoritzBrueckner Jan 14, 2021
40efd58
Blender 2.9: Improve trait list UI and fix checkbox position
MoritzBrueckner Jan 14, 2021
b7903db
Change canvas icon according to the canvas node category
MoritzBrueckner Jan 14, 2021
fb88361
Blender 2.9: Simplify and improve trait panel UI
MoritzBrueckner Jan 14, 2021
820de42
Blender 2.9: Fix lod list layout
MoritzBrueckner Jan 14, 2021
04fdcc5
Cleanup
MoritzBrueckner Jan 14, 2021
fa7f58e
Ensure that only logic node trees show up as node traits
MoritzBrueckner Jan 14, 2021
ee1b551
Move icon code into module
MoritzBrueckner Jan 15, 2021
7b55f3d
Blender 2.9: Improve `Add Trait` operator UI
MoritzBrueckner Jan 17, 2021
ffd3d6e
Show is_object property when `Add Trait` is not invoked from the UI
MoritzBrueckner Jan 17, 2021
562d39c
Blender 2.9: Improve Armory player panel UI
MoritzBrueckner Jan 17, 2021
22d3530
Blender 2.9: Add Nishita sky model implementation
MoritzBrueckner Jan 21, 2021
396e605
Optimize Nishita sky shader
MoritzBrueckner Jan 21, 2021
288ead6
Nishita sky: implement air and dust density
MoritzBrueckner Jan 21, 2021
6b6dc62
Blender 2.9: Improve exporter settings UI
MoritzBrueckner Jan 24, 2021
6ae76bf
Blender 2.9: Improve exporter panel UI
MoritzBrueckner Jan 25, 2021
d7e70c4
Blender 2.9: Improve project flags panel UI
MoritzBrueckner Jan 25, 2021
ba62ba0
Blender 2.9: Fix/Improve collision filter mask UI
MoritzBrueckner Jan 25, 2021
1d79708
Fix trait type backward compatibility with pre-Blender2.9 files
MoritzBrueckner Jan 25, 2021
d55f889
Another small compositor panel UI improvement
MoritzBrueckner Jan 25, 2021
0530781
Fix grammar in warnings report
MoritzBrueckner Jan 25, 2021
e3f992b
Whitespace cleanup
MoritzBrueckner Jan 25, 2021
a1bbd76
Fix: Remove unused/non-existing armory icon
MoritzBrueckner Jan 25, 2021
0fdb516
Merge pull request #2093 from MoritzBrueckner/2.9-UI
luboslenco Jan 25, 2021
75bb888
Blender 2.9: Cycles attribute node - support alpha output and new att…
MoritzBrueckner Jan 29, 2021
121d449
Blender 2.9: Cycles attribute node - support object/custom properties
MoritzBrueckner Jan 29, 2021
d0e92b9
Merge pull request #2097 from armory3d/2.9-AttributeNode
luboslenco Jan 30, 2021
f2c1609
Fix lod operator polling and add some bl_options
MoritzBrueckner Jan 30, 2021
cbb8ee4
Merge pull request #2099 from MoritzBrueckner/2.9-LodOperators
luboslenco Feb 1, 2021
28011bc
Nishita sky: add sun disk drawing
MoritzBrueckner Feb 13, 2021
702436e
Add artistic option for darkening clouds at night
MoritzBrueckner Feb 13, 2021
9255487
Fix nishita sky altitude
MoritzBrueckner Feb 21, 2021
742b9ce
Nishita sky: add support for ozone density
MoritzBrueckner Feb 21, 2021
5f55b00
Begin with Nishita LUT implementation for better performance
MoritzBrueckner Mar 11, 2021
ef8fb21
Update lightmapper to Blender 2.9+
Naxela Mar 18, 2021
5fe816d
Add in-menu option for OpenCV installation
Naxela Mar 18, 2021
451e348
Merge pull request #2133 from Naxela/blender2.9
luboslenco Mar 20, 2021
eb6d23f
Fix material translucency in Blender 2.9+
Naxela Mar 22, 2021
fb56d85
Merge pull request #2138 from Naxela/blender2.9
luboslenco Mar 23, 2021
05c1423
shader.py: add API to set texture params
MoritzBrueckner Mar 25, 2021
8d81254
Use 2D LUT for Nishita skies
MoritzBrueckner Mar 25, 2021
845d2af
Use switch/case for uniform links
MoritzBrueckner Mar 26, 2021
420033c
Add API to set Nishita density parameters
MoritzBrueckner Mar 26, 2021
ffcc5fc
Make clouds work with Nishita sky model
MoritzBrueckner Mar 31, 2021
c5be90d
Cleanup
MoritzBrueckner Mar 31, 2021
656b018
Render (ir)radiance probes if no other probes are set
MoritzBrueckner Apr 1, 2021
34f08e6
Fix irradiance brightness
MoritzBrueckner Apr 1, 2021
899411d
Cleanup write_probes.py
MoritzBrueckner Apr 2, 2021
c9182cc
Merge pull request #2149 from MoritzBrueckner/2.9-NishitaSky
luboslenco Apr 3, 2021
f64419d
Merge branch 'master' into blender2.9
MoritzBrueckner Apr 3, 2021
316eafd
Merge pull request #2150 from MoritzBrueckner/blender2.9
luboslenco Apr 3, 2021
97b578d
Fix export of attribute node if no UV map exists
MoritzBrueckner Apr 19, 2021
bb5ff19
Merge pull request #2163 from MoritzBrueckner/fix-attribute-node
luboslenco Apr 20, 2021
22a5571
Update Blender version information to 2.93 LTS
MoritzBrueckner Apr 30, 2021
0490960
Merge pull request #2176 from MoritzBrueckner/2.9-version-info
luboslenco May 1, 2021
2c761b2
Slightly improve debug console panel UI
MoritzBrueckner May 6, 2021
57093c3
Merge pull request #2184 from MoritzBrueckner/debug-console-panel
luboslenco May 7, 2021
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
163 changes: 163 additions & 0 deletions Shaders/std/sky.glsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
/* Various sky functions
* =====================
*
* Nishita model is based on https://github.com/wwwtyro/glsl-atmosphere (Unlicense License)
*
* Changes to the original implementation:
* - r and pSun parameters of nishita_atmosphere() are already normalized
* - Some original parameters of nishita_atmosphere() are replaced with pre-defined values
* - Implemented air, dust and ozone density node parameters (see Blender source)
* - Replaced the inner integral calculation with a LUT lookup
*
* Reference for the sun's limb darkening and ozone calculations:
* [Hill] Sebastien Hillaire. Physically Based Sky, Atmosphere and Cloud Rendering in Frostbite
* (https://media.contentapi.ea.com/content/dam/eacom/frostbite/files/s2016-pbs-frostbite-sky-clouds-new.pdf)
*
* Cycles code used for reference: blender/intern/sky/source/sky_nishita.cpp
* (https://github.com/blender/blender/blob/4429b4b77ef6754739a3c2b4fabd0537999e9bdc/intern/sky/source/sky_nishita.cpp)
*/

#ifndef _SKY_GLSL_
#define _SKY_GLSL_

uniform sampler2D nishitaLUT;
uniform vec2 nishitaDensity;

#ifndef PI
#define PI 3.141592
#endif
#ifndef HALF_PI
#define HALF_PI 1.570796
#endif

#define nishita_iSteps 16

// These values are taken from Cycles code if they
// exist there, otherwise they are taken from the example
// in the glsl-atmosphere repo
#define nishita_sun_intensity 22.0
#define nishita_atmo_radius 6420e3
#define nishita_rayleigh_scale 8e3
#define nishita_rayleigh_coeff vec3(5.5e-6, 13.0e-6, 22.4e-6)
#define nishita_mie_scale 1.2e3
#define nishita_mie_coeff 2e-5
#define nishita_mie_dir 0.76 // Aerosols anisotropy ("direction")
#define nishita_mie_dir_sq 0.5776 // Squared aerosols anisotropy

// The ozone absorption coefficients are taken from Cycles code.
// Because Cycles calculates 21 wavelengths, we use the coefficients
// which are closest to the RGB wavelengths (645nm, 510nm, 440nm).
// Precalculating values by simulating Blender's spec_to_xyz() function
// to include all 21 wavelengths gave unrealistic results
#define nishita_ozone_coeff vec3(1.59051840791988e-6, 0.00000096707041180970, 0.00000007309568762914)

// Values from [Hill: 60]
#define sun_limb_darkening_col vec3(0.397, 0.503, 0.652)

float random(vec2 coords) {
return fract(sin(dot(coords.xy, vec2(12.9898,78.233))) * 43758.5453);
}

vec3 nishita_lookupLUT(const float height, const float sunTheta) {
vec2 coords = vec2(
sqrt(height * (1 / nishita_atmo_radius)),
0.5 + 0.5 * sign(sunTheta - HALF_PI) * sqrt(abs(sunTheta * (1 / HALF_PI) - 1))
);
return textureLod(nishitaLUT, coords, 0.0).rgb;
}

/* See raySphereIntersection() in armory/Sources/renderpath/Nishita.hx */
vec2 nishita_rsi(const vec3 r0, const vec3 rd, const float sr) {
float a = dot(rd, rd);
float b = 2.0 * dot(rd, r0);
float c = dot(r0, r0) - (sr * sr);
float d = (b*b) - 4.0*a*c;

// If d < 0.0 the ray does not intersect the sphere
return (d < 0.0) ? vec2(1e5,-1e5) : vec2((-b - sqrt(d))/(2.0*a), (-b + sqrt(d))/(2.0*a));
}

/*
* r: normalized ray direction
* r0: ray origin
* pSun: normalized sun direction
* rPlanet: planet radius
*/
vec3 nishita_atmosphere(const vec3 r, const vec3 r0, const vec3 pSun, const float rPlanet) {
// Calculate the step size of the primary ray
vec2 p = nishita_rsi(r0, r, nishita_atmo_radius);
if (p.x > p.y) return vec3(0.0);
p.y = min(p.y, nishita_rsi(r0, r, rPlanet).x);
float iStepSize = (p.y - p.x) / float(nishita_iSteps);

// Primary ray time
float iTime = 0.0;

// Accumulators for Rayleigh and Mie scattering.
vec3 totalRlh = vec3(0,0,0);
vec3 totalMie = vec3(0,0,0);

// Optical depth accumulators for the primary ray
float iOdRlh = 0.0;
float iOdMie = 0.0;

// Calculate the Rayleigh and Mie phases
float mu = dot(r, pSun);
float mumu = mu * mu;
float pRlh = 3.0 / (16.0 * PI) * (1.0 + mumu);
float pMie = 3.0 / (8.0 * PI) * ((1.0 - nishita_mie_dir_sq) * (mumu + 1.0)) / (pow(1.0 + nishita_mie_dir_sq - 2.0 * mu * nishita_mie_dir, 1.5) * (2.0 + nishita_mie_dir_sq));

// Sample the primary ray
for (int i = 0; i < nishita_iSteps; i++) {

// Calculate the primary ray sample position and height
vec3 iPos = r0 + r * (iTime + iStepSize * 0.5);
float iHeight = length(iPos) - rPlanet;

// Calculate the optical depth of the Rayleigh and Mie scattering for this step
float odStepRlh = exp(-iHeight / nishita_rayleigh_scale) * nishitaDensity.x * iStepSize;
float odStepMie = exp(-iHeight / nishita_mie_scale) * nishitaDensity.y * iStepSize;

// Accumulate optical depth
iOdRlh += odStepRlh;
iOdMie += odStepMie;

// Idea behind this: "Rotate" everything by iPos (-> iPos is the new zenith) and then all calculations for the
// inner integral only depend on the sample height (iHeight) and sunTheta (angle between sun and new zenith).
float sunTheta = acos(dot(normalize(iPos), normalize(pSun)));
vec3 jODepth = nishita_lookupLUT(iHeight, sunTheta);// * vec3(14000000 / 255, 14000000 / 255, 2000000 / 255);

// Apply dithering to reduce visible banding
jODepth += mix(-1000, 1000, random(r.xy));

// Calculate attenuation
vec3 attn = exp(-(
nishita_mie_coeff * (iOdMie + jODepth.y)
+ (nishita_rayleigh_coeff) * (iOdRlh + jODepth.x)
+ nishita_ozone_coeff * jODepth.z
));

// Accumulate scattering
totalRlh += odStepRlh * attn;
totalMie += odStepMie * attn;

iTime += iStepSize;
}

return nishita_sun_intensity * (pRlh * nishita_rayleigh_coeff * totalRlh + pMie * nishita_mie_coeff * totalMie);
}

vec3 sun_disk(const vec3 n, const vec3 light_dir, const float disk_size, const float intensity) {
// Normalized SDF
float dist = distance(n, light_dir) / disk_size;

// Darken the edges of the sun
// [Hill: 28, 60] (according to [Nec96])
float invDist = 1.0 - dist;
float mu = sqrt(invDist * invDist);
vec3 limb_darkening = 1.0 - (1.0 - pow(vec3(mu), sun_limb_darkening_col));

return 1 + (1.0 - step(1.0, dist)) * nishita_sun_intensity * intensity * limb_darkening;
}

#endif
9 changes: 9 additions & 0 deletions Sources/armory/math/Helper.hx
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,13 @@ class Helper {
if (value <= leftMin) return rightMin;
return map(value, leftMin, leftMax, rightMin, rightMax);
}

/**
Return the sign of the given value represented as `1.0` (positive value)
or `-1.0` (negative value). The sign of `0` is `0`.
**/
public static inline function sign(value: Float): Float {
if (value == 0) return 0;
return (value < 0) ? -1.0 : 1.0;
}
}
Loading