Clouds shadows

This commit is contained in:
Lubos Lenco 2017-10-13 15:21:36 +02:00
parent 814644f0b7
commit 155d528f67
7 changed files with 41 additions and 10 deletions

View file

@ -33,6 +33,10 @@ uniform sampler2D gbuffer1;
//!uniform float lampSizeUV;
#endif
#endif
#ifdef _LampClouds
uniform sampler2D texClouds;
uniform float time;
#endif
uniform mat4 LWVP;
uniform vec3 lightColor;
@ -141,5 +145,10 @@ void main() {
visibility *= tvis;
#endif
#ifdef _LampClouds
visibility *= texture(texClouds, vec2(p.xy / 100.0 + time / 80.0)).r * dot(n, vec3(0,0,1));
#endif
fragColor.rgb *= visibility;
}

View file

@ -34,6 +34,16 @@
"link": "_lampColorTexture",
"ifdef": ["_LampColTex"]
},
{
"name": "texClouds",
"link": "_cloudsTexture",
"ifdef": ["_LampClouds"]
},
{
"name": "time",
"link": "_time",
"ifdef": ["_LampClouds"]
},
{
"name": "shadowsBias",
"link": "_lampShadowsBias"

View file

@ -27,6 +27,12 @@ class Uniforms {
if (armory.data.ConstData.ltcMagTex == null) armory.data.ConstData.initLTC();
return armory.data.ConstData.ltcMagTex;
}
else if (tulink == "_lensTexture") {
return Scene.active.embedded.get('lenstexture.jpg');
}
else if (tulink == "_cloudsTexture") {
return Scene.active.embedded.get('cloudstexture.png');
}
return null;
}

View file

@ -102,6 +102,10 @@ def build_node_tree(world):
wrd.world_defs += '_LampIES'
assets.add_embedded_data('iestexture.png')
if wrd.arm_lamp_clouds_texture != '':
wrd.world_defs += '_LampClouds'
assets.add_embedded_data('cloudstexture.png')
voxelgi = False
voxelao = False
if rpdat.rp_shadowmap == 'None':
@ -130,8 +134,8 @@ def build_node_tree(world):
assets.add_khafile_def('arm_voxelgi')
if rpdat.arm_voxelgi_revoxelize:
assets.add_khafile_def('arm_voxelgi_revox')
if rpdat.arm_voxelgi_camera:
wrd.world_defs += '_VoxelGICam'
if rpdat.arm_voxelgi_camera:
wrd.world_defs += '_VoxelGICam'
if wrd.arm_voxelgi_diff_cones == '5':
wrd.world_defs += '_VoxelGICone5'
wrd.world_defs += '_Rad' # Always do radiance for voxels

View file

@ -45,7 +45,7 @@ def make_gi(context_id):
frag.write('if (!isInsideCube(voxposition)) return;')
frag.write('vec3 wposition = voxposition * voxelgiHalfExtents;')
if rpdat.arm_voxelgi_camera:
if rpdat.arm_voxelgi_revoxelize and rpdat.arm_voxelgi_camera:
frag.add_uniform('vec3 eyeSnap', '_cameraPositionSnap')
frag.write('wposition += eyeSnap;')
@ -141,7 +141,7 @@ def make_gi(context_id):
vert.add_out('vec2 texCoordGeom')
vert.write('texCoordGeom = tex;')
if rpdat.arm_voxelgi_camera:
if rpdat.arm_voxelgi_revoxelize and rpdat.arm_voxelgi_camera:
vert.add_uniform('vec3 eyeSnap', '_cameraPositionSnap')
vert.write('voxpositionGeom = (vec3(W * vec4(pos, 1.0)) - eyeSnap) / voxelgiHalfExtents;')
else:
@ -276,7 +276,7 @@ def make_ao(context_id):
vert.add_uniform('mat4 W', '_worldMatrix')
vert.add_out('vec3 voxpositionGeom')
if rpdat.arm_voxelgi_camera:
if rpdat.arm_voxelgi_revoxelize and rpdat.arm_voxelgi_camera:
vert.add_uniform('vec3 eyeSnap', '_cameraPositionSnap')
vert.write('voxpositionGeom = (vec3(W * vec4(pos, 1.0)) - eyeSnap) / voxelgiHalfExtents;')
else:

View file

@ -260,6 +260,7 @@ def init_properties():
name='Tonemap', description='Tonemapping operator', default='Filmic', update=assets.invalidate_shader_cache)
bpy.types.World.arm_lamp_texture = bpy.props.StringProperty(name="Mask Texture", default="")
bpy.types.World.arm_lamp_ies_texture = bpy.props.StringProperty(name="IES Texture", default="")
bpy.types.World.arm_lamp_clouds_texture = bpy.props.StringProperty(name="Clouds Texture", default="")
bpy.types.World.arm_lens_texture = bpy.props.StringProperty(name="Lens Texture", default="")
bpy.types.World.arm_fisheye = bpy.props.BoolProperty(name="Fish Eye", default=False, update=assets.invalidate_shader_cache)
bpy.types.World.arm_vignette = bpy.props.BoolProperty(name="Vignette", default=False, update=assets.invalidate_shader_cache)

View file

@ -163,9 +163,10 @@ class DataPropsPanel(bpy.types.Panel):
col.prop(wrd, 'arm_pcfsize')
layout.prop(wrd, 'arm_lamp_texture')
layout.prop(wrd, 'arm_lamp_ies_texture')
layout.prop(wrd, 'arm_lamp_clouds_texture')
elif obj.type == 'SPEAKER':
layout.prop(obj.data, 'loop')
layout.prop(obj.data, 'stream')
layout.prop(obj.data, 'arm_loop')
layout.prop(obj.data, 'arm_stream')
elif obj.type == 'ARMATURE':
layout.prop(obj.data, 'arm_compress')
@ -1054,9 +1055,9 @@ class ArmRenderPropsPanel(bpy.types.Panel):
row = layout.row()
row.prop(wrd, 'arm_voxelgi_occ')
row.prop(wrd, 'arm_voxelgi_env')
row = layout.row()
row.prop(wrd, 'arm_voxelgi_step')
row.prop(wrd, 'arm_voxelgi_range')
# row = layout.row()
# row.prop(wrd, 'arm_voxelgi_step')
# row.prop(wrd, 'arm_voxelgi_range')
layout.prop(wrd, 'arm_voxelgi_diff_cones')
layout.label('SSAO')