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