Fix shadows for height maps.

This commit is contained in:
Lubos Lenco 2016-11-19 11:44:15 +01:00
parent 2bba8a4a18
commit 1649d77096
7 changed files with 35 additions and 19 deletions

View file

@ -94,6 +94,8 @@ void main() {
n /= (abs(n.x) + abs(n.y) + abs(n.z));
n.xy = n.z >= 0.0 ? n.xy : octahedronWrap(n.xy);
fragColor[0] = vec4(n.xy, packFloat(metalness, roughness), mask);
// fragColor[0] = vec4(n.xy, packFloat(metalness, roughness), mask);
// TODO: Can not read and test depth buffer at once, fetch depth from g0
fragColor[0] = vec4(n.xy, packFloat(metalness, roughness), 1.0 - gl_FragCoord.z);
fragColor[1] = vec4(baseColor.rgb, occ);
}

View file

@ -30,7 +30,7 @@ class TimeNode extends FloatNode {
val += iron.system.Time.delta * scale;
// Time out
if (inputs[_stopTime].f > 0) {
if (inputs[_stopTime].val > 0) {
if (scale > 0 && val >= inputs[_stopTime].val ||
scale < 0 && val <= inputs[_startTime].val) {
@ -40,10 +40,10 @@ class TimeNode extends FloatNode {
// Reflect
if (inputs[_reflect].val) {
if (scale > 0) {
f = inputs[_stopTime].val;
val = inputs[_stopTime].val;
}
else {
f = inputs[_startTime].val;
val = inputs[_startTime].val;
}
scale *= -1;
@ -55,7 +55,7 @@ class TimeNode extends FloatNode {
}
// Stop
else {
f = inputs[_stopTime].val;
val = inputs[_stopTime].val;
inputs[_enabled].val = false;
}
}

View file

@ -45,7 +45,7 @@ class EditorSpace extends Trait {
first = false;
kha.input.Keyboard.get().notify(onKeyDown, onKeyUp);
#if js
#if (js && webgl)
electronRenderCapture();
#end
}

View file

@ -31,20 +31,20 @@ def on_scene_update_post(context):
last_time = time.time()
# Tag redraw if playing in space_armory
state.last_chromium_running = state.chromium_running
# state.last_chromium_running = state.chromium_running
state.chromium_running = False
if not state.is_paused and bpy.context.screen != None:
for area in bpy.context.screen.areas:
if area.type == 'VIEW_ARMORY':
state.chromium_running = True
barmory.draw()
if armutils.get_os() == 'linux':
area.tag_redraw()
# barmory.draw()
# if armutils.get_os() == 'linux':
area.tag_redraw()
# Have to update chromium one more time before exit, to prevent 'AudioSyncReader::Read timed out' warnings
if state.chromium_running == False:
if state.last_chromium_running:
barmory.draw()
# if state.chromium_running == False:
# if state.last_chromium_running:
# barmory.draw()
# Auto patch on every operator change
if state.chromium_running and \

View file

@ -410,7 +410,7 @@ def add_height_strength(self, c, f):
const = {}
c['bind_constants'].append(const)
const['name'] = 'heightStrength'
const['float'] = f
const['float'] = f / 10 # 1.0 = 0.1 as default
def add_normal_tex(self, node, material, c, defs):
if '_NorTex' not in defs:

View file

@ -22,7 +22,8 @@ def init_properties():
('macos', 'MacOS', 'macos'),
('linux', 'Linux', 'linux'),
('ios', 'iOS', 'ios'),
('android-native', 'Android', 'android-native')],
('android-native', 'Android', 'android-native'),
('krom', 'Krom', 'krom')],
name="Target", default='html5',
description='Build paltform')
bpy.types.World.arm_project_target = target_prop
@ -59,14 +60,15 @@ def init_properties():
bpy.types.World.arm_play_auto_build = BoolProperty(name="Auto Build", description="Rebuild scene on operator changes", default=True)
bpy.types.World.arm_play_viewport_camera = BoolProperty(name="Viewport Camera", description="Start player at viewport camera position", default=False)
bpy.types.World.arm_play_viewport_navigation = EnumProperty(
items=[('None', 'None', 'None'),
items=[('None', 'None', 'None'),
('Walk', 'Walk', 'Walk')],
name="Navigation", description="Enable camera controls", default='Walk')
bpy.types.World.arm_play_console = BoolProperty(name="Debug Console", description="Show inspector in player", default=False)
bpy.types.World.arm_play_runtime = EnumProperty(
items=[('Electron', 'Electron', 'Electron'),
('Browser', 'Browser', 'Browser'),
('Native', 'Native', 'Native')],
('Native', 'Native', 'Native'),
('Krom', 'Krom', 'Krom')],
name="Runtime", description="Player runtime used when launching in new window", default='Electron')
bpy.types.World.arm_loadbar = BoolProperty(name="Load Bar", description="Show asset loading progress on published builds", default=True)
@ -197,7 +199,7 @@ def init_properties():
bpy.types.World.generate_radiance_sky_type = EnumProperty(
items=[('Fake', 'Fake', 'Fake'),
('Hosek', 'Hosek', 'Hosek')],
name="Type", description="Prefiltered maps to be used for radiance.", default='Fake', update=assets.invalidate_envmap_data)
name="Type", description="Prefiltered maps to be used for radiance", default='Fake', update=assets.invalidate_envmap_data)
bpy.types.World.generate_clouds = bpy.props.BoolProperty(name="Clouds", default=False, update=assets.invalidate_shader_cache)
bpy.types.World.generate_clouds_density = bpy.props.FloatProperty(name="Density", default=0.5, min=0.0, max=10.0, update=assets.invalidate_shader_cache)
bpy.types.World.generate_clouds_size = bpy.props.FloatProperty(name="Size", default=1.0, min=0.0, max=10.0, update=assets.invalidate_shader_cache)
@ -305,7 +307,7 @@ def init_properties():
bpy.types.Lamp.lamp_clip_end = bpy.props.FloatProperty(name="Clip End", default=50.0)
bpy.types.Lamp.lamp_fov = bpy.props.FloatProperty(name="Field of View", default=0.84)
bpy.types.Lamp.lamp_shadows_bias = bpy.props.FloatProperty(name="Shadows Bias", description="Depth offset for shadow acne", default=0.0002)
bpy.types.Lamp.lamp_omni_shadows = bpy.props.BoolProperty(name="Omnidirectional Shadows", description="Fakes omnidirectional shadows by creating 6 directional lights. Will result in preformance loss. Usable for deferred renderers only.", default=False)
bpy.types.Lamp.lamp_omni_shadows = bpy.props.BoolProperty(name="Omnidirectional Shadows", description="Fakes omnidirectional shadows by creating 6 directional lights - will result in preformance loss - usable for deferred renderers only", default=False)
if not 'Arm' in bpy.data.worlds:
wrd = bpy.data.worlds.new('Arm')

View file

@ -61,6 +61,8 @@ class LIST_OT_ParamsTraitNewItem(bpy.types.Operator):
bl_label = "Add a new item"
def execute(self, context):
if len(context.object.my_traitlist) == 0:
return
trait = context.object.my_traitlist[context.object.traitlist_index]
trait.my_paramstraitlist.add()
trait.paramstraitlist_index = len(trait.my_paramstraitlist) - 1
@ -75,10 +77,14 @@ class LIST_OT_ParamsTraitDeleteItem(bpy.types.Operator):
@classmethod
def poll(self, context):
""" Enable if there's something in the list """
if len(context.object.my_traitlist) == 0:
return False
trait = context.object.my_traitlist[context.object.traitlist_index]
return len(trait.my_paramstraitlist) > 0
def execute(self, context):
if len(context.object.my_traitlist) == 0:
return
trait = context.object.my_traitlist[context.object.traitlist_index]
list = trait.my_paramstraitlist
index = trait.paramstraitlist_index
@ -104,12 +110,16 @@ class LIST_OT_ParamsTraitMoveItem(bpy.types.Operator):
@classmethod
def poll(self, context):
""" Enable if there's something in the list. """
if len(context.object.my_traitlist) == 0:
return False
trait = context.object.my_traitlist[context.object.traitlist_index]
return len(trait.my_paramstraitlist) > 0
def move_index(self):
# Move index of an item render queue while clamping it
if len(context.object.my_traitlist) == 0:
return
trait = context.object.my_traitlist[context.object.traitlist_index]
index = trait.paramstraitlist_index
list_length = len(trait.my_paramstraitlist) - 1
@ -125,6 +135,8 @@ class LIST_OT_ParamsTraitMoveItem(bpy.types.Operator):
def execute(self, context):
if len(context.object.my_traitlist) == 0:
return
trait = context.object.my_traitlist[context.object.traitlist_index]
list = trait.my_paramstraitlist
index = trait.paramstraitlist_index