Eevee: Some changes to default shader.
Use old BI material prop and use a metallic approach.
This commit is contained in:
parent
60cd996c0a
commit
ecee490d13
|
@ -1135,9 +1135,11 @@ class EEVEE_MATERIAL_PT_surface(MaterialButtonsPanel, Panel):
|
|||
layout.separator()
|
||||
|
||||
if not mat.use_nodes:
|
||||
raym = mat.raytrace_mirror
|
||||
layout.prop(mat, "diffuse_color", text="Diffuse")
|
||||
layout.prop(mat, "specular_color", text="Specular")
|
||||
layout.prop(mat, "specular_hardness", text="Glossiness")
|
||||
layout.prop(raym, "reflect_factor", text="Metallic")
|
||||
layout.prop(mat, "specular_intensity", text="Specular")
|
||||
layout.prop(raym, "gloss_factor", text="Roughness")
|
||||
|
||||
|
||||
classes = (
|
||||
|
|
|
@ -620,12 +620,13 @@ static void EEVEE_cache_populate(void *vedata, Object *ob)
|
|||
else {
|
||||
/* Shader failed : pink color */
|
||||
static float col[3] = {1.0f, 0.0f, 1.0f};
|
||||
static float spec[3] = {1.0f, 0.0f, 1.0f};
|
||||
static short hardness = 1;
|
||||
static float half = 0.5f;
|
||||
|
||||
shgrp = DRW_shgroup_create(e_data.default_lit, psl->default_pass);
|
||||
DRW_shgroup_uniform_vec3(shgrp, "diffuse_col", col, 1);
|
||||
DRW_shgroup_uniform_vec3(shgrp, "specular_col", spec, 1);
|
||||
DRW_shgroup_uniform_short(shgrp, "hardness", &hardness, 1);
|
||||
DRW_shgroup_uniform_vec3(shgrp, "basecol", col, 1);
|
||||
DRW_shgroup_uniform_float(shgrp, "metallic", &half, 1);
|
||||
DRW_shgroup_uniform_float(shgrp, "specular", &half, 1);
|
||||
DRW_shgroup_uniform_float(shgrp, "roughness", &half, 1);
|
||||
DRW_shgroup_uniform_texture(stl->g_data->default_lit_grp, "ltcMat", e_data.ltc_mat);
|
||||
DRW_shgroup_uniform_texture(stl->g_data->default_lit_grp, "brdfLut", e_data.brdf_lut);
|
||||
DRW_shgroup_uniform_texture(stl->g_data->default_lit_grp, "probeFiltered", txl->probe_pool);
|
||||
|
@ -640,9 +641,10 @@ static void EEVEE_cache_populate(void *vedata, Object *ob)
|
|||
}
|
||||
else {
|
||||
DRWShadingGroup *shgrp = DRW_shgroup_create(e_data.default_lit, psl->default_pass);
|
||||
DRW_shgroup_uniform_vec3(shgrp, "diffuse_col", &ma->r, 1);
|
||||
DRW_shgroup_uniform_vec3(shgrp, "specular_col", &ma->specr, 1);
|
||||
DRW_shgroup_uniform_short(shgrp, "hardness", &ma->har, 1);
|
||||
DRW_shgroup_uniform_vec3(shgrp, "basecol", &ma->r, 1);
|
||||
DRW_shgroup_uniform_float(shgrp, "metallic", &ma->ray_mirror, 1);
|
||||
DRW_shgroup_uniform_float(shgrp, "specular", &ma->spec, 1);
|
||||
DRW_shgroup_uniform_float(shgrp, "roughness", &ma->gloss_mir, 1);
|
||||
DRW_shgroup_uniform_texture(stl->g_data->default_lit_grp, "ltcMat", e_data.ltc_mat);
|
||||
DRW_shgroup_uniform_texture(stl->g_data->default_lit_grp, "brdfLut", e_data.brdf_lut);
|
||||
DRW_shgroup_uniform_texture(stl->g_data->default_lit_grp, "probeFiltered", txl->probe_pool);
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
|
||||
uniform vec3 diffuse_col;
|
||||
uniform vec3 specular_col;
|
||||
uniform int hardness;
|
||||
uniform vec3 basecol;
|
||||
uniform float metallic;
|
||||
uniform float specular;
|
||||
uniform float roughness;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
float roughness = 1.0 - float(hardness) / 511.0;
|
||||
roughness *= roughness;
|
||||
FragColor = vec4(eevee_surface_lit(worldNormal, diffuse_col, specular_col, roughness, 1.0), 1.0);
|
||||
vec3 dielectric = vec3(0.034) * specular * 2.0;
|
||||
vec3 diffuse = mix(basecol, vec3(0.0), metallic);
|
||||
vec3 f0 = mix(dielectric, basecol, metallic);
|
||||
FragColor = vec4(eevee_surface_lit(worldNormal, diffuse, f0, roughness, 1.0), 1.0);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue