LTC and hosek defines
This commit is contained in:
parent
b73ab0fbfe
commit
c67ff89361
|
@ -13,7 +13,7 @@ precision mediump float;
|
|||
#ifdef _VoxelGIDirect
|
||||
#include "../std/conetrace.glsl"
|
||||
#endif
|
||||
#ifdef _PolyLight
|
||||
#ifdef _LTC
|
||||
#include "../std/ltc.glsl"
|
||||
#endif
|
||||
#ifndef _NoShadows
|
||||
|
@ -67,7 +67,7 @@ uniform int lightType;
|
|||
uniform int lightShadow;
|
||||
uniform float shadowsBias;
|
||||
uniform vec2 spotlightData;
|
||||
#ifdef _PolyLight
|
||||
#ifdef _LTC
|
||||
uniform vec3 lampArea0;
|
||||
uniform vec3 lampArea1;
|
||||
uniform vec3 lampArea2;
|
||||
|
@ -173,7 +173,7 @@ void main() {
|
|||
float facspec = min(metrough.x * 3.0, 1.0);
|
||||
#endif
|
||||
|
||||
#ifdef _PolyLight
|
||||
#ifdef _LTC
|
||||
if (lightType == 3) { // Area
|
||||
float theta = acos(dotNV);
|
||||
vec2 tuv = vec2(metrough.y, theta / (0.5 * PI));
|
||||
|
@ -217,7 +217,7 @@ void main() {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _PolyLight
|
||||
#ifdef _LTC
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -67,32 +67,32 @@
|
|||
{
|
||||
"name": "lampArea0",
|
||||
"link": "_lampArea0",
|
||||
"ifdef": ["_PolyLight"]
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
"name": "lampArea1",
|
||||
"link": "_lampArea1",
|
||||
"ifdef": ["_PolyLight"]
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
"name": "lampArea2",
|
||||
"link": "_lampArea2",
|
||||
"ifdef": ["_PolyLight"]
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
"name": "lampArea3",
|
||||
"link": "_lampArea3",
|
||||
"ifdef": ["_PolyLight"]
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
"name": "sltcMat",
|
||||
"link": "_ltcMat",
|
||||
"ifdef": ["_PolyLight"]
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
"name": "sltcMag",
|
||||
"link": "_ltcMag",
|
||||
"ifdef": ["_PolyLight"]
|
||||
"ifdef": ["_LTC"]
|
||||
},
|
||||
{
|
||||
"name": "eye",
|
||||
|
|
|
@ -19,6 +19,7 @@ class Uniforms {
|
|||
else if (tulink == "_smaaArea") {
|
||||
return Scene.active.embedded.get('smaa_area.png');
|
||||
}
|
||||
#if arm_ltc
|
||||
else if (tulink == "_ltcMat") {
|
||||
if (armory.data.ConstData.ltcMatTex == null) armory.data.ConstData.initLTC();
|
||||
return armory.data.ConstData.ltcMatTex;
|
||||
|
@ -27,6 +28,7 @@ class Uniforms {
|
|||
if (armory.data.ConstData.ltcMagTex == null) armory.data.ConstData.initLTC();
|
||||
return armory.data.ConstData.ltcMagTex;
|
||||
}
|
||||
#end
|
||||
else if (tulink == "_lensTexture") {
|
||||
return Scene.active.embedded.get('lenstexture.jpg');
|
||||
}
|
||||
|
@ -38,6 +40,7 @@ class Uniforms {
|
|||
|
||||
public static function externalVec3Link(clink:String):iron.math.Vec4 {
|
||||
var v:Vec4 = null;
|
||||
#if arm_hosek
|
||||
if (clink == "_hosekA") {
|
||||
if (armory.renderpath.HosekWilkie.data == null) {
|
||||
armory.renderpath.HosekWilkie.init(Scene.active.world);
|
||||
|
@ -128,6 +131,7 @@ class Uniforms {
|
|||
v.y = armory.renderpath.HosekWilkie.data.Z.y;
|
||||
v.z = armory.renderpath.HosekWilkie.data.Z.z;
|
||||
}
|
||||
#end
|
||||
return v;
|
||||
}
|
||||
|
||||
|
|
|
@ -175,7 +175,8 @@ def build_node_tree(world):
|
|||
# Area lamps
|
||||
for lamp in bpy.data.lamps:
|
||||
if lamp.type == 'AREA':
|
||||
wrd.world_defs += '_PolyLight'
|
||||
wrd.world_defs += '_LTC'
|
||||
assets.add_khafile_def('arm_ltc')
|
||||
break
|
||||
|
||||
# Data will be written after render path has been processed to gather all defines
|
||||
|
@ -354,6 +355,7 @@ def parse_color(world, node, context, envmap_strength_const):
|
|||
envmap_strength_const['float'] *= 0.1
|
||||
|
||||
wrd.world_defs += '_EnvSky'
|
||||
assets.add_khafile_def('arm_hosek')
|
||||
# Append sky properties to material
|
||||
const = {}
|
||||
const['name'] = 'sunDirection'
|
||||
|
|
|
@ -645,7 +645,7 @@ def make_forward_base(con_mesh, parse_opacity=False):
|
|||
frag.write('vec3 f0 = surfaceF0(basecol, metallic);')
|
||||
frag.write('vec3 direct;')
|
||||
|
||||
if '_PolyLight' in wrd.world_defs:
|
||||
if '_LTC' in wrd.world_defs:
|
||||
frag.add_include('../../Shaders/std/ltc.glsl')
|
||||
frag.add_uniform('sampler2D sltcMat', link='_ltcMat')
|
||||
frag.add_uniform('sampler2D sltcMag', link='_ltcMag')
|
||||
|
@ -670,7 +670,7 @@ def make_forward_base(con_mesh, parse_opacity=False):
|
|||
frag.write('direct = lambertDiffuseBRDF(albedo, dotNL);')
|
||||
frag.write('direct += specularBRDF(f0, roughness, dotNL, dotNH, dotNV, dotVH);')
|
||||
|
||||
if '_PolyLight' in wrd.world_defs:
|
||||
if '_LTC' in wrd.world_defs:
|
||||
frag.write('}')
|
||||
frag.tab -= 1
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ def make_gi(context_id):
|
|||
# frag.write(' }')
|
||||
# frag.write('}')
|
||||
|
||||
# if '_PolyLight' in wrd.world_defs:
|
||||
# if '_LTC' in wrd.world_defs:
|
||||
# frag.add_include('../../Shaders/std/ltc.glsl')
|
||||
# frag.add_uniform('sampler2D sltcMat', link='_ltcMat')
|
||||
# frag.add_uniform('sampler2D sltcMag', link='_ltcMag')
|
||||
|
|
Loading…
Reference in New Issue