Lens texture test
This commit is contained in:
parent
6f8fa8ece0
commit
7dad48c30c
|
@ -19,6 +19,10 @@ uniform sampler2D gbufferD;
|
|||
uniform sampler2D gbuffer0;
|
||||
uniform sampler2D gbuffer1;
|
||||
|
||||
#ifdef _CLensTex
|
||||
uniform sampler2D lensTexture;
|
||||
#endif
|
||||
|
||||
// #ifdef _CPos
|
||||
// uniform vec3 eye;
|
||||
// uniform vec3 eyeLook;
|
||||
|
@ -269,6 +273,10 @@ void main() {
|
|||
// col.rgb += compoBrightness;
|
||||
// #endif
|
||||
|
||||
#ifdef _CLensTex
|
||||
col.rgb *= texture(lensTexture, texCo).rgb;
|
||||
#endif
|
||||
|
||||
#ifdef _CLetterbox
|
||||
// const float compoLetterboxSize = 0.1;
|
||||
col.rgb *= 1.0 - step(0.5 - compoLetterboxSize, abs(0.5 - texCo.y));
|
||||
|
|
|
@ -69,6 +69,11 @@
|
|||
"name": "aspectRatio",
|
||||
"link": "_aspectRatioF",
|
||||
"ifdef": ["_CGlare"]
|
||||
},
|
||||
{
|
||||
"name": "lensTexture",
|
||||
"link": "_lensTexture",
|
||||
"ifdef": ["_CLensTex"]
|
||||
}
|
||||
],
|
||||
"texture_params": [],
|
||||
|
|
|
@ -263,7 +263,7 @@ void main() {
|
|||
|
||||
#ifdef _LampColTex
|
||||
// direct *= texture(texlampcolor, envMapEquirect(l)).rgb;
|
||||
direct *= pow(texture(texlampcolor, l.xy).rgb, vec3(2.2));
|
||||
direct *= pow(texture(texlampcolor, l.xy).rgb, vec3(2.2));
|
||||
#endif
|
||||
|
||||
#ifdef _SSS
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
const int samples = 3; // Samples on the first ring
|
||||
const int rings = 3; // Ring count
|
||||
// const vec2 focus = vec2(0.5, 0.5);
|
||||
const vec2 focus = vec2(0.5, 0.5);
|
||||
const float coc = 0.03; // Circle of confusion size in mm (35mm film = 0.03mm)
|
||||
const float maxblur = 1.0;
|
||||
const float threshold = 0.5; // Highlight threshold
|
||||
|
@ -35,8 +35,8 @@ vec3 color(vec2 coords, const float blur, const sampler2D tex, const vec2 texSte
|
|||
|
||||
vec3 dof(const vec2 texCoord, const float gdepth, const sampler2D tex, const sampler2D gbuffer0, const vec2 texStep) {
|
||||
float depth = linearize(gdepth);
|
||||
const float fDepth = compoDOFDistance;
|
||||
// float fDepth = linearize((1.0 - texture(gbuffer0, focus).a) * 2.0 - 1.0); // Autofocus
|
||||
// const float fDepth = compoDOFDistance;
|
||||
float fDepth = linearize((1.0 - texture(gbuffer0, focus).a) * 2.0 - 1.0); // Autofocus
|
||||
|
||||
const float f = compoDOFLength; // Focal length in mm
|
||||
const float d = fDepth * 1000.0; // Focal plane in mm
|
||||
|
|
|
@ -22,6 +22,7 @@ import armutils
|
|||
import subprocess
|
||||
import log
|
||||
import material.make as make_material
|
||||
import material.texture as make_texture
|
||||
import nodes
|
||||
import make_renderer
|
||||
import make_renderpath
|
||||
|
@ -2086,13 +2087,11 @@ class ArmoryExporter:
|
|||
o['strength'] /= 40.0
|
||||
elif o['type'] == 'sun':
|
||||
o['strength'] *= 0.4
|
||||
# Texture test..
|
||||
# if n.inputs[0].is_linked:
|
||||
# color_node = nodes.find_node_by_link(tree, n, n.inputs[0])
|
||||
# if color_node.type == 'TEX_IMAGE':
|
||||
# o['color_texture'] = color_node.image.name
|
||||
# make_texture(None, '', color_node, None)
|
||||
## bpy.data.worlds['Arm'].world_defs += '_LampColTex'
|
||||
# TODO: Lamp texture test..
|
||||
if n.inputs[0].is_linked:
|
||||
color_node = n.inputs[0].links[0].from_node
|
||||
if color_node.type == 'TEX_IMAGE':
|
||||
o['color_texture'] = color_node.image.name
|
||||
break
|
||||
|
||||
# Fake omni shadows
|
||||
|
|
|
@ -256,6 +256,10 @@ def make_draw_compositor(stage, node_group, node, with_fxaa=False):
|
|||
if compo_depth:
|
||||
compositor_defs += '_CDepth'
|
||||
|
||||
if wrd.generate_lens_texture != '':
|
||||
compositor_defs += '_CLensTex'
|
||||
assets.add_embedded_data('lenstexture.jpg')
|
||||
|
||||
wrd.compo_defs = compositor_defs
|
||||
|
||||
defs = world_defs + compositor_defs
|
||||
|
|
|
@ -75,6 +75,10 @@ def build_node_tree(world):
|
|||
if wrd.diffuse_model == 'Oren Nayar':
|
||||
wrd.world_defs += '_OrenNayar'
|
||||
|
||||
# TODO: Lamp texture test..
|
||||
if wrd.generate_lamp_texture != '':
|
||||
bpy.data.worlds['Arm'].world_defs += '_LampColTex'
|
||||
|
||||
voxelgi = False
|
||||
for cam in bpy.data.cameras:
|
||||
if cam.is_probe:
|
||||
|
|
|
@ -6,13 +6,14 @@ import material.mat_state as mat_state
|
|||
import make_state as state
|
||||
import bpy
|
||||
|
||||
def make_texture(image_node, tex_name):
|
||||
def make_texture(image_node, tex_name, matname=None):
|
||||
wrd = bpy.data.worlds['Arm']
|
||||
tex = {}
|
||||
tex['name'] = tex_name
|
||||
tex['file'] = ''
|
||||
image = image_node.image
|
||||
matname = mat_state.material.name
|
||||
if matname == None:
|
||||
matname = mat_state.material.name
|
||||
|
||||
if image == None:
|
||||
return None
|
||||
|
|
|
@ -425,6 +425,8 @@ def init_properties():
|
|||
('Reinhard', 'Reinhard', 'Reinhard'),
|
||||
('Uncharted', 'Uncharted', 'Uncharted')],
|
||||
name='Tonemap', description='Tonemapping operator', default='Filmic', update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_lamp_texture = bpy.props.StringProperty(name="Lamp Texture", default="")
|
||||
bpy.types.World.generate_lens_texture = bpy.props.StringProperty(name="Lens Texture", default="")
|
||||
# Skin
|
||||
bpy.types.World.generate_gpu_skin = bpy.props.BoolProperty(name="GPU Skinning", description="Calculate skinning on GPU", default=True, update=assets.invalidate_shader_cache)
|
||||
bpy.types.World.generate_gpu_skin_max_bones = bpy.props.IntProperty(name="Max Bones", default=50, min=1, max=84, update=assets.invalidate_shader_cache)
|
||||
|
|
|
@ -356,6 +356,8 @@ class WorldPropsPanel(bpy.types.Panel):
|
|||
layout.prop(wrd, 'generate_fog_color')
|
||||
layout.prop(wrd, 'generate_fog_amounta')
|
||||
layout.prop(wrd, 'generate_fog_amountb')
|
||||
layout.prop(wrd, 'generate_lamp_texture')
|
||||
layout.prop(wrd, 'generate_lens_texture')
|
||||
|
||||
class ArmoryPlayerPanel(bpy.types.Panel):
|
||||
bl_label = "Armory Player"
|
||||
|
@ -401,8 +403,9 @@ class ArmoryPlayerPanel(bpy.types.Panel):
|
|||
row = layout.row(align=True)
|
||||
row.prop(wrd, 'arm_minimize')
|
||||
row.prop(wrd, 'arm_optimize_mesh')
|
||||
layout.prop(wrd, 'arm_gpu_processing')
|
||||
layout.prop(wrd, 'arm_sampled_animation')
|
||||
row = layout.row(align=True)
|
||||
row.prop(wrd, 'arm_gpu_processing')
|
||||
row.prop(wrd, 'arm_sampled_animation')
|
||||
layout.prop(wrd, 'arm_deinterleaved_buffers')
|
||||
layout.label('Libraries')
|
||||
layout.prop(wrd, 'arm_physics')
|
||||
|
|
Loading…
Reference in a new issue