Merge Cycles profile into Full

This commit is contained in:
Lubos Lenco 2017-10-02 00:00:52 +02:00
parent a6fc011c5f
commit 444311e069
9 changed files with 38 additions and 53 deletions

View file

@ -128,6 +128,9 @@ void main() {
vec3 p = getPos2(invVP, depth, texCoord);
vec2 metrough = unpackFloat(g0.b);
float facdif = min((1.0 - metrough.x) * 3.0, 1.0);
float facspec = min(metrough.x * 3.0, 1.0);
vec3 v = normalize(eye - p);
float dotNV = dot(n, v);
@ -190,27 +193,19 @@ void main() {
float ltcspec = ltcEvaluate(n, v, dotNV, p, invM, lampArea0, lampArea1, lampArea2, lampArea3);
ltcspec *= texture(sltcMag, tuv).a;
float ltcdiff = ltcEvaluate(n, v, dotNV, p, mat3(1.0), lampArea0, lampArea1, lampArea2, lampArea3);
#ifdef _Cycles
float facdif = min((1.0 - metrough.x) * 3.0, 1.0);
float facspec = min(metrough.x * 3.0, 1.0);
fragColor.rgb = albedo * ltcdiff * facdif + ltcspec * facspec;
#else
fragColor.rgb = albedo * ltcdiff + ltcspec;
#endif
fragColor.rgb = albedo * ltcdiff * facdif + ltcspec * facspec;
}
else {
#endif
#ifdef _Cycles
#ifdef _OrenNayar
// Diff/glossy
float facdif = min((1.0 - metrough.x) * 3.0, 1.0);
float facspec = min(metrough.x * 3.0, 1.0);
float rough = pow(metrough.y, 0.5);
fragColor.rgb = orenNayarDiffuseBRDF(albedo, rough, dotNV, dotNL, dotVH) * max(1.0 - metrough.y, 0.88) * facdif + specularBRDF(f0, rough, dotNL, dotNH, dotNV, dotVH) * 3.5 * facspec;
// Metallic
// fragColor.rgb = orenNayarDiffuseBRDF(albedo, metrough.y, dotNV, dotNL, dotVH) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH);
#else
fragColor.rgb = lambertDiffuseBRDF(albedo, dotNL) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH);
fragColor.rgb = lambertDiffuseBRDF(albedo, dotNL) * facdif + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH) * facspec;
#endif
#ifdef _PolyLight

View file

@ -105,7 +105,7 @@ void main() {
// float dotLV = dot(l, v);
// float dotLH = dot(l, h);
#ifdef _Cycles
#ifdef _OrenNayar
fragColor.rgb = orenNayarDiffuseBRDF(albedo, metrough.y, dotNV, dotNL, dotVH) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH);
#else
fragColor.rgb = lambertDiffuseBRDF(albedo, dotNL) + specularBRDF(f0, metrough.y, dotNL, dotNH, dotNV, dotVH);

View file

@ -53,9 +53,9 @@ vec4 traceCone(const vec3 origin, vec3 dir, float aperture, const float maxDist,
float mip = max(log2(diam * voxelgiResolution), 0);
// vec4 mipSample = sampleVoxel(samplePos, dir, indices, mip);
vec4 mipSample = textureLod(voxels, samplePos * 0.5 + vec3(0.5), mip);
#ifdef _Cycles
mipSample.rgb = min(mipSample.rgb * 0.9, vec3(0.9)) + max((mipSample.rgb - 0.9) * 200.0, 0.0); // Higher range to allow emission
#endif
// #ifdef _Cycles
// mipSample.rgb = min(mipSample.rgb * 0.9, vec3(0.9)) + max((mipSample.rgb - 0.9) * 200.0, 0.0); // Higher range to allow emission
// #endif
// Blend mip sample with current sample color
sampleCol += ((1 - sampleCol.a) * mipSample) * (1.0 / max(voxelgiOcc, 0.1));
dist += max(diam / 2, VOXEL_SIZE); // Step size

View file

@ -56,6 +56,7 @@ def set_preset(self, context, preset):
rpdat.rp_motionblur = 'None'
rpdat.arm_rp_resolution = 'Display'
rpdat.arm_texture_filter = 'Anisotropic'
rpdat.arm_diffuse_model = 'Lambert'
elif preset == 'Forward':
rpdat.rp_renderer = 'Forward'
rpdat.arm_material_model = 'Full'
@ -86,6 +87,7 @@ def set_preset(self, context, preset):
rpdat.rp_motionblur = 'None'
rpdat.arm_rp_resolution = 'Display'
rpdat.arm_texture_filter = 'Anisotropic'
rpdat.arm_diffuse_model = 'Lambert'
elif preset == 'Deferred':
rpdat.rp_renderer = 'Deferred'
rpdat.arm_material_model = 'Full'
@ -116,36 +118,7 @@ def set_preset(self, context, preset):
rpdat.rp_motionblur = 'None'
rpdat.arm_rp_resolution = 'Display'
rpdat.arm_texture_filter = 'Anisotropic'
elif preset == 'Max':
rpdat.rp_renderer = 'Deferred'
rpdat.arm_material_model = 'Full'
rpdat.rp_shadowmap = '4096'
rpdat.rp_translucency_state = 'Auto'
rpdat.rp_overlays_state = 'Auto'
rpdat.rp_decals_state = 'Auto'
rpdat.rp_sss_state = 'Auto'
rpdat.rp_blending_state = 'Off'
rpdat.rp_hdr = True
rpdat.rp_background = 'World'
rpdat.rp_stereo = False
rpdat.rp_greasepencil = False
rpdat.rp_voxelgi = False
rpdat.rp_render_to_texture = True
rpdat.rp_supersampling = '1'
rpdat.rp_antialiasing = 'TAA'
rpdat.rp_compositornodes = True
rpdat.rp_volumetriclight = False
rpdat.rp_ssao = True
rpdat.rp_ssr = True
rpdat.rp_dfrs = False
rpdat.rp_dfao = False
rpdat.rp_dfgi = False
rpdat.rp_bloom = False
rpdat.rp_eyeadapt = False
rpdat.rp_rendercapture = False
rpdat.rp_motionblur = 'None'
rpdat.arm_rp_resolution = 'Display'
rpdat.arm_texture_filter = 'Anisotropic'
rpdat.arm_diffuse_model = 'Lambert'
elif preset == 'Render Capture':
rpdat.rp_renderer = 'Deferred'
rpdat.rp_shadowmap = '8192'
@ -175,9 +148,10 @@ def set_preset(self, context, preset):
rpdat.rp_rendercapture = True
rpdat.rp_motionblur = 'None'
rpdat.arm_rp_resolution = 'Display'
rpdat.arm_material_model = 'Cycles'
rpdat.arm_material_model = 'Full'
rpdat.arm_pcss_state = 'On'
rpdat.arm_texture_filter = 'Anisotropic'
rpdat.arm_diffuse_model = 'OrenNayar'
elif preset == 'Deferred Plus':
rpdat.rp_renderer = 'Deferred Plus'
rpdat.arm_material_model = 'Full'
@ -208,6 +182,7 @@ def set_preset(self, context, preset):
rpdat.rp_motionblur = 'None'
rpdat.arm_rp_resolution = 'Display'
rpdat.arm_texture_filter = 'Anisotropic'
rpdat.arm_diffuse_model = 'Lambert'
elif preset == 'VR Low':
rpdat.rp_renderer = 'Forward'
rpdat.arm_material_model = 'Mobile'
@ -238,6 +213,7 @@ def set_preset(self, context, preset):
rpdat.rp_motionblur = 'None'
rpdat.arm_rp_resolution = 'Display'
rpdat.arm_texture_filter = 'Point'
rpdat.arm_diffuse_model = 'Lambert'
elif preset == 'Mobile Low':
rpdat.rp_renderer = 'Forward'
rpdat.arm_material_model = 'Mobile'
@ -268,6 +244,7 @@ def set_preset(self, context, preset):
rpdat.rp_motionblur = 'None'
rpdat.arm_rp_resolution = 'Display'
rpdat.arm_texture_filter = 'Point'
rpdat.arm_diffuse_model = 'Lambert'
elif preset == 'Grease Pencil':
rpdat.rp_renderer = 'Forward'
rpdat.arm_material_model = 'Solid'
@ -297,6 +274,7 @@ def set_preset(self, context, preset):
rpdat.rp_motionblur = 'None'
rpdat.arm_rp_resolution = 'Display'
rpdat.arm_texture_filter = 'Anisotropic'
rpdat.arm_diffuse_model = 'Lambert'
updating_preset = False
set_renderpath(self, context)

View file

@ -94,8 +94,8 @@ def build_node_tree(world):
wrd.world_defs += '_LDR'
# Alternative models
if rpdat.arm_material_model == 'Cycles':
wrd.world_defs += '_Cycles'
if rpdat.arm_diffuse_model == 'OrenNayar':
wrd.world_defs += '_OrenNayar'
# TODO: Lamp texture test..
if wrd.arm_lamp_texture != '':

View file

@ -148,8 +148,8 @@ def make_gi(context_id):
frag.write('vec3 color = basecol * visibility * lightColor * dotNL * attenuate(distance(wposition * voxelgiDimensions, lightPos));')
frag.write('vec3 voxel = wposition * 0.5 + vec3(0.5);')
if rpdat.arm_material_model == 'Cycles':
frag.write('color = min(color * 0.9, vec3(0.9)) + min(color / 200.0, 0.1);') # Higher range to allow emission
# if rpdat.arm_material_model == 'Cycles':
# frag.write('color = min(color * 0.9, vec3(0.9)) + min(color / 200.0, 0.1);') # Higher range to allow emission
# if rpdat.rp_voxelgi_hdr:
# frag.write('imageStore(voxels, ivec3(voxelgiResolution * voxel), vec4(color, 1.0));')

View file

@ -168,9 +168,8 @@ def init_properties():
('Forward', 'Forward', 'Forward'),
('Deferred', 'Deferred', 'Deferred'),
('Deferred Plus', 'Deferred Plus (experimental)', 'Deferred Plus'),
('Max', 'Max', 'Max'),
('Render Capture', 'Render Capture', 'Render Capture'),
('Grease Pencil', 'Grease Pencil', 'Grease Pencil'),
('Render Capture', 'Render Capture', 'Render Capture'),
],
name="Preset", description="Render path preset", default='Deferred', update=update_preset)
bpy.types.World.arm_voxelgi_diff = bpy.props.FloatProperty(name="Diffuse", description="", default=1.0, update=assets.invalidate_shader_cache)
@ -356,6 +355,14 @@ def init_properties_on_load():
# Outdated project
if bpy.data.filepath != '' and wrd.arm_version != arm_version: # Call on project load only
print('Project updated to sdk v' + arm_version)
# TODO: deprecated - Cycles profile merged into Full
if arm_version == '17.10':
if len(wrd.arm_rplist) > 0:
rpdat = arm.utils.get_rp()
if rpdat.arm_material_model == 'Solid':
rpdat.arm_material_model = 'Mobile'
else:
rpdat.arm_material_model = 'Full'
wrd.arm_version = arm_version
arm.make.clean_project()
# Set url for embedded player

View file

@ -162,11 +162,15 @@ class ArmRPListItem(bpy.types.PropertyGroup):
name="Texture Filtering", description="Set Manual to honor interpolation setting on Image Texture node", default='Anisotropic')
arm_material_model = EnumProperty(
items=[('Full', 'Full', 'Full'),
('Cycles', 'Cycles', 'Cycles'),
('Mobile', 'Mobile', 'Mobile'),
('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_tessellation = bpy.props.BoolProperty(name="Tessellation", description="Enable tessellation for height maps on supported targets", default=True, update=assets.invalidate_shader_cache)
arm_rp_resolution = EnumProperty(
items=[('Display', 'Display', 'Display'),

View file

@ -943,6 +943,7 @@ class ArmRenderPathPanel(bpy.types.Panel):
layout.prop(rpdat, 'arm_pcss_state')
layout.prop(rpdat, 'arm_samples_per_pixel')
layout.prop(rpdat, 'arm_texture_filter')
layout.prop(rpdat, "arm_diffuse_model")
layout.prop(rpdat, 'arm_ssrs')
layout.prop(rpdat, 'arm_tessellation')
layout.prop(rpdat, 'arm_clouds')