Rename Lamp to Light to keep in sync with Blender2.8
This commit is contained in:
parent
a83502c0f8
commit
d2a96abcde
|
@ -34,7 +34,7 @@
|
|||
},
|
||||
{
|
||||
"name": "light",
|
||||
"link": "_lampPosition",
|
||||
"link": "_lightPosition",
|
||||
"ifdef": ["_CGlare"]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "compiled.glsl"
|
||||
#include "std/brdf.glsl"
|
||||
#include "std/math.glsl"
|
||||
#ifdef _LampIES
|
||||
#ifdef _LightIES
|
||||
#include "std/ies.glsl"
|
||||
#endif
|
||||
#ifdef _VoxelGIDirect
|
||||
|
@ -52,7 +52,7 @@ uniform sampler2D gbuffer2;
|
|||
#ifdef _DFRS
|
||||
//!uniform sampler3D sdftex;
|
||||
#endif
|
||||
#ifdef _LampIES
|
||||
#ifdef _LightIES
|
||||
//!uniform sampler2D texIES;
|
||||
#endif
|
||||
|
||||
|
@ -71,10 +71,10 @@ uniform int lightShadow;
|
|||
uniform float shadowsBias;
|
||||
uniform vec2 spotlightData;
|
||||
#ifdef _LTC
|
||||
uniform vec3 lampArea0;
|
||||
uniform vec3 lampArea1;
|
||||
uniform vec3 lampArea2;
|
||||
uniform vec3 lampArea3;
|
||||
uniform vec3 lightArea0;
|
||||
uniform vec3 lightArea1;
|
||||
uniform vec3 lightArea2;
|
||||
uniform vec3 lightArea3;
|
||||
uniform sampler2D sltcMat;
|
||||
uniform sampler2D sltcMag;
|
||||
#endif
|
||||
|
@ -83,8 +83,8 @@ uniform vec3 eye;
|
|||
//!uniform mat4 VP;
|
||||
#endif
|
||||
|
||||
#ifdef _LampColTex
|
||||
uniform sampler2D texlampcolor;
|
||||
#ifdef _LightColTex
|
||||
uniform sampler2D texlightcolor;
|
||||
#endif
|
||||
|
||||
in vec4 wvpposition;
|
||||
|
@ -168,7 +168,7 @@ void main() {
|
|||
|
||||
visibility *= attenuate(distance(p, lightPos));
|
||||
|
||||
#ifdef _LampIES
|
||||
#ifdef _LightIES
|
||||
visibility *= iesAttenuation(-l);
|
||||
#endif
|
||||
if (lightType == 2) { // Spot
|
||||
|
@ -190,9 +190,9 @@ void main() {
|
|||
vec3(0.0, t.z, 0.0),
|
||||
vec3(t.w, 0.0, t.x));
|
||||
|
||||
float ltcspec = ltcEvaluate(n, v, dotNV, p, invM, lampArea0, lampArea1, lampArea2, lampArea3);
|
||||
float ltcspec = ltcEvaluate(n, v, dotNV, p, invM, lightArea0, lightArea1, lightArea2, lightArea3);
|
||||
ltcspec *= texture(sltcMag, tuv).a;
|
||||
float ltcdiff = ltcEvaluate(n, v, dotNV, p, mat3(1.0), lampArea0, lampArea1, lampArea2, lampArea3);
|
||||
float ltcdiff = ltcEvaluate(n, v, dotNV, p, mat3(1.0), lightArea0, lightArea1, lightArea2, lightArea3);
|
||||
fragColor.rgb = albedo * ltcdiff + ltcspec * spec;
|
||||
}
|
||||
else {
|
||||
|
@ -225,9 +225,9 @@ void main() {
|
|||
|
||||
fragColor.rgb *= lightColor;
|
||||
|
||||
#ifdef _LampColTex
|
||||
// fragColor.rgb *= texture(texlampcolor, envMapEquirect(l)).rgb;
|
||||
fragColor.rgb *= pow(texture(texlampcolor, l.xy).rgb, vec3(2.2));
|
||||
#ifdef _LightColTex
|
||||
// fragColor.rgb *= texture(texlightcolor, envMapEquirect(l)).rgb;
|
||||
fragColor.rgb *= pow(texture(texlightcolor, l.xy).rgb, vec3(2.2));
|
||||
#endif
|
||||
|
||||
#ifdef _SSS
|
||||
|
|
|
@ -15,73 +15,73 @@
|
|||
"links": [
|
||||
{
|
||||
"name": "LVWVP",
|
||||
"link": "_lampVolumeWorldViewProjectionMatrix"
|
||||
"link": "_lightVolumeWorldViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "lightPos",
|
||||
"link": "_lampPosition"
|
||||
"link": "_lightPosition"
|
||||
},
|
||||
{
|
||||
"name": "lightProj",
|
||||
"link": "_lampPlaneProj"
|
||||
"link": "_lightPlaneProj"
|
||||
},
|
||||
{
|
||||
"name": "lightDir",
|
||||
"link": "_lampDirection"
|
||||
"link": "_lightDirection"
|
||||
},
|
||||
{
|
||||
"name": "lightType",
|
||||
"link": "_lampType"
|
||||
"link": "_lightType"
|
||||
},
|
||||
{
|
||||
"name": "lightColor",
|
||||
"link": "_lampColor"
|
||||
"link": "_lightColor"
|
||||
},
|
||||
{
|
||||
"name": "lightShadow",
|
||||
"link": "_lampCastShadow"
|
||||
"link": "_lightCastShadow"
|
||||
},
|
||||
{
|
||||
"name": "texlampcolor",
|
||||
"link": "_lampColorTexture",
|
||||
"ifdef": ["_LampColTex"]
|
||||
"name": "texlightcolor",
|
||||
"link": "_lightColorTexture",
|
||||
"ifdef": ["_LightColTex"]
|
||||
},
|
||||
{
|
||||
"name": "texIES",
|
||||
"link": "_iesTexture",
|
||||
"ifdef": ["_LampIES"]
|
||||
"ifdef": ["_LightIES"]
|
||||
},
|
||||
{
|
||||
"name": "lightPlane",
|
||||
"link": "_lampPlane",
|
||||
"link": "_lightPlane",
|
||||
"ifdef": ["_SSS"]
|
||||
},
|
||||
{
|
||||
"name": "shadowsBias",
|
||||
"link": "_lampShadowsBias"
|
||||
"link": "_lightShadowsBias"
|
||||
},
|
||||
{
|
||||
"name": "spotlightData",
|
||||
"link": "_spotlampData"
|
||||
"link": "_spotlightData"
|
||||
},
|
||||
{
|
||||
"name": "lampArea0",
|
||||
"link": "_lampArea0",
|
||||
"name": "lightArea0",
|
||||
"link": "_lightArea0",
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
"name": "lampArea1",
|
||||
"link": "_lampArea1",
|
||||
"name": "lightArea1",
|
||||
"link": "_lightArea1",
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
"name": "lampArea2",
|
||||
"link": "_lampArea2",
|
||||
"name": "lightArea2",
|
||||
"link": "_lightArea2",
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
"name": "lampArea3",
|
||||
"link": "_lampArea3",
|
||||
"name": "lightArea3",
|
||||
"link": "_lightArea3",
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
|
@ -104,7 +104,7 @@
|
|||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix"
|
||||
"link": "_biasLightWorldViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "VP",
|
||||
|
@ -117,7 +117,7 @@
|
|||
"ifdef": ["_DFRS"]
|
||||
}
|
||||
],
|
||||
"vertex_shader": "../include/pass_lamp_volume.vert.glsl",
|
||||
"vertex_shader": "../include/pass_light_volume.vert.glsl",
|
||||
"fragment_shader": "deferred_light.frag.glsl"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -47,7 +47,7 @@ vec2 lightPlane;
|
|||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _LampClouds
|
||||
#ifdef _LightClouds
|
||||
uniform sampler2D texClouds;
|
||||
uniform float time;
|
||||
#endif
|
||||
|
@ -64,8 +64,8 @@ uniform vec2 cameraProj;
|
|||
uniform mat4 invVP;
|
||||
#endif
|
||||
|
||||
#ifdef _LampColTex
|
||||
uniform sampler2D texlampcolor;
|
||||
#ifdef _LightColTex
|
||||
uniform sampler2D texlightcolor;
|
||||
#endif
|
||||
|
||||
in vec2 texCoord;
|
||||
|
@ -150,9 +150,9 @@ void main() {
|
|||
|
||||
fragColor.rgb *= lightColor;
|
||||
|
||||
#ifdef _LampColTex
|
||||
// fragColor.rgb *= texture(texlampcolor, envMapEquirect(l)).rgb;
|
||||
fragColor.rgb *= pow(texture(texlampcolor, l.xy).rgb, vec3(2.2));
|
||||
#ifdef _LightColTex
|
||||
// fragColor.rgb *= texture(texlightcolor, envMapEquirect(l)).rgb;
|
||||
fragColor.rgb *= pow(texture(texlightcolor, l.xy).rgb, vec3(2.2));
|
||||
#endif
|
||||
|
||||
#ifdef _SSS
|
||||
|
@ -174,7 +174,7 @@ void main() {
|
|||
visibility *= tvis;
|
||||
#endif
|
||||
|
||||
#ifdef _LampClouds
|
||||
#ifdef _LightClouds
|
||||
visibility *= texture(texClouds, vec2(p.xy / 100.0 + time / 80.0)).r * dot(n, vec3(0,0,1));
|
||||
#endif
|
||||
|
||||
|
|
|
@ -19,34 +19,34 @@
|
|||
},
|
||||
{
|
||||
"name": "l",
|
||||
"link": "_lampDirection"
|
||||
"link": "_lightDirection"
|
||||
},
|
||||
{
|
||||
"name": "lightColor",
|
||||
"link": "_lampColor"
|
||||
"link": "_lightColor"
|
||||
},
|
||||
{
|
||||
"name": "lightShadow",
|
||||
"link": "_lampCastShadow"
|
||||
"link": "_lightCastShadow"
|
||||
},
|
||||
{
|
||||
"name": "texlampcolor",
|
||||
"link": "_lampColorTexture",
|
||||
"ifdef": ["_LampColTex"]
|
||||
"name": "texlightcolor",
|
||||
"link": "_lightColorTexture",
|
||||
"ifdef": ["_LightColTex"]
|
||||
},
|
||||
{
|
||||
"name": "texClouds",
|
||||
"link": "_cloudsTexture",
|
||||
"ifdef": ["_LampClouds"]
|
||||
"ifdef": ["_LightClouds"]
|
||||
},
|
||||
{
|
||||
"name": "time",
|
||||
"link": "_time",
|
||||
"ifdef": ["_LampClouds"]
|
||||
"ifdef": ["_LightClouds"]
|
||||
},
|
||||
{
|
||||
"name": "shadowsBias",
|
||||
"link": "_lampShadowsBias"
|
||||
"link": "_lightShadowsBias"
|
||||
},
|
||||
{
|
||||
"name": "eye",
|
||||
|
@ -63,12 +63,12 @@
|
|||
},
|
||||
{
|
||||
"name": "lightPlane",
|
||||
"link": "_lampPlane",
|
||||
"link": "_lightPlane",
|
||||
"ifdef": ["_SSS"]
|
||||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix",
|
||||
"link": "_biasLightWorldViewProjectionMatrix",
|
||||
"ifndef": ["_CSM"]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"links": [
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix"
|
||||
"link": "_biasLightWorldViewProjectionMatrix"
|
||||
}
|
||||
],
|
||||
"texture_params": [],
|
||||
|
|
|
@ -158,7 +158,7 @@ float ltcEvaluate(vec3 N, vec3 V, float dotNV, vec3 P, mat3 Minv, vec3 points0,
|
|||
if (n >= 4) sum += integrateEdge(L3, L4);
|
||||
if (n == 5) sum += integrateEdge(L4, L0);
|
||||
|
||||
#ifdef _TwoSidedAreaLamp
|
||||
#ifdef _TwoSidedAreaLight
|
||||
return abs(sum);
|
||||
#else
|
||||
return max(0.0, -sum);
|
||||
|
|
|
@ -34,8 +34,8 @@ void main() {
|
|||
// #endif
|
||||
vec3 p = getPos(eye, eyeLook, viewRay, depth, cameraProj);
|
||||
|
||||
vec4 lampPos = LWVP * vec4(p, 1.0);
|
||||
vec3 lPos = lampPos.xyz / lampPos.w;
|
||||
vec4 lightPosition = LWVP * vec4(p, 1.0);
|
||||
vec3 lPos = lightPosition.xyz / lightPosition.w;
|
||||
|
||||
// Visibility
|
||||
if (lightShadow == 1) {
|
||||
|
|
|
@ -24,28 +24,28 @@
|
|||
},
|
||||
{
|
||||
"name": "shadowsBias",
|
||||
"link": "_lampShadowsBias"
|
||||
"link": "_lightShadowsBias"
|
||||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix"
|
||||
"link": "_biasLightWorldViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "lightType",
|
||||
"link": "_lampType",
|
||||
"link": "_lightType",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightShadow",
|
||||
"link": "_lampCastShadow"
|
||||
"link": "_lightCastShadow"
|
||||
},
|
||||
{
|
||||
"name": "lightProj",
|
||||
"link": "_lampPlaneProj"
|
||||
"link": "_lightPlaneProj"
|
||||
},
|
||||
{
|
||||
"name": "lightPos",
|
||||
"link": "_lampPosition"
|
||||
"link": "_lightPosition"
|
||||
}
|
||||
],
|
||||
"vertex_shader": "visibility_pass.vert.glsl",
|
||||
|
|
|
@ -50,10 +50,10 @@ void rayStep(inout vec3 curPos, inout float curOpticalDepth, inout float scatter
|
|||
float visibility = 1.0;
|
||||
|
||||
if (lightShadow == 1) {
|
||||
vec4 lampPos = LWVP * vec4(curPos, 1.0);
|
||||
if (lampPos.w > 0.0) {
|
||||
lampPos.xyz /= lampPos.w;
|
||||
visibility = float(texture(shadowMap, lampPos.xy).r > lampPos.z - shadowsBias);
|
||||
vec4 lightPosition = LWVP * vec4(curPos, 1.0);
|
||||
if (lightPosition.w > 0.0) {
|
||||
lightPosition.xyz /= lightPosition.w;
|
||||
visibility = float(texture(shadowMap, lightPosition.xy).r > lightPosition.z - shadowsBias);
|
||||
}
|
||||
}
|
||||
else { // Cubemap
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
"links": [
|
||||
{
|
||||
"name": "LVWVP",
|
||||
"link": "_lampVolumeWorldViewProjectionMatrix"
|
||||
"link": "_lightVolumeWorldViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "invVP",
|
||||
|
@ -16,11 +16,11 @@
|
|||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix"
|
||||
"link": "_biasLightWorldViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "shadowsBias",
|
||||
"link": "_lampShadowsBias"
|
||||
"link": "_lightShadowsBias"
|
||||
},
|
||||
{
|
||||
"name": "screenSize",
|
||||
|
@ -32,11 +32,11 @@
|
|||
},
|
||||
{
|
||||
"name": "lightPos",
|
||||
"link": "_lampPosition"
|
||||
"link": "_lightPosition"
|
||||
},
|
||||
{
|
||||
"name": "lightRadius",
|
||||
"link": "_lampRadius"
|
||||
"link": "_lightRadius"
|
||||
},
|
||||
{
|
||||
"name": "snoise",
|
||||
|
@ -44,15 +44,15 @@
|
|||
},
|
||||
{
|
||||
"name": "lightProj",
|
||||
"link": "_lampPlaneProj"
|
||||
"link": "_lightPlaneProj"
|
||||
},
|
||||
{
|
||||
"name": "lightShadow",
|
||||
"link": "_lampCastShadow"
|
||||
"link": "_lightCastShadow"
|
||||
}
|
||||
],
|
||||
"texture_params": [],
|
||||
"vertex_shader": "../include/pass_lamp_volume.vert.glsl",
|
||||
"vertex_shader": "../include/pass_light_volume.vert.glsl",
|
||||
"fragment_shader": "volumetric_light.frag.glsl"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -56,10 +56,10 @@ void rayStep(inout vec3 curPos, inout float curOpticalDepth, inout float scatter
|
|||
#ifdef _CSM
|
||||
mat4 LWVP = mat4(casData[4 + 0], casData[4 + 1], casData[4 + 2], casData[4 + 3]);
|
||||
#endif
|
||||
vec4 lampPos = LWVP * vec4(curPos, 1.0);
|
||||
if (lampPos.w > 0.0) {
|
||||
lampPos.xyz /= lampPos.w;
|
||||
visibility = float(texture(shadowMap, lampPos.xy).r > lampPos.z - shadowsBias);
|
||||
vec4 lightPosition = LWVP * vec4(curPos, 1.0);
|
||||
if (lightPosition.w > 0.0) {
|
||||
lightPosition.xyz /= lightPosition.w;
|
||||
visibility = float(texture(shadowMap, lightPosition.xy).r > lightPosition.z - shadowsBias);
|
||||
}
|
||||
|
||||
scatteredLightAmount += curOpticalDepth * l1 * visibility;
|
||||
|
|
|
@ -12,21 +12,21 @@
|
|||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix",
|
||||
"link": "_biasLightWorldViewProjectionMatrix",
|
||||
"ifndef": ["_CSM"]
|
||||
},
|
||||
{
|
||||
"name": "shadowsBias",
|
||||
"link": "_lampShadowsBias"
|
||||
"link": "_lightShadowsBias"
|
||||
},
|
||||
{
|
||||
"name": "lightPos",
|
||||
"link": "_lampPosition",
|
||||
"link": "_lightPosition",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightRadius",
|
||||
"link": "_lampRadius",
|
||||
"link": "_lightRadius",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
|
@ -35,12 +35,12 @@
|
|||
},
|
||||
{
|
||||
"name": "lightPlane",
|
||||
"link": "_lampPlane",
|
||||
"link": "_lightPlane",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightShadow",
|
||||
"link": "_lampCastShadow",
|
||||
"link": "_lightCastShadow",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
|
@ -83,25 +83,25 @@
|
|||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix"
|
||||
"link": "_biasLightWorldViewProjectionMatrix"
|
||||
},
|
||||
{
|
||||
"name": "shadowsBias",
|
||||
"link": "_lampShadowsBias"
|
||||
"link": "_lightShadowsBias"
|
||||
},
|
||||
{
|
||||
"name": "lightPos",
|
||||
"link": "_lampPosition",
|
||||
"link": "_lightPosition",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightRadius",
|
||||
"link": "_lampRadius",
|
||||
"link": "_lightRadius",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightColor",
|
||||
"link": "_lampColor"
|
||||
"link": "_lightColor"
|
||||
},
|
||||
{
|
||||
"name": "snoise",
|
||||
|
@ -110,12 +110,12 @@
|
|||
},
|
||||
{
|
||||
"name": "lightPlane",
|
||||
"link": "_lampPlane",
|
||||
"link": "_lightPlane",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightShadow",
|
||||
"link": "_lampCastShadow",
|
||||
"link": "_lightCastShadow",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -54,9 +54,9 @@ void main() {
|
|||
|
||||
#ifndef _NoShadows
|
||||
if (lightShadow == 1) {
|
||||
vec4 lampPos = LVP * vec4(wposition, 1.0);
|
||||
vec3 lPos = lampPos.xyz / lampPos.w;
|
||||
// if (lampPos.w > 0.0)
|
||||
vec4 lightPosition = LVP * vec4(wposition, 1.0);
|
||||
vec3 lPos = lightPosition.xyz / lightPosition.w;
|
||||
// if (lightPosition.w > 0.0)
|
||||
if (texture(shadowMap, lPos.xy).r < lPos.z - shadowsBias) visibility = 0.0;
|
||||
// visibility = shadowTest(shadowMap, lPos, shadowsBias, shadowmapSize);
|
||||
}
|
||||
|
|
|
@ -329,8 +329,8 @@ void main() {
|
|||
|
||||
// #ifndef _NoShadows
|
||||
// if (lightShadow == 1) {
|
||||
// vec4 lampPos = LWVP * vec4(surfacePoint.xyz, 1.0);
|
||||
// if (lampPos.w > 0.0) fragColor.rgb *= shadowTest(lampPos.xyz / lampPos.w);
|
||||
// vec4 lightPosition = LWVP * vec4(surfacePoint.xyz, 1.0);
|
||||
// if (lightPosition.w > 0.0) fragColor.rgb *= shadowTest(lightPosition.xyz / lightPosition.w);
|
||||
// }
|
||||
// else if (lightShadow == 2) { // Cube
|
||||
// vec3 lp = lightPos - surfacePoint.xyz;
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
},
|
||||
{
|
||||
"name": "ld",
|
||||
"link": "_lampDirection"
|
||||
"link": "_lightDirection"
|
||||
},
|
||||
{
|
||||
"name": "invVP",
|
||||
|
@ -46,27 +46,27 @@
|
|||
},
|
||||
{
|
||||
"name": "LWVP",
|
||||
"link": "_biasLampWorldViewProjectionMatrix",
|
||||
"link": "_biasLightWorldViewProjectionMatrix",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "shadowsBias",
|
||||
"link": "_lampShadowsBias",
|
||||
"link": "_lightShadowsBias",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightPlane",
|
||||
"link": "_lampPlane",
|
||||
"link": "_lightPlane",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightShadow",
|
||||
"link": "_lampCastShadow",
|
||||
"link": "_lightCastShadow",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
"name": "lightPos",
|
||||
"link": "_lampPosition",
|
||||
"link": "_lightPosition",
|
||||
"ifdef": ["_Disabled"]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package armory.logicnode;
|
||||
|
||||
import iron.object.LampObject;
|
||||
import iron.object.LightObject;
|
||||
|
||||
class SetLightColorNode extends LogicNode {
|
||||
|
||||
|
@ -9,7 +9,7 @@ class SetLightColorNode extends LogicNode {
|
|||
}
|
||||
|
||||
override function run() {
|
||||
var light:LampObject = inputs[1].get();
|
||||
var light:LightObject = inputs[1].get();
|
||||
var color:iron.math.Vec4 = inputs[2].get();
|
||||
|
||||
if (light == null) return;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package armory.logicnode;
|
||||
|
||||
import iron.object.LampObject;
|
||||
import iron.object.LightObject;
|
||||
|
||||
class SetLightStrengthNode extends LogicNode {
|
||||
|
||||
|
@ -9,7 +9,7 @@ class SetLightStrengthNode extends LogicNode {
|
|||
}
|
||||
|
||||
override function run() {
|
||||
var light:LampObject = inputs[1].get();
|
||||
var light:LightObject = inputs[1].get();
|
||||
var strength:Float = inputs[2].get();
|
||||
|
||||
if (light == null) return;
|
||||
|
|
|
@ -120,12 +120,12 @@ class HosekWilkie {
|
|||
var dir = world.raw.sun_direction;
|
||||
sunDirection = new FastVector3(dir[0], -dir[1], dir[2]);
|
||||
|
||||
// Extract direction from lamp
|
||||
// Extract direction from light
|
||||
// var mat = iron.data.Data.getMaterial("World_material", "World_material").data;
|
||||
// var lamp = iron.Scene.active.lamps[0];
|
||||
// var ltr = lamp.transform;
|
||||
// var light = iron.Scene.active.lights[0];
|
||||
// var ltr = light.transform;
|
||||
// var lf = ltr.world.look2();
|
||||
// lamp.data.data.strength = 3.3 - Math.abs(ltr.worldy()) / 45;
|
||||
// light.data.data.strength = 3.3 - Math.abs(ltr.worldy()) / 45;
|
||||
// probe.strength = 1.2 - Math.abs(ltr.worldy()) / 45;
|
||||
// mat.contexts[0].bind_constants[0].float = probe.strength + 0.5;
|
||||
// mat.contexts[0].bind_constants[1].vec3[0] = lf.x;
|
||||
|
|
|
@ -54,7 +54,7 @@ class Inc {
|
|||
}
|
||||
|
||||
public static function shadowMapName():String {
|
||||
return path.getLamp(path.currentLampIndex).data.raw.shadowmap_cube ? "shadowMapCube" : "shadowMap";
|
||||
return path.getLight(path.currentLightIndex).data.raw.shadowmap_cube ? "shadowMapCube" : "shadowMap";
|
||||
}
|
||||
|
||||
public static function getShadowMap():String {
|
||||
|
@ -62,9 +62,9 @@ class Inc {
|
|||
var rt = path.renderTargets.get(target);
|
||||
// Create shadowmap on the fly
|
||||
if (rt == null) {
|
||||
if (path.getLamp(path.currentLampIndex).data.raw.shadowmap_cube) {
|
||||
if (path.getLight(path.currentLightIndex).data.raw.shadowmap_cube) {
|
||||
// Cubemap size
|
||||
var size = Std.int(path.getLamp(path.currentLampIndex).data.raw.shadowmap_size);
|
||||
var size = Std.int(path.getLight(path.currentLightIndex).data.raw.shadowmap_size);
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = target;
|
||||
t.width = size;
|
||||
|
@ -74,10 +74,10 @@ class Inc {
|
|||
rt = path.createRenderTarget(t);
|
||||
}
|
||||
else { // Non-cube sm
|
||||
var sizew = path.getLamp(path.currentLampIndex).data.raw.shadowmap_size;
|
||||
var sizew = path.getLight(path.currentLightIndex).data.raw.shadowmap_size;
|
||||
var sizeh = sizew;
|
||||
#if arm_csm // Cascades - atlas on x axis
|
||||
sizew = sizeh * iron.object.LampObject.cascadeCount;
|
||||
sizew = sizeh * iron.object.LightObject.cascadeCount;
|
||||
#end
|
||||
var t = new RenderTargetRaw();
|
||||
t.name = target;
|
||||
|
@ -302,16 +302,16 @@ class Inc {
|
|||
public static function computeVoxels(i:Int) {
|
||||
var rts = path.renderTargets;
|
||||
var res = Inc.getVoxelRes();
|
||||
var lamps = iron.Scene.active.lamps;
|
||||
// for (i in 0...lamps.length) {
|
||||
var l = lamps[i];
|
||||
var lights = iron.Scene.active.lights;
|
||||
// for (i in 0...lights.length) {
|
||||
var l = lights[i];
|
||||
// if (!l.visible) continue;
|
||||
// path.currentLampIndex = i;
|
||||
// path.currentLightIndex = i;
|
||||
|
||||
// #if (rp_shadowmap)
|
||||
// {
|
||||
// TODO: merge with direct, drawing shadowmaps twice!
|
||||
// if (path.lampCastShadow()) {
|
||||
// if (path.lightCastShadow()) {
|
||||
// drawShadowMap(l);
|
||||
// }
|
||||
// }
|
||||
|
@ -358,7 +358,7 @@ class Inc {
|
|||
var f = l.data.raw.strength;
|
||||
kha.compute.Compute.setFloat3(voxel_cb, l.data.raw.color[0] * f, l.data.raw.color[1] * f, l.data.raw.color[2] * f);
|
||||
// lightType
|
||||
kha.compute.Compute.setInt(voxel_cc, iron.data.LampData.typeToInt(l.data.raw.type));
|
||||
kha.compute.Compute.setInt(voxel_cc, iron.data.LightData.typeToInt(l.data.raw.type));
|
||||
// lightDir
|
||||
var v = l.look();
|
||||
kha.compute.Compute.setFloat3(voxel_cd, v.x, v.y, v.z);
|
||||
|
@ -371,7 +371,7 @@ class Inc {
|
|||
|
||||
kha.compute.Compute.compute(res, res, res);
|
||||
// }
|
||||
// path.currentLampIndex = 0;
|
||||
// path.currentLightIndex = 0;
|
||||
}
|
||||
public static function computeVoxelsEnd() {
|
||||
var rts = path.renderTargets;
|
||||
|
@ -398,9 +398,9 @@ class Inc {
|
|||
#end
|
||||
|
||||
#if (rp_renderer == "Forward")
|
||||
public static function drawShadowMap(l:iron.object.LampObject) {
|
||||
public static function drawShadowMap(l:iron.object.LightObject) {
|
||||
#if (rp_shadowmap)
|
||||
var faces = path.getLamp(path.currentLampIndex).data.raw.shadowmap_cube ? 6 : 1;
|
||||
var faces = path.getLight(path.currentLightIndex).data.raw.shadowmap_cube ? 6 : 1;
|
||||
for (i in 0...faces) {
|
||||
if (faces > 1) path.currentFace = i;
|
||||
path.setTarget(Inc.getShadowMap());
|
||||
|
@ -411,7 +411,7 @@ class Inc {
|
|||
#end
|
||||
}
|
||||
#else
|
||||
public static function drawShadowMap(l:iron.object.LampObject) {
|
||||
public static function drawShadowMap(l:iron.object.LightObject) {
|
||||
#if (rp_shadowmap)
|
||||
var faces = l.data.raw.shadowmap_cube ? 6 : 1;
|
||||
for (j in 0...faces) {
|
||||
|
@ -422,7 +422,7 @@ class Inc {
|
|||
}
|
||||
path.currentFace = -1;
|
||||
|
||||
// One lamp at a time for now, precompute all lamps for tiled
|
||||
// One light at a time for now, precompute all lights for tiled
|
||||
#if rp_soft_shadows
|
||||
|
||||
if (l.raw.type != "point") {
|
||||
|
|
|
@ -505,16 +505,16 @@ class RenderPathDeferred {
|
|||
}
|
||||
|
||||
#if ((rp_gi == "Voxel GI") && (rp_voxelgi_relight))
|
||||
// Relight if lamp was moved
|
||||
for (lamp in iron.Scene.active.lamps) {
|
||||
if (lamp.transform.diff()) { relight = true; break; }
|
||||
// Relight if light was moved
|
||||
for (light in iron.Scene.active.lights) {
|
||||
if (light.transform.diff()) { relight = true; break; }
|
||||
}
|
||||
#end
|
||||
|
||||
if (relight) {
|
||||
#if (rp_gi == "Voxel GI")
|
||||
// Inc.computeVoxelsBegin();
|
||||
// for (i in 0...lamps.length) Inc.computeVoxels(i); // Redraws SM
|
||||
// for (i in 0...lights.length) Inc.computeVoxels(i); // Redraws SM
|
||||
// Inc.computeVoxelsEnd();
|
||||
#if (rp_gi_bounces)
|
||||
voxels = "voxelsBounce";
|
||||
|
@ -549,18 +549,18 @@ class RenderPathDeferred {
|
|||
path.drawShader("shader_datas/deferred_indirect/deferred_indirect");
|
||||
|
||||
// Direct
|
||||
var lamps = iron.Scene.active.lamps;
|
||||
var lights = iron.Scene.active.lights;
|
||||
#if (rp_gi == "Voxel GI")
|
||||
if (relight) Inc.computeVoxelsBegin();
|
||||
#end
|
||||
for (i in 0...lamps.length) {
|
||||
var l = lamps[i];
|
||||
for (i in 0...lights.length) {
|
||||
var l = lights[i];
|
||||
if (!l.visible) continue;
|
||||
path.currentLampIndex = i;
|
||||
path.currentLightIndex = i;
|
||||
|
||||
#if (rp_shadowmap)
|
||||
{
|
||||
if (path.lampCastShadow()) {
|
||||
if (path.lightCastShadow()) {
|
||||
Inc.drawShadowMap(l);
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ class RenderPathDeferred {
|
|||
|
||||
#if rp_shadowmap
|
||||
{
|
||||
if (path.lampCastShadow()) {
|
||||
if (path.lightCastShadow()) {
|
||||
#if rp_soft_shadows
|
||||
path.bindTarget("visa", "svisibility");
|
||||
#else
|
||||
|
@ -596,11 +596,11 @@ class RenderPathDeferred {
|
|||
}
|
||||
#end
|
||||
|
||||
if (path.lampIsSun()) {
|
||||
if (path.lightIsSun()) {
|
||||
path.drawShader("shader_datas/deferred_light_quad/deferred_light_quad");
|
||||
}
|
||||
else {
|
||||
path.drawLampVolume("shader_datas/deferred_light/deferred_light");
|
||||
path.drawLightVolume("shader_datas/deferred_light/deferred_light");
|
||||
}
|
||||
|
||||
#if rp_volumetriclight
|
||||
|
@ -608,11 +608,11 @@ class RenderPathDeferred {
|
|||
path.setTarget("bufvola");
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
Inc.bindShadowMap();
|
||||
if (path.lampIsSun()) {
|
||||
if (path.lightIsSun()) {
|
||||
path.drawShader("shader_datas/volumetric_light_quad/volumetric_light_quad");
|
||||
}
|
||||
else {
|
||||
path.drawLampVolume("shader_datas/volumetric_light/volumetric_light");
|
||||
path.drawLightVolume("shader_datas/volumetric_light/volumetric_light");
|
||||
}
|
||||
|
||||
path.setTarget("bufvolb");
|
||||
|
@ -625,7 +625,7 @@ class RenderPathDeferred {
|
|||
}
|
||||
#end
|
||||
}
|
||||
path.currentLampIndex = 0;
|
||||
path.currentLightIndex = 0;
|
||||
#if (rp_gi == "Voxel GI")
|
||||
if (relight) Inc.computeVoxelsEnd();
|
||||
#end
|
||||
|
@ -652,8 +652,8 @@ class RenderPathDeferred {
|
|||
|
||||
#if rp_translucency
|
||||
{
|
||||
var hasLamp = iron.Scene.active.lamps.length > 0;
|
||||
if (hasLamp) Inc.drawTranslucency("tex");
|
||||
var hasLight = iron.Scene.active.lights.length > 0;
|
||||
if (hasLight) Inc.drawTranslucency("tex");
|
||||
}
|
||||
#end
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@ class RenderPathForward {
|
|||
|
||||
#if rp_translucency
|
||||
{
|
||||
var hasLamp = iron.Scene.active.lamps.length > 0;
|
||||
if (hasLamp) Inc.drawTranslucency("lbuf");
|
||||
var hasLight = iron.Scene.active.lights.length > 0;
|
||||
if (hasLight) Inc.drawTranslucency("lbuf");
|
||||
}
|
||||
#end
|
||||
}
|
||||
|
@ -235,12 +235,12 @@ class RenderPathForward {
|
|||
|
||||
public static function commands() {
|
||||
|
||||
var hasLamp = iron.Scene.active.lamps.length > 0;
|
||||
var hasLight = iron.Scene.active.lights.length > 0;
|
||||
|
||||
#if rp_shadowmap
|
||||
{
|
||||
if (hasLamp) {
|
||||
Inc.drawShadowMap(iron.Scene.active.lamps[0]);
|
||||
if (hasLight) {
|
||||
Inc.drawShadowMap(iron.Scene.active.lights[0]);
|
||||
}
|
||||
}
|
||||
#end
|
||||
|
@ -278,9 +278,9 @@ class RenderPathForward {
|
|||
}
|
||||
|
||||
#if ((rp_gi == "Voxel GI") && (rp_voxelgi_relight))
|
||||
// Relight if lamp was moved
|
||||
for (lamp in iron.Scene.active.lamps) {
|
||||
if (lamp.transform.diff()) { relight = true; break; }
|
||||
// Relight if light was moved
|
||||
for (light in iron.Scene.active.lights) {
|
||||
if (light.transform.diff()) { relight = true; break; }
|
||||
}
|
||||
#end
|
||||
|
||||
|
@ -327,7 +327,7 @@ class RenderPathForward {
|
|||
|
||||
#if rp_shadowmap
|
||||
{
|
||||
if (hasLamp) Inc.bindShadowMap();
|
||||
if (hasLight) Inc.bindShadowMap();
|
||||
}
|
||||
#end
|
||||
|
||||
|
@ -359,11 +359,11 @@ class RenderPathForward {
|
|||
path.setTarget("bufvola");
|
||||
path.bindTarget("_main", "gbufferD");
|
||||
Inc.bindShadowMap();
|
||||
if (path.lampIsSun()) {
|
||||
if (path.lightIsSun()) {
|
||||
path.drawShader("shader_datas/volumetric_light_quad/volumetric_light_quad");
|
||||
}
|
||||
else {
|
||||
path.drawLampVolume("shader_datas/volumetric_light/volumetric_light");
|
||||
path.drawLightVolume("shader_datas/volumetric_light/volumetric_light");
|
||||
}
|
||||
|
||||
path.setTarget("bufvolb");
|
||||
|
|
|
@ -277,10 +277,10 @@ class DebugConsole extends Trait {
|
|||
var p = iron.Scene.active.world.getGlobalProbe();
|
||||
p.raw.strength = ui.slider(Id.handle({value: p.raw.strength}), "Env Strength", 0.0, 5.0, true);
|
||||
}
|
||||
else if (Std.is(selectedObject, iron.object.LampObject)) {
|
||||
selectedType = "(Lamp)";
|
||||
var lamp = cast(selectedObject, iron.object.LampObject);
|
||||
lamp.data.raw.strength = ui.slider(Id.handle({value: lamp.data.raw.strength / 10}), "Strength", 0.0, 5.0, true) * 10;
|
||||
else if (Std.is(selectedObject, iron.object.LightObject)) {
|
||||
selectedType = "(Light)";
|
||||
var light = cast(selectedObject, iron.object.LightObject);
|
||||
light.data.raw.strength = ui.slider(Id.handle({value: light.data.raw.strength / 10}), "Strength", 0.0, 5.0, true) * 10;
|
||||
}
|
||||
else if (Std.is(selectedObject, iron.object.CameraObject)) {
|
||||
selectedType = "(Camera)";
|
||||
|
|
|
@ -38,7 +38,7 @@ AnimationTypeLinear = 1
|
|||
AnimationTypeBezier = 2
|
||||
ExportEpsilon = 1.0e-6
|
||||
|
||||
structIdentifier = ["object", "bone_object", "mesh_object", "lamp_object", "camera_object", "speaker_object", "decal_object"]
|
||||
structIdentifier = ["object", "bone_object", "mesh_object", "light_object", "camera_object", "speaker_object", "decal_object"]
|
||||
|
||||
subtranslationName = ["xloc", "yloc", "zloc"]
|
||||
subrotationName = ["xrot", "yrot", "zrot"]
|
||||
|
@ -1734,7 +1734,7 @@ class ArmoryExporter:
|
|||
if o['shadowmap_size'] > 1024:
|
||||
o['shadows_bias'] *= 1 / (o['shadowmap_size'] / 1024) # Less bias for bigger maps
|
||||
if (objtype == 'POINT' or objtype == 'SPOT') and objref.shadow_soft_size > 0.1:
|
||||
o['lamp_size'] = objref.shadow_soft_size * 10 # Match to Cycles
|
||||
o['light_size'] = objref.shadow_soft_size * 10 # Match to Cycles
|
||||
gapi = arm.utils.get_gapi()
|
||||
mobile_mat = rpdat.arm_material_model == 'Mobile' or rpdat.arm_material_model == 'Solid'
|
||||
if objtype == 'POINT' and not mobile_mat:
|
||||
|
@ -1775,7 +1775,7 @@ class ArmoryExporter:
|
|||
o['strength'] = 1000.0 * 0.026
|
||||
o['type'] = 'point'
|
||||
|
||||
self.output['lamp_datas'].append(o)
|
||||
self.output['light_datas'].append(o)
|
||||
|
||||
def get_camera_clear_color(self):
|
||||
if self.scene.world == None:
|
||||
|
@ -2142,7 +2142,7 @@ class ArmoryExporter:
|
|||
|
||||
def export_objects(self, scene):
|
||||
if not ArmoryExporter.option_mesh_only:
|
||||
self.output['lamp_datas'] = []
|
||||
self.output['light_datas'] = []
|
||||
self.output['camera_datas'] = []
|
||||
self.output['speaker_datas'] = []
|
||||
for objectRef in self.lightArray.items():
|
||||
|
|
|
@ -15,8 +15,8 @@ def add_world_defs():
|
|||
if rpdat.arm_ssrs:
|
||||
wrd.world_defs += '_SSRS'
|
||||
|
||||
if rpdat.arm_two_sided_area_lamp:
|
||||
wrd.world_defs += '_TwoSidedAreaLamp'
|
||||
if rpdat.arm_two_sided_area_light:
|
||||
wrd.world_defs += '_TwoSidedAreaLight'
|
||||
|
||||
# Store contexts
|
||||
if rpdat.rp_hdr == False:
|
||||
|
@ -26,16 +26,16 @@ def add_world_defs():
|
|||
if rpdat.arm_diffuse_model == 'OrenNayar':
|
||||
wrd.world_defs += '_OrenNayar'
|
||||
|
||||
# TODO: Lamp texture test..
|
||||
if wrd.arm_lamp_texture != '':
|
||||
wrd.world_defs += '_LampColTex'
|
||||
# TODO: Light texture test..
|
||||
if wrd.arm_light_texture != '':
|
||||
wrd.world_defs += '_LightColTex'
|
||||
|
||||
if wrd.arm_lamp_ies_texture != '':
|
||||
wrd.world_defs += '_LampIES'
|
||||
if wrd.arm_light_ies_texture != '':
|
||||
wrd.world_defs += '_LightIES'
|
||||
assets.add_embedded_data('iestexture.png')
|
||||
|
||||
if wrd.arm_lamp_clouds_texture != '':
|
||||
wrd.world_defs += '_LampClouds'
|
||||
if wrd.arm_light_clouds_texture != '':
|
||||
wrd.world_defs += '_LightClouds'
|
||||
assets.add_embedded_data('cloudstexture.png')
|
||||
|
||||
if rpdat.rp_renderer == 'Deferred':
|
||||
|
@ -114,10 +114,10 @@ def add_world_defs():
|
|||
if arm.utils.get_legacy_shaders() and not state.is_viewport:
|
||||
wrd.world_defs += '_Legacy'
|
||||
|
||||
# Area lamps
|
||||
lamps = bpy.data.lights if bpy.app.version >= (2, 80, 1) else bpy.data.lamps
|
||||
for lamp in lamps:
|
||||
if lamp.type == 'AREA':
|
||||
# Area lights
|
||||
lights = bpy.data.lights if bpy.app.version >= (2, 80, 1) else bpy.data.lamps
|
||||
for light in lights:
|
||||
if light.type == 'AREA':
|
||||
wrd.world_defs += '_LTC'
|
||||
assets.add_khafile_def('arm_ltc')
|
||||
break
|
||||
|
|
|
@ -59,7 +59,7 @@ def make(context_id, rpasses, shadowmap=False):
|
|||
vert.write_attrib('vcolor = col;')
|
||||
vert.write('wposition += wnormal * disp * 0.1;')
|
||||
if shadowmap:
|
||||
vert.add_uniform('mat4 LVP', '_lampViewProjectionMatrix')
|
||||
vert.add_uniform('mat4 LVP', '_lightViewProjectionMatrix')
|
||||
vert.write('gl_Position = LVP * vec4(wposition, 1.0);')
|
||||
else:
|
||||
vert.add_uniform('mat4 VP', '_viewProjectionMatrix')
|
||||
|
@ -104,7 +104,7 @@ def make(context_id, rpasses, shadowmap=False):
|
|||
tese.write_pre = False
|
||||
|
||||
if shadowmap:
|
||||
tese.add_uniform('mat4 LVP', '_lampViewProjectionMatrix')
|
||||
tese.add_uniform('mat4 LVP', '_lightViewProjectionMatrix')
|
||||
tese.write('wposition += wnormal * disp * 0.1;')
|
||||
tese.write('gl_Position = LVP * vec4(wposition, 1.0);')
|
||||
else:
|
||||
|
@ -117,11 +117,11 @@ def make(context_id, rpasses, shadowmap=False):
|
|||
billboard = mat_state.material.arm_billboard
|
||||
if shadowmap:
|
||||
if billboard == 'spherical':
|
||||
vert.add_uniform('mat4 LWVP', '_lampWorldViewProjectionMatrixSphere')
|
||||
vert.add_uniform('mat4 LWVP', '_lightWorldViewProjectionMatrixSphere')
|
||||
elif billboard == 'cylindrical':
|
||||
vert.add_uniform('mat4 LWVP', '_lampWorldViewProjectionMatrixCylinder')
|
||||
vert.add_uniform('mat4 LWVP', '_lightWorldViewProjectionMatrixCylinder')
|
||||
else: # off
|
||||
vert.add_uniform('mat4 LWVP', '_lampWorldViewProjectionMatrix')
|
||||
vert.add_uniform('mat4 LWVP', '_lightWorldViewProjectionMatrix')
|
||||
vert.write('gl_Position = LWVP * spos;')
|
||||
else:
|
||||
if billboard == 'spherical':
|
||||
|
|
|
@ -498,9 +498,9 @@ def make_forward_mobile(con_mesh):
|
|||
|
||||
frag.add_include('std/math.glsl')
|
||||
frag.add_include('std/brdf.glsl')
|
||||
frag.add_uniform('vec3 lightColor', '_lampColor')
|
||||
frag.add_uniform('vec3 lightDir', '_lampDirection')
|
||||
frag.add_uniform('vec3 lightPos', '_lampPosition')
|
||||
frag.add_uniform('vec3 lightColor', '_lightColor')
|
||||
frag.add_uniform('vec3 lightDir', '_lightDirection')
|
||||
frag.add_uniform('vec3 lightPos', '_lightPosition')
|
||||
frag.add_uniform('float envmapStrength', link='_envmapStrength')
|
||||
|
||||
is_shadows = not '_NoShadows' in wrd.world_defs
|
||||
|
@ -509,14 +509,14 @@ def make_forward_mobile(con_mesh):
|
|||
frag.write('float dotNL = max(dot(n, lightDir), 0.0);')
|
||||
|
||||
if is_shadows:
|
||||
vert.add_out('vec4 lampPos')
|
||||
vert.add_uniform('mat4 LWVP', '_biasLampWorldViewProjectionMatrix')
|
||||
vert.write('lampPos = LWVP * spos;')
|
||||
vert.add_out('vec4 lightPosition')
|
||||
vert.add_uniform('mat4 LWVP', '_biasLightWorldViewProjectionMatrix')
|
||||
vert.write('lightPosition = LWVP * spos;')
|
||||
frag.add_include('std/shadows.glsl')
|
||||
frag.add_uniform('sampler2D shadowMap')
|
||||
frag.add_uniform('float shadowsBias', '_lampShadowsBias')
|
||||
frag.write(' if (lampPos.w > 0.0) {')
|
||||
frag.write(' vec3 lPos = lampPos.xyz / lampPos.w;')
|
||||
frag.add_uniform('float shadowsBias', '_lightShadowsBias')
|
||||
frag.write(' if (lightPosition.w > 0.0) {')
|
||||
frag.write(' vec3 lPos = lightPosition.xyz / lightPosition.w;')
|
||||
frag.write(' const float texelSize = 1.0 / shadowmapSize.x;')
|
||||
frag.write(' visibility = 0.0;')
|
||||
# TODO: CSM
|
||||
|
@ -642,11 +642,11 @@ def make_forward_base(con_mesh, parse_opacity=False):
|
|||
|
||||
frag.add_include('std/brdf.glsl')
|
||||
frag.add_include('std/math.glsl')
|
||||
frag.add_uniform('vec3 lightColor', '_lampColor')
|
||||
frag.add_uniform('vec3 lightDir', '_lampDirection')
|
||||
frag.add_uniform('vec3 lightPos', '_lampPosition')
|
||||
frag.add_uniform('int lightType', '_lampType')
|
||||
frag.add_uniform('vec2 spotlightData', '_spotlampData') # cutoff, cutoff - exponent
|
||||
frag.add_uniform('vec3 lightColor', '_lightColor')
|
||||
frag.add_uniform('vec3 lightDir', '_lightDirection')
|
||||
frag.add_uniform('vec3 lightPos', '_lightPosition')
|
||||
frag.add_uniform('int lightType', '_lightType')
|
||||
frag.add_uniform('vec2 spotlightData', '_spotlightData') # cutoff, cutoff - exponent
|
||||
frag.add_uniform('float envmapStrength', link='_envmapStrength')
|
||||
|
||||
if '_Brdf' in wrd.world_defs:
|
||||
|
@ -672,29 +672,29 @@ def make_forward_base(con_mesh, parse_opacity=False):
|
|||
|
||||
if is_shadows:
|
||||
if tese != None:
|
||||
tese.add_out('vec4 lampPos')
|
||||
tese.add_uniform('mat4 LVP', '_biasLampViewProjectionMatrix')
|
||||
tese.add_uniform('int lightShadow', '_lampCastShadow')
|
||||
tese.write('if (lightShadow == 1) lampPos = LVP * vec4(wposition, 1.0);')
|
||||
tese.add_out('vec4 lightPosition')
|
||||
tese.add_uniform('mat4 LVP', '_biasLightViewProjectionMatrix')
|
||||
tese.add_uniform('int lightShadow', '_lightCastShadow')
|
||||
tese.write('if (lightShadow == 1) lightPosition = LVP * vec4(wposition, 1.0);')
|
||||
else:
|
||||
if is_displacement:
|
||||
vert.add_out('vec4 lampPos')
|
||||
vert.add_uniform('mat4 LVP', '_biasLampViewProjectionMatrix')
|
||||
vert.add_uniform('int lightShadow', '_lampCastShadow')
|
||||
vert.write('if (lightShadow == 1) lampPos = LVP * vec4(wposition, 1.0);')
|
||||
vert.add_out('vec4 lightPosition')
|
||||
vert.add_uniform('mat4 LVP', '_biasLightViewProjectionMatrix')
|
||||
vert.add_uniform('int lightShadow', '_lightCastShadow')
|
||||
vert.write('if (lightShadow == 1) lightPosition = LVP * vec4(wposition, 1.0);')
|
||||
else:
|
||||
vert.add_out('vec4 lampPos')
|
||||
vert.add_uniform('int lightShadow', '_lampCastShadow')
|
||||
vert.add_uniform('mat4 LWVP', '_biasLampWorldViewProjectionMatrix')
|
||||
vert.write('if (lightShadow == 1) lampPos = LWVP * spos;')
|
||||
vert.add_out('vec4 lightPosition')
|
||||
vert.add_uniform('int lightShadow', '_lightCastShadow')
|
||||
vert.add_uniform('mat4 LWVP', '_biasLightWorldViewProjectionMatrix')
|
||||
vert.write('if (lightShadow == 1) lightPosition = LWVP * spos;')
|
||||
|
||||
frag.add_include('std/shadows.glsl')
|
||||
frag.add_uniform('sampler2D shadowMap')
|
||||
frag.add_uniform('samplerCube shadowMapCube')
|
||||
frag.add_uniform('bool receiveShadow')
|
||||
frag.add_uniform('float shadowsBias', '_lampShadowsBias')
|
||||
frag.add_uniform('int lightShadow', '_lampCastShadow')
|
||||
frag.add_uniform('vec2 lightProj', '_lampPlaneProj')
|
||||
frag.add_uniform('float shadowsBias', '_lightShadowsBias')
|
||||
frag.add_uniform('int lightShadow', '_lightCastShadow')
|
||||
frag.add_uniform('vec2 lightProj', '_lightPlaneProj')
|
||||
|
||||
frag.write('if (receiveShadow) {')
|
||||
frag.write(' if (lightShadow == 1) {')
|
||||
|
@ -708,16 +708,16 @@ def make_forward_base(con_mesh, parse_opacity=False):
|
|||
frag.write(' int casi;')
|
||||
frag.write(' int casindex;')
|
||||
frag.write(' mat4 LWVP = getCascadeMat(distance(eye, wposition), casi, casindex);')
|
||||
frag.write(' vec4 lampPos = LWVP * vec4(wposition, 1.0);')
|
||||
frag.write(' lPos = lampPos.xyz / lampPos.w;')
|
||||
frag.write(' vec4 lightPosition = LWVP * vec4(wposition, 1.0);')
|
||||
frag.write(' lPos = lightPosition.xyz / lightPosition.w;')
|
||||
frag.write(' smSize = shadowmapSize * vec2(shadowmapCascades, 1.0);')
|
||||
frag.write('}')
|
||||
frag.write('else {')
|
||||
frag.write(' lPos = lampPos.xyz / lampPos.w;')
|
||||
frag.write(' lPos = lightPosition.xyz / lightPosition.w;')
|
||||
frag.write(' smSize = shadowmapSize;')
|
||||
frag.write('}')
|
||||
else:
|
||||
frag.write(' vec3 lPos = lampPos.xyz / lampPos.w;')
|
||||
frag.write(' vec3 lPos = lightPosition.xyz / lightPosition.w;')
|
||||
frag.write(' const vec2 smSize = shadowmapSize;')
|
||||
# frag.write('float bias = clamp(shadowsBias * 1.0 * tan(acos(clamp(dotNL, 0.0, 1.0))), 0.0, 0.01);')
|
||||
frag.write(' visibility *= PCF(shadowMap, lPos.xy, lPos.z - shadowsBias, smSize);')
|
||||
|
@ -751,19 +751,19 @@ def make_forward_base(con_mesh, parse_opacity=False):
|
|||
frag.add_include('std/ltc.glsl')
|
||||
frag.add_uniform('sampler2D sltcMat', link='_ltcMat')
|
||||
frag.add_uniform('sampler2D sltcMag', link='_ltcMag')
|
||||
frag.add_uniform('vec3 lampArea0', link='_lampArea0')
|
||||
frag.add_uniform('vec3 lampArea1', link='_lampArea1')
|
||||
frag.add_uniform('vec3 lampArea2', link='_lampArea2')
|
||||
frag.add_uniform('vec3 lampArea3', link='_lampArea3')
|
||||
frag.add_uniform('vec3 lightArea0', link='_lightArea0')
|
||||
frag.add_uniform('vec3 lightArea1', link='_lightArea1')
|
||||
frag.add_uniform('vec3 lightArea2', link='_lightArea2')
|
||||
frag.add_uniform('vec3 lightArea3', link='_lightArea3')
|
||||
frag.write('if (lightType == 3) {')
|
||||
frag.write(' float theta = acos(dotNV);')
|
||||
frag.write(' vec2 tuv = vec2(roughness, theta / (0.5 * PI));')
|
||||
frag.write(' tuv = tuv * LUT_SCALE + LUT_BIAS;')
|
||||
frag.write(' vec4 t = texture(sltcMat, tuv);')
|
||||
frag.write(' mat3 invM = mat3(vec3(1.0, 0.0, t.y), vec3(0.0, t.z, 0.0), vec3(t.w, 0.0, t.x));')
|
||||
frag.write(' float ltcspec = ltcEvaluate(n, vVec, dotNV, wposition, invM, lampArea0, lampArea1, lampArea2, lampArea3);')
|
||||
frag.write(' float ltcspec = ltcEvaluate(n, vVec, dotNV, wposition, invM, lightArea0, lightArea1, lightArea2, lightArea3);')
|
||||
frag.write(' ltcspec *= texture(sltcMag, tuv).a;')
|
||||
frag.write(' float ltcdiff = ltcEvaluate(n, vVec, dotNV, wposition, mat3(1.0), lampArea0, lampArea1, lampArea2, lampArea3);')
|
||||
frag.write(' float ltcdiff = ltcEvaluate(n, vVec, dotNV, wposition, mat3(1.0), lightArea0, lightArea1, lightArea2, lightArea3);')
|
||||
frag.write(' direct = albedo * ltcdiff + ltcspec * specular;')
|
||||
frag.write('}')
|
||||
frag.write('else {')
|
||||
|
|
|
@ -42,7 +42,7 @@ def write(vert, particle_info=None, shadowmap=False):
|
|||
vert.write('if (p_age < 0 || p_age > p_lifetime) {')
|
||||
vert.write(' spos.x = spos.y = spos.z = -99999;')
|
||||
if shadowmap:
|
||||
vert.add_uniform('mat4 LWVP', '_lampWorldViewProjectionMatrix')
|
||||
vert.add_uniform('mat4 LWVP', '_lightWorldViewProjectionMatrix')
|
||||
vert.write(' gl_Position = LWVP * spos;')
|
||||
else:
|
||||
vert.add_uniform('mat4 WVP', '_worldViewProjectionMatrix')
|
||||
|
|
|
@ -55,14 +55,14 @@ def make_rect(con_rect):
|
|||
frag.add_uniform('sampler2D ssaotex')
|
||||
frag.add_uniform('sampler2D shadowMap')
|
||||
frag.add_uniform('sampler2D shadowMapCube')
|
||||
frag.add_uniform('mat4 LWVP', link='_biasLampWorldViewProjectionMatrix')
|
||||
frag.add_uniform('mat4 LWVP', link='_biasLightWorldViewProjectionMatrix')
|
||||
frag.add_uniform('vec3 eye', link='_cameraPosition')
|
||||
frag.add_uniform('vec3 eyeLook', link='_cameraLook')
|
||||
frag.add_uniform('vec3 lightPos', link='_lampPosition')
|
||||
frag.add_uniform('vec3 lightColor', link='_lampColor')
|
||||
frag.add_uniform('int lightShadow', link='_lampCastShadow')
|
||||
frag.add_uniform('vec2 lightProj', link='_lampPlaneProj')
|
||||
frag.add_uniform('float shadowsBias', link='_lampShadowsBias')
|
||||
frag.add_uniform('vec3 lightPos', link='_lightPosition')
|
||||
frag.add_uniform('vec3 lightColor', link='_lightColor')
|
||||
frag.add_uniform('int lightShadow', link='_lightCastShadow')
|
||||
frag.add_uniform('vec2 lightProj', link='_lightPlaneProj')
|
||||
frag.add_uniform('float shadowsBias', link='_lightShadowsBias')
|
||||
# TODO: ifdef
|
||||
frag.add_uniform('float envmapStrength', link='_envmapStrength')
|
||||
frag.add_uniform('vec4 shirr[7]', link='_envmapIrradiance', included=True)
|
||||
|
|
|
@ -334,7 +334,7 @@ def init_properties():
|
|||
bpy.types.Scene.arm_export = BoolProperty(name="Export", description="Export scene data", default=True)
|
||||
# bpy.types.Scene.arm_gp_export = BoolProperty(name="Export GP", description="Export grease pencil data", default=True)
|
||||
bpy.types.Scene.arm_compress = BoolProperty(name="Compress", description="Pack data into zip file", default=False)
|
||||
# For lamp
|
||||
# For light
|
||||
if bpy.app.version >= (2, 80, 1):
|
||||
bpy.types.Light.arm_clip_start = FloatProperty(name="Clip Start", default=0.1)
|
||||
bpy.types.Light.arm_clip_end = FloatProperty(name="Clip End", default=50.0)
|
||||
|
@ -345,9 +345,9 @@ def init_properties():
|
|||
bpy.types.Lamp.arm_clip_end = FloatProperty(name="Clip End", default=50.0)
|
||||
bpy.types.Lamp.arm_fov = FloatProperty(name="Field of View", default=0.84)
|
||||
bpy.types.Lamp.arm_shadows_bias = FloatProperty(name="Bias", description="Depth offset to fight shadow acne", default=1.0)
|
||||
bpy.types.World.arm_lamp_texture = StringProperty(name="Mask Texture", default="")
|
||||
bpy.types.World.arm_lamp_ies_texture = StringProperty(name="IES Texture", default="")
|
||||
bpy.types.World.arm_lamp_clouds_texture = StringProperty(name="Clouds Texture", default="")
|
||||
bpy.types.World.arm_light_texture = StringProperty(name="Mask Texture", default="")
|
||||
bpy.types.World.arm_light_ies_texture = StringProperty(name="IES Texture", default="")
|
||||
bpy.types.World.arm_light_clouds_texture = StringProperty(name="Clouds Texture", default="")
|
||||
|
||||
bpy.types.World.arm_rpcache_list = CollectionProperty(type=bpy.types.PropertyGroup)
|
||||
bpy.types.World.arm_scripts_list = CollectionProperty(type=bpy.types.PropertyGroup)
|
||||
|
|
|
@ -484,7 +484,7 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
items=[('On', 'On', 'On'),
|
||||
('Off', 'Off', 'Off'),
|
||||
('Auto', 'Auto', 'Auto')],
|
||||
name="Soft Shadows", description="Soft shadows with variable penumbra (spot and non-cascaded sun lamp supported)", default='Off', update=assets.invalidate_shader_cache)
|
||||
name="Soft Shadows", description="Soft shadows with variable penumbra (spot and non-cascaded sun light supported)", default='Off', update=assets.invalidate_shader_cache)
|
||||
arm_soft_shadows_penumbra = IntProperty(name="Penumbra", description="Variable penumbra scale", default=1, min=0, max=10, update=assets.invalidate_shader_cache)
|
||||
arm_soft_shadows_distance = FloatProperty(name="Distance", description="Variable penumbra distance", default=1.0, min=0, max=10, update=assets.invalidate_shader_cache)
|
||||
arm_ssrs = BoolProperty(name="SSRS", description="Screen-space ray-traced shadows", default=False, update=assets.invalidate_shader_cache)
|
||||
|
@ -527,7 +527,7 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
arm_ssr_half_res = BoolProperty(name="Half Res", description="Trace in half resolution", default=True, update=update_renderpath)
|
||||
rp_ssr_z_only = BoolProperty(name="Z Only", description="Trace in Z axis only", default=False, update=update_renderpath)
|
||||
rp_voxelgi_hdr = BoolProperty(name="HDR Voxels", description="Store voxels in RGBA64 instead of RGBA32", default=False, update=update_renderpath)
|
||||
rp_voxelgi_relight = BoolProperty(name="Relight", description="Relight voxels when lamp is moved", default=True, update=update_renderpath)
|
||||
rp_voxelgi_relight = BoolProperty(name="Relight", description="Relight voxels when light is moved", default=True, update=update_renderpath)
|
||||
arm_voxelgi_dimensions = FloatProperty(name="Dimensions", description="Voxelization bounds",default=16, update=assets.invalidate_shader_cache)
|
||||
arm_voxelgi_revoxelize = BoolProperty(name="Revoxelize", description="Revoxelize scene each frame", default=False, update=assets.invalidate_shader_cache)
|
||||
arm_voxelgi_temporal = BoolProperty(name="Temporal Filter", description="Use temporal filtering to stabilize voxels", default=False, update=assets.invalidate_shader_cache)
|
||||
|
@ -642,7 +642,7 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
name='Particles', description='Simulation method', default='GPU', update=assets.invalidate_shader_cache)
|
||||
# Material override flags
|
||||
arm_culling = BoolProperty(name="Culling", default=True)
|
||||
arm_two_sided_area_lamp = BoolProperty(name="Two-Sided Area Lamps", description="Emit light from both faces of area lamp", default=False, update=assets.invalidate_shader_cache)
|
||||
arm_two_sided_area_light = BoolProperty(name="Two-Sided Area Light", description="Emit light from both faces of area plane", default=False, update=assets.invalidate_shader_cache)
|
||||
|
||||
class ArmRPList(bpy.types.UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname, index):
|
||||
|
|
|
@ -159,9 +159,9 @@ class DataPropsPanel(bpy.types.Panel):
|
|||
col = row.column()
|
||||
col.prop(obj.data, 'arm_fov')
|
||||
col.prop(obj.data, 'arm_shadows_bias')
|
||||
layout.prop(wrd, 'arm_lamp_texture')
|
||||
layout.prop(wrd, 'arm_lamp_ies_texture')
|
||||
layout.prop(wrd, 'arm_lamp_clouds_texture')
|
||||
layout.prop(wrd, 'arm_light_texture')
|
||||
layout.prop(wrd, 'arm_light_ies_texture')
|
||||
layout.prop(wrd, 'arm_light_clouds_texture')
|
||||
elif obj.type == 'SPEAKER':
|
||||
layout.prop(obj.data, 'arm_play_on_start')
|
||||
layout.prop(obj.data, 'arm_loop')
|
||||
|
|
|
@ -337,11 +337,11 @@ class Main {
|
|||
iron.object.BoneAnimation.skinMaxBones = """ + str(rpdat.arm_skin_max_bones) + """;""")
|
||||
if rpdat.rp_shadowmap_cascades != '1':
|
||||
f.write("""
|
||||
iron.object.LampObject.cascadeCount = """ + str(rpdat.rp_shadowmap_cascades) + """;
|
||||
iron.object.LampObject.cascadeSplitFactor = """ + str(rpdat.arm_shadowmap_split) + """;""")
|
||||
iron.object.LightObject.cascadeCount = """ + str(rpdat.rp_shadowmap_cascades) + """;
|
||||
iron.object.LightObject.cascadeSplitFactor = """ + str(rpdat.arm_shadowmap_split) + """;""")
|
||||
if rpdat.arm_shadowmap_bounds != 1.0:
|
||||
f.write("""
|
||||
iron.object.LampObject.cascadeBounds = """ + str(rpdat.arm_shadowmap_bounds) + """;""")
|
||||
iron.object.LightObject.cascadeBounds = """ + str(rpdat.arm_shadowmap_bounds) + """;""")
|
||||
if is_publish and wrd.arm_loadscreen:
|
||||
asset_references = list(set(assets.assets))
|
||||
loadscreen_class = 'armory.trait.internal.LoadingScreen'
|
||||
|
|
Loading…
Reference in a new issue