Forward OIT

This commit is contained in:
Lubos Lenco 2016-12-05 15:03:47 +01:00
parent eb7155b377
commit e4ca8535e9
9 changed files with 242 additions and 5 deletions

View file

@ -435,7 +435,9 @@
],
"texture_params": [],
"vertex_shader": "translucent.vert.glsl",
"fragment_shader": "translucent.frag.glsl"
"vertex_shader_path": "../include/translucent.vert.glsl",
"fragment_shader": "translucent.frag.glsl",
"fragment_shader_path": "../include/translucent.frag.glsl"
},
{
"name": "voxel",

View file

@ -252,6 +252,123 @@
"fragment_shader": "shadowmap.frag.glsl",
"fragment_shader_path": "../include/shadowmap.frag.glsl"
},
{
"name": "translucent",
"depth_write": false,
"compare_mode": "less",
"cull_mode": "clockwise",
"blend_source": "blend_one",
"blend_destination": "blend_one",
"blend_operation": "add",
"alpha_blend_source": "blend_zero",
"alpha_blend_destination": "inverse_source_alpha",
"alpha_blend_operation": "add",
"links": [
{
"name": "W",
"link": "_worldMatrix"
},
{
"name": "N",
"link": "_normalMatrix"
},
{
"name": "V",
"link": "_viewMatrix"
},
{
"name": "P",
"link": "_projectionMatrix"
},
{
"name": "LWVP",
"link": "_lampWorldViewProjectionMatrix",
"ifndef": "_NoShadows"
},
{
"name": "shadowsBias",
"link": "_lampShadowsBias",
"ifndef": "_NoShadows"
},
{
"name": "lightPos",
"link": "_lampPosition"
},
{
"name": "lightDir",
"link": "_lampDirection"
},
{
"name": "lightColor",
"link": "_lampColor"
},
{
"name": "lightStrength",
"link": "_lampStrength"
},
{
"name": "spotlightCutoff",
"link": "_spotlampCutoff"
},
{
"name": "spotlightExponent",
"link": "_spotlampExponent"
},
{
"name": "lightType",
"link": "_lampType"
},
{
"name": "eye",
"link": "_cameraPosition"
},
{
"name": "skinBones",
"link": "_skinBones",
"ifdef": ["_Skinning"]
},
{
"name": "lightPos",
"link": "_lampPosition"
},
{
"name": "lightColor",
"link": "_lampColor"
},
{
"name": "lightStrength",
"link": "_lampStrength"
},
{
"name": "shirr",
"link": "_envmapIrradiance"
},
{
"name": "senvmapRadiance",
"link": "_envmapRadiance",
"ifdef": ["_Rad"]
},
{
"name": "envmapNumMipmaps",
"link": "_envmapNumMipmaps",
"ifdef": ["_Rad"]
},
{
"name": "senvmapBrdf",
"link": "_envmapBrdf",
"ifdef": ["_Rad"]
},
{
"name": "envmapStrength",
"link": "_envmapStrength"
}
],
"texture_params": [],
"vertex_shader": "translucent.vert.glsl",
"vertex_shader_path": "../include/translucent.vert.glsl",
"fragment_shader": "translucent.frag.glsl",
"fragment_shader_path": "../include/translucent.frag.glsl"
},
{
"name": "voxel",
"depth_write": false,

View file

@ -241,6 +241,123 @@
"vertex_shader_path": "../include/shadowmap.vert.glsl",
"fragment_shader": "depthwrite.frag.glsl",
"fragment_shader_path": "../include/shadowmap.frag.glsl"
},
{
"name": "translucent",
"depth_write": false,
"compare_mode": "less",
"cull_mode": "clockwise",
"blend_source": "blend_one",
"blend_destination": "blend_one",
"blend_operation": "add",
"alpha_blend_source": "blend_zero",
"alpha_blend_destination": "inverse_source_alpha",
"alpha_blend_operation": "add",
"links": [
{
"name": "W",
"link": "_worldMatrix"
},
{
"name": "N",
"link": "_normalMatrix"
},
{
"name": "V",
"link": "_viewMatrix"
},
{
"name": "P",
"link": "_projectionMatrix"
},
{
"name": "LWVP",
"link": "_lampWorldViewProjectionMatrix",
"ifndef": "_NoShadows"
},
{
"name": "shadowsBias",
"link": "_lampShadowsBias",
"ifndef": "_NoShadows"
},
{
"name": "lightPos",
"link": "_lampPosition"
},
{
"name": "lightDir",
"link": "_lampDirection"
},
{
"name": "lightColor",
"link": "_lampColor"
},
{
"name": "lightStrength",
"link": "_lampStrength"
},
{
"name": "spotlightCutoff",
"link": "_spotlampCutoff"
},
{
"name": "spotlightExponent",
"link": "_spotlampExponent"
},
{
"name": "lightType",
"link": "_lampType"
},
{
"name": "eye",
"link": "_cameraPosition"
},
{
"name": "skinBones",
"link": "_skinBones",
"ifdef": ["_Skinning"]
},
{
"name": "lightPos",
"link": "_lampPosition"
},
{
"name": "lightColor",
"link": "_lampColor"
},
{
"name": "lightStrength",
"link": "_lampStrength"
},
{
"name": "shirr",
"link": "_envmapIrradiance"
},
{
"name": "senvmapRadiance",
"link": "_envmapRadiance",
"ifdef": ["_Rad"]
},
{
"name": "envmapNumMipmaps",
"link": "_envmapNumMipmaps",
"ifdef": ["_Rad"]
},
{
"name": "senvmapBrdf",
"link": "_envmapBrdf",
"ifdef": ["_Rad"]
},
{
"name": "envmapStrength",
"link": "_envmapStrength"
}
],
"texture_params": [],
"vertex_shader": "translucent.vert.glsl",
"vertex_shader_path": "../include/translucent.vert.glsl",
"fragment_shader": "translucent.frag.glsl",
"fragment_shader_path": "../include/translucent.frag.glsl"
}
]
}

Binary file not shown.

View file

@ -2828,7 +2828,8 @@ class ArmoryExporter:
o['contexts'].append(c2)
# Additional geometry contexts, useful for depth-prepass
if ArmoryExporter.mesh_context_empty != '':
# No pre-pass for translucent
if ArmoryExporter.mesh_context_empty != '' and '_Translucent' not in defs:
c2 = {}
c2['name'] = ArmoryExporter.mesh_context_empty
o['contexts'].append(c2)

View file

@ -583,8 +583,8 @@ def parse_opacity_socket(self, opacity_input, opacity_strength_input, material,
if opacity_val != 1.0:
if parse.const_color == None:
make_albedo_const([1.0, 1.0, 1.0, 1.0], c)
col = parse.const_color['vec4']
parse.const_color['vec4'] = [col[0], col[1], col[2], opacity_val]
col = parse.const_color['vec4']
parse.const_color['vec4'] = [col[0], col[1], col[2], opacity_val]
defs.append('_Translucent')
def parse_pbr_group(self, material, c, defs, tree, node, factor):

View file

@ -849,7 +849,7 @@ def reload_blend_data():
def load_library():
sdk_path = armutils.get_sdk_path()
data_path = sdk_path + '/armory/blender/data/data.blend'
data_names = ['forward_path', 'forward_path_low', 'deferred_path', 'deferred_path_low', 'deferred_path_high', 'hybrid_path', 'vr_path', 'pathtrace_path', 'grease_pencil_path', 'Armory PBR']
data_names = ['forward_path', 'forward_path_low', 'forward_path_high', 'deferred_path', 'deferred_path_low', 'deferred_path_high', 'hybrid_path', 'vr_path', 'pathtrace_path', 'grease_pencil_path', 'Armory PBR']
# Remove old
for name in data_names: