Cleanup
This commit is contained in:
parent
4904b50f1a
commit
ac38825cef
|
@ -114,9 +114,6 @@ void main() {
|
|||
}
|
||||
|
||||
// if (!isInsideCube(voxpos)) fragColor = vec4(1.0); // Show bounds
|
||||
|
||||
// float opacity = g2.b;
|
||||
// if (opacity < 1.0) fragColor.rgb = mix(indirectRefractiveLight(-v, n, vec3(1.0), opacity, voxpos), fragColor.rgb, opacity);
|
||||
#endif
|
||||
|
||||
// Envmap
|
||||
|
@ -155,9 +152,7 @@ void main() {
|
|||
#ifdef _SSS
|
||||
envl.rgb *= envmapStrength * occspec.x;
|
||||
#else
|
||||
#ifndef _VoxelGIRefract
|
||||
envl.rgb *= envmapStrength * occspec.x; // Occlusion
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _VoxelAOvar
|
||||
|
|
|
@ -80,10 +80,6 @@ uniform vec3 eye;
|
|||
//!uniform mat4 VP;
|
||||
#endif
|
||||
|
||||
#ifdef _LightColTex
|
||||
uniform sampler2D texlightcolor;
|
||||
#endif
|
||||
|
||||
in vec4 wvpposition;
|
||||
out vec4 fragColor;
|
||||
|
||||
|
@ -203,28 +199,15 @@ void main() {
|
|||
fragColor.rgb = orenNayarDiffuseBRDF(albedo, metrough.y, dotNV, dotNL, dotVH) + wardSpecular(n, h, dotNL, dotNV, dotNH, T, shinyParallel, shinyPerpendicular) * spec;
|
||||
}
|
||||
else fragColor.rgb = lambertDiffuseBRDF(albedo, dotNL) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH) * spec;
|
||||
#else
|
||||
#ifdef _OrenNayar
|
||||
fragColor.rgb = orenNayarDiffuseBRDF(albedo, metrough.y, dotNV, dotNL, dotVH) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH) * spec;
|
||||
#else
|
||||
fragColor.rgb = lambertDiffuseBRDF(albedo, dotNL) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH) * spec;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _LTC
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _Hair // Aniso
|
||||
|
||||
#endif
|
||||
|
||||
fragColor.rgb *= lightColor;
|
||||
|
||||
#ifdef _LightColTex
|
||||
// fragColor.rgb *= texture(texlightcolor, envMapEquirect(l)).rgb;
|
||||
fragColor.rgb *= pow(texture(texlightcolor, l.xy).rgb, vec3(2.2));
|
||||
#endif
|
||||
|
||||
#ifdef _SSS
|
||||
if (texture(gbuffer2, texCoord).a == 2) {
|
||||
|
@ -243,14 +226,4 @@ void main() {
|
|||
#endif
|
||||
|
||||
fragColor.rgb *= visibility;
|
||||
|
||||
#ifdef _VoxelGIRefract
|
||||
#ifdef _VoxelGICam
|
||||
vec3 voxposr = (p - eyeSnap) / voxelgiHalfExtents;
|
||||
#else
|
||||
vec3 voxposr = p / voxelgiHalfExtents;
|
||||
#endif
|
||||
float opac = texture(gbuffer2, texCoord).b;
|
||||
fragColor.rgb = mix(traceRefraction(voxels, voxposr, n, -v, metrough.y), fragColor.rgb, opac);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -41,11 +41,6 @@
|
|||
"name": "lightShadow",
|
||||
"link": "_lightCastShadow"
|
||||
},
|
||||
{
|
||||
"name": "texlightcolor",
|
||||
"link": "_lightColorTexture",
|
||||
"ifdef": ["_LightColTex"]
|
||||
},
|
||||
{
|
||||
"name": "texIES",
|
||||
"link": "_iesTexture",
|
||||
|
|
|
@ -64,10 +64,6 @@ uniform vec2 cameraProj;
|
|||
uniform mat4 invVP;
|
||||
#endif
|
||||
|
||||
#ifdef _LightColTex
|
||||
uniform sampler2D texlightcolor;
|
||||
#endif
|
||||
|
||||
in vec2 texCoord;
|
||||
in vec3 viewRay;
|
||||
out vec4 fragColor;
|
||||
|
@ -140,20 +136,11 @@ void main() {
|
|||
fragColor.rgb = orenNayarDiffuseBRDF(albedo, metrough.y, dotNV, dotNL, dotVH) + wardSpecular(n, h, dotNL, dotNV, dotNH, T, shinyParallel, shinyPerpendicular) * spec;
|
||||
}
|
||||
else fragColor.rgb = lambertDiffuseBRDF(albedo, dotNL) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH) * spec;
|
||||
#else
|
||||
#ifdef _OrenNayar
|
||||
fragColor.rgb = orenNayarDiffuseBRDF(albedo, metrough.y, dotNV, dotNL, dotVH) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH) * spec;
|
||||
#else
|
||||
fragColor.rgb = lambertDiffuseBRDF(albedo, dotNL) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH) * spec;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
fragColor.rgb *= lightColor;
|
||||
|
||||
#ifdef _LightColTex
|
||||
// fragColor.rgb *= texture(texlightcolor, envMapEquirect(l)).rgb;
|
||||
fragColor.rgb *= pow(texture(texlightcolor, l.xy).rgb, vec3(2.2));
|
||||
#endif
|
||||
|
||||
#ifdef _SSS
|
||||
if (texture(gbuffer2, texCoord).a == 2) {
|
||||
|
@ -179,14 +166,4 @@ void main() {
|
|||
#endif
|
||||
|
||||
fragColor.rgb *= visibility;
|
||||
|
||||
#ifdef _VoxelGIRefract
|
||||
#ifdef _VoxelGICam
|
||||
vec3 voxposr = (p - eyeSnap) / voxelgiHalfExtents;
|
||||
#else
|
||||
vec3 voxposr = p / voxelgiHalfExtents;
|
||||
#endif
|
||||
float opac = texture(gbuffer2, texCoord).b;
|
||||
fragColor.rgb = mix(traceRefraction(voxels, voxposr, n, -v, metrough.y), fragColor.rgb, opac);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -29,11 +29,6 @@
|
|||
"name": "lightShadow",
|
||||
"link": "_lightCastShadow"
|
||||
},
|
||||
{
|
||||
"name": "texlightcolor",
|
||||
"link": "_lightColorTexture",
|
||||
"ifdef": ["_LightColTex"]
|
||||
},
|
||||
{
|
||||
"name": "texClouds",
|
||||
"link": "_cloudsTexture",
|
||||
|
|
|
@ -121,13 +121,13 @@ vec3 traceSpecular(sampler3D voxels, const vec3 pos, const vec3 normal, const ve
|
|||
return traceCone(voxels, pos, specularDir, specularAperture, MAX_DISTANCE, normal).xyz;
|
||||
}
|
||||
|
||||
vec3 traceRefraction(sampler3D voxels, const vec3 pos, const vec3 normal, const vec3 viewDir, const float roughness) {
|
||||
const float ior = 1.440;
|
||||
const float transmittance = 1.0;
|
||||
vec3 refraction = refract(viewDir, normal, 1.0 / ior);
|
||||
float specularAperture = clamp(tan((3.14159265 / 2) * roughness), 0.0174533 * 3.0, 3.14159265);
|
||||
return transmittance * traceCone(voxels, pos, refraction, specularAperture, MAX_DISTANCE, normal).xyz;
|
||||
}
|
||||
// vec3 traceRefraction(sampler3D voxels, const vec3 pos, const vec3 normal, const vec3 viewDir, const float roughness) {
|
||||
// const float ior = 1.440;
|
||||
// const float transmittance = 1.0;
|
||||
// vec3 refraction = refract(viewDir, normal, 1.0 / ior);
|
||||
// float specularAperture = clamp(tan((3.14159265 / 2) * roughness), 0.0174533 * 3.0, 3.14159265);
|
||||
// return transmittance * traceCone(voxels, pos, refraction, specularAperture, MAX_DISTANCE, normal).xyz;
|
||||
// }
|
||||
|
||||
float traceConeAO(sampler3D voxels, const vec3 origin, vec3 dir, const float aperture, const float maxDist) {
|
||||
dir = normalize(dir);
|
||||
|
|
|
@ -638,7 +638,7 @@ class RenderPathDeferred {
|
|||
}
|
||||
#end
|
||||
|
||||
#if ((rp_voxelgi_shadows) || (rp_voxelgi_refraction))
|
||||
#if (rp_voxelgi_shadows)
|
||||
{
|
||||
path.bindTarget(voxels, "voxels");
|
||||
}
|
||||
|
|
|
@ -22,14 +22,6 @@ def add_world_defs():
|
|||
if rpdat.rp_hdr == False:
|
||||
wrd.world_defs += '_LDR'
|
||||
|
||||
# Alternative models
|
||||
if rpdat.arm_diffuse_model == 'OrenNayar':
|
||||
wrd.world_defs += '_OrenNayar'
|
||||
|
||||
# TODO: Light texture test..
|
||||
if wrd.arm_light_texture != '':
|
||||
wrd.world_defs += '_LightColTex'
|
||||
|
||||
if wrd.arm_light_ies_texture != '':
|
||||
wrd.world_defs += '_LightIES'
|
||||
assets.add_embedded_data('iestexture.png')
|
||||
|
@ -91,9 +83,6 @@ def add_world_defs():
|
|||
if rpdat.arm_voxelgi_shadows:
|
||||
wrd.world_defs += '_VoxelGIDirect'
|
||||
wrd.world_defs += '_VoxelGIShadow'
|
||||
if rpdat.arm_voxelgi_refraction:
|
||||
wrd.world_defs += '_VoxelGIDirect'
|
||||
wrd.world_defs += '_VoxelGIRefract'
|
||||
if rpdat.rp_voxelgi_relight:
|
||||
assets.add_khafile_def('rp_voxelgi_relight')
|
||||
elif voxelao:
|
||||
|
@ -252,12 +241,8 @@ def build():
|
|||
assets.add_khafile_def('rp_gi={0}'.format(rpdat.rp_gi))
|
||||
assets.add_khafile_def('rp_voxelgi_resolution={0}'.format(rpdat.rp_voxelgi_resolution))
|
||||
assets.add_khafile_def('rp_voxelgi_resolution_z={0}'.format(rpdat.rp_voxelgi_resolution_z))
|
||||
if rpdat.rp_voxelgi_hdr:
|
||||
assets.add_khafile_def('rp_voxelgi_hdr')
|
||||
if rpdat.arm_voxelgi_shadows:
|
||||
assets.add_khafile_def('rp_voxelgi_shadows')
|
||||
if rpdat.arm_voxelgi_refraction:
|
||||
assets.add_khafile_def('rp_voxelgi_refraction')
|
||||
else:
|
||||
log.warn('Disabling Voxel GI - unsupported target - use Krom instead')
|
||||
|
||||
|
@ -352,7 +337,7 @@ def build():
|
|||
else:
|
||||
log.warn('Disabling soft shadows - "Armory Render Path - Cascades" requires to be set to 1 for now')
|
||||
|
||||
gbuffer2_direct = '_SSS' in wrd.world_defs or '_Hair' in wrd.world_defs or rpdat.arm_voxelgi_refraction
|
||||
gbuffer2_direct = '_SSS' in wrd.world_defs or '_Hair' in wrd.world_defs
|
||||
gbuffer2 = '_Veloc' in wrd.world_defs or gbuffer2_direct
|
||||
if gbuffer2:
|
||||
assets.add_khafile_def('rp_gbuffer2')
|
||||
|
|
|
@ -327,7 +327,7 @@ def make_deferred(con_mesh):
|
|||
rpdat = arm.utils.get_rp()
|
||||
|
||||
arm_discard = mat_state.material.arm_discard
|
||||
parse_opacity = arm_discard or rpdat.arm_voxelgi_refraction
|
||||
parse_opacity = arm_discard
|
||||
|
||||
make_base(con_mesh, parse_opacity=parse_opacity)
|
||||
|
||||
|
@ -396,8 +396,6 @@ def make_deferred(con_mesh):
|
|||
frag.write('vec2 posa = (wvpposition.xy / wvpposition.w) * 0.5 + 0.5;')
|
||||
frag.write('vec2 posb = (prevwvpposition.xy / prevwvpposition.w) * 0.5 + 0.5;')
|
||||
frag.write('fragColor[2].rg = vec2(posa - posb);')
|
||||
if rpdat.arm_voxelgi_refraction:
|
||||
frag.write('fragColor[2].b = opacity;')
|
||||
if '_SSS' in wrd.world_defs or '_Hair' in wrd.world_defs:
|
||||
frag.add_uniform('int materialID')
|
||||
frag.write('fragColor[2].a = materialID;')
|
||||
|
|
|
@ -53,11 +53,8 @@ def make_gi(context_id):
|
|||
frag.write('float metallic;') #
|
||||
frag.write('float occlusion;') #
|
||||
frag.write('float specular;') #
|
||||
parse_opacity = rpdat.arm_voxelgi_refraction
|
||||
if parse_opacity:
|
||||
frag.write('float opacity;')
|
||||
frag.write('float dotNV = 0.0;')
|
||||
cycles.parse(mat_state.nodes, con_voxel, vert, frag, geom, tesc, tese, parse_opacity=parse_opacity, parse_displacement=False, basecol_only=True)
|
||||
cycles.parse(mat_state.nodes, con_voxel, vert, frag, geom, tesc, tese, parse_opacity=False, parse_displacement=False, basecol_only=True)
|
||||
|
||||
# Voxelized particles
|
||||
particle = mat_state.material.arm_particle_flag
|
||||
|
|
|
@ -27,13 +27,12 @@ def get_rpasses(material):
|
|||
|
||||
rpdat = arm.utils.get_rp()
|
||||
has_voxels = arm.utils.voxel_support()
|
||||
vgirefract = rpdat.rp_gi == 'Voxel GI' and rpdat.arm_voxelgi_refraction and has_voxels
|
||||
|
||||
if material.arm_decal:
|
||||
ar.append('decal')
|
||||
elif material.arm_overlay:
|
||||
ar.append('overlay')
|
||||
elif is_transluc(material) and not material.arm_discard and not vgirefract and rpdat.rp_translucency_state != 'Off' and not material.arm_blending:
|
||||
elif is_transluc(material) and not material.arm_discard and rpdat.rp_translucency_state != 'Off' and not material.arm_blending:
|
||||
ar.append('translucent')
|
||||
else:
|
||||
ar.append('mesh')
|
||||
|
|
|
@ -334,7 +334,6 @@ def init_properties():
|
|||
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.Lamp.arm_shadows_cubemap = BoolProperty(name="Cubemap", description="Use cubemap to capture point light shadows", default=True)
|
||||
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="")
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ def update_preset(self, context):
|
|||
rpdat.rp_motionblur = 'Off'
|
||||
rpdat.arm_rp_resolution = 'Display'
|
||||
rpdat.arm_texture_filter = 'Anisotropic'
|
||||
rpdat.arm_diffuse_model = 'Lambert'
|
||||
rpdat.arm_radiance = True
|
||||
rpdat.arm_radiance_sky = True
|
||||
elif self.rp_preset == 'VR':
|
||||
|
@ -68,7 +67,6 @@ def update_preset(self, context):
|
|||
rpdat.rp_motionblur = 'Off'
|
||||
rpdat.arm_rp_resolution = 'Display'
|
||||
rpdat.arm_texture_filter = 'Point'
|
||||
rpdat.arm_diffuse_model = 'Lambert'
|
||||
rpdat.arm_radiance = True
|
||||
rpdat.arm_radiance_sky = True
|
||||
elif self.rp_preset == 'Mobile':
|
||||
|
@ -100,7 +98,6 @@ def update_preset(self, context):
|
|||
rpdat.rp_motionblur = 'Off'
|
||||
rpdat.arm_rp_resolution = 'Display'
|
||||
rpdat.arm_texture_filter = 'Linear'
|
||||
rpdat.arm_diffuse_model = 'Lambert'
|
||||
rpdat.arm_radiance = False
|
||||
rpdat.arm_radiance_sky = False
|
||||
elif self.rp_preset == 'Max':
|
||||
|
@ -136,7 +133,6 @@ def update_preset(self, context):
|
|||
rpdat.arm_rp_resolution = 'Display'
|
||||
rpdat.arm_material_model = 'Full'
|
||||
rpdat.arm_texture_filter = 'Anisotropic'
|
||||
rpdat.arm_diffuse_model = 'Lambert'
|
||||
rpdat.arm_radiance = True
|
||||
rpdat.arm_radiance_sky = True
|
||||
elif self.rp_preset == '2D/Baked':
|
||||
|
@ -168,7 +164,6 @@ def update_preset(self, context):
|
|||
rpdat.rp_motionblur = 'Off'
|
||||
rpdat.arm_rp_resolution = 'Display'
|
||||
rpdat.arm_texture_filter = 'Linear'
|
||||
rpdat.arm_diffuse_model = 'Lambert'
|
||||
rpdat.arm_radiance = False
|
||||
rpdat.arm_radiance_sky = False
|
||||
update_renderpath(self, context)
|
||||
|
@ -387,11 +382,6 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
('Solid', 'Solid', 'Solid'),
|
||||
],
|
||||
name="Materials", description="Material builder", default='Full', update=update_material_model)
|
||||
arm_diffuse_model = EnumProperty(
|
||||
items=[('Lambert', 'Lambert', 'Lambert'),
|
||||
('OrenNayar', 'OrenNayar', 'OrenNayar'),
|
||||
],
|
||||
name="Diffuse", description="Diffuse model", default='Lambert', update=assets.invalidate_shader_cache)
|
||||
arm_rp_displacement = EnumProperty(
|
||||
items=[('Off', 'Off', 'Off'),
|
||||
('Vertex', 'Vertex', 'Vertex'),
|
||||
|
@ -413,7 +403,6 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
rp_dynres = BoolProperty(name="Dynamic Resolution", description="Dynamic resolution scaling for performance", default=False, update=update_renderpath)
|
||||
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 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)
|
||||
|
@ -425,7 +414,6 @@ class ArmRPListItem(bpy.types.PropertyGroup):
|
|||
arm_voxelgi_camera = BoolProperty(name="Dynamic Camera", description="Use camera as voxelization origin", default=False, update=assets.invalidate_shader_cache)
|
||||
# arm_voxelgi_anisotropic = BoolProperty(name="Anisotropic", description="Use anisotropic voxels", default=False, update=update_renderpath)
|
||||
arm_voxelgi_shadows = BoolProperty(name="Trace Shadows", description="Use voxels to render shadows", default=False, update=update_renderpath)
|
||||
arm_voxelgi_refraction = BoolProperty(name="Trace Refraction", description="Use voxels to render refraction", default=False, update=update_renderpath)
|
||||
arm_samples_per_pixel = EnumProperty(
|
||||
items=[('1', '1', '1'),
|
||||
('2', '2', '2'),
|
||||
|
|
|
@ -140,7 +140,6 @@ class DataPropsPanel(bpy.types.Panel):
|
|||
col.prop(obj.data, 'arm_shadows_bias')
|
||||
if obj.data.type == 'POINT':
|
||||
layout.prop(obj.data, 'arm_shadows_cubemap')
|
||||
layout.prop(wrd, 'arm_light_texture')
|
||||
layout.prop(wrd, 'arm_light_ies_texture')
|
||||
layout.prop(wrd, 'arm_light_clouds_texture')
|
||||
elif obj.type == 'SPEAKER':
|
||||
|
@ -741,7 +740,6 @@ class ArmRenderPathPanel(bpy.types.Panel):
|
|||
self.prop(box, rpdat, 'rp_draw_order')
|
||||
self.prop(box, rpdat, 'arm_samples_per_pixel')
|
||||
self.prop(box, rpdat, 'arm_texture_filter')
|
||||
self.prop(box, rpdat, 'arm_diffuse_model')
|
||||
self.prop(box, rpdat, 'rp_sss_state')
|
||||
col = self.column(box, enabled=(rpdat.rp_sss_state != 'Off'))
|
||||
self.prop(col, rpdat, 'arm_sss_width')
|
||||
|
@ -788,7 +786,7 @@ class ArmRenderPathPanel(bpy.types.Panel):
|
|||
self.prop(col, rpdat, 'arm_pcfsize')
|
||||
|
||||
|
||||
self.label(layout, text='Global Illumination')
|
||||
self.label(layout, text='Voxels')
|
||||
box = self.box(layout)
|
||||
row = self.row(box)
|
||||
self.prop(row, rpdat, 'rp_gi', expand=True)
|
||||
|
@ -797,9 +795,6 @@ class ArmRenderPathPanel(bpy.types.Panel):
|
|||
self.prop(col2, rpdat, 'arm_voxelgi_bounces')
|
||||
row2 = self.row(col2)
|
||||
self.prop(row2, rpdat, 'rp_voxelgi_relight')
|
||||
self.prop(row2, rpdat, 'rp_voxelgi_hdr', text='HDR')
|
||||
row2 = self.row(col2)
|
||||
self.prop(row2, rpdat, 'arm_voxelgi_refraction', text='Refraction')
|
||||
self.prop(row2, rpdat, 'arm_voxelgi_shadows', text='Shadows')
|
||||
self.prop(col, rpdat, 'arm_voxelgi_cones')
|
||||
self.prop(col, rpdat, 'rp_voxelgi_resolution')
|
||||
|
|
Loading…
Reference in a new issue