Disable/revert recent refection changes.

PiperOrigin-RevId: 963586393
Change-Id: I65449cfcae4d50664f87296fa69d1660adf60c91
This commit is contained in:
Haroon Qureshi
2026-08-12 12:07:16 -07:00
committed by Copybara-Service
parent fca913b4f5
commit 4929f2cd99
5 changed files with 8 additions and 38 deletions
@@ -15,7 +15,6 @@
material { material {
name : phong_2d_reflect, name : phong_2d_reflect,
shadingModel : specularGlossiness, shadingModel : specularGlossiness,
postLightingBlending : add,
flipUV : false, flipUV : false,
parameters : [ parameters : [
{ type : float4, name : BaseColorFactor }, { type : float4, name : BaseColorFactor },
@@ -52,12 +51,8 @@ fragment {
material.emissive = vec4( material.emissive = vec4(
materialParams.BaseColorFactor.rgb * materialParams.EmissiveFactor, 0.0); materialParams.BaseColorFactor.rgb * materialParams.EmissiveFactor, 0.0);
// The reflection is radiance arriving from the mirror direction, so it is // Apply reflection.
// weighted by the Fresnel term and added after lighting. Reflectance is
// the reflectivity at normal incidence; grazing angles approach a mirror.
vec4 reflection = texture(materialParams_Reflection, screen_uv); vec4 reflection = texture(materialParams_Reflection, screen_uv);
float f0 = materialParams.Reflectance; material.baseColor.rgb = mix(material.baseColor.rgb, reflection.rgb, materialParams.Reflectance);
float fresnel = f0 + (1.0 - f0) * pow(1.0 - getNdotV(), 5.0);
material.postLightingColor = vec4(reflection.rgb * fresnel, 0.0);
} }
} }
@@ -15,7 +15,6 @@
material { material {
name : phong_2d_uv_reflect, name : phong_2d_uv_reflect,
shadingModel : specularGlossiness, shadingModel : specularGlossiness,
postLightingBlending : add,
flipUV : false, flipUV : false,
parameters : [ parameters : [
{ type : float4, name : BaseColorFactor }, { type : float4, name : BaseColorFactor },
@@ -44,12 +43,8 @@ fragment {
material.emissive = vec4( material.emissive = vec4(
materialParams.BaseColorFactor.rgb * materialParams.EmissiveFactor, 0.0); materialParams.BaseColorFactor.rgb * materialParams.EmissiveFactor, 0.0);
// The reflection is radiance arriving from the mirror direction, so it is // Apply reflection.
// weighted by the Fresnel term and added after lighting. Reflectance is
// the reflectivity at normal incidence; grazing angles approach a mirror.
vec4 reflection = texture(materialParams_Reflection, screen_uv); vec4 reflection = texture(materialParams_Reflection, screen_uv);
float f0 = materialParams.Reflectance; material.baseColor.rgb = mix(material.baseColor.rgb, reflection.rgb, materialParams.Reflectance);
float fresnel = f0 + (1.0 - f0) * pow(1.0 - getNdotV(), 5.0);
material.postLightingColor = vec4(reflection.rgb * fresnel, 0.0);
} }
} }
@@ -15,7 +15,6 @@
material { material {
name : phong_color_reflect, name : phong_color_reflect,
shadingModel : specularGlossiness, shadingModel : specularGlossiness,
postLightingBlending : add,
parameters : [ parameters : [
{ type : float4, name : BaseColorFactor }, { type : float4, name : BaseColorFactor },
{ type : float, name : SpecularFactor }, { type : float, name : SpecularFactor },
@@ -37,12 +36,8 @@ fragment {
material.emissive = vec4( material.emissive = vec4(
materialParams.BaseColorFactor.rgb * materialParams.EmissiveFactor, 0.0); materialParams.BaseColorFactor.rgb * materialParams.EmissiveFactor, 0.0);
// The reflection is radiance arriving from the mirror direction, so it is // Apply reflection.
// weighted by the Fresnel term and added after lighting. Reflectance is
// the reflectivity at normal incidence; grazing angles approach a mirror.
vec4 reflection = texture(materialParams_Reflection, screen_uv); vec4 reflection = texture(materialParams_Reflection, screen_uv);
float f0 = materialParams.Reflectance; material.baseColor.rgb = mix(material.baseColor.rgb, reflection.rgb, materialParams.Reflectance);
float fresnel = f0 + (1.0 - f0) * pow(1.0 - getNdotV(), 5.0);
material.postLightingColor = vec4(reflection.rgb * fresnel, 0.0);
} }
} }
@@ -15,7 +15,6 @@
material { material {
name : phong_cube_reflect, name : phong_cube_reflect,
shadingModel : specularGlossiness, shadingModel : specularGlossiness,
postLightingBlending : add,
flipUV : false, flipUV : false,
parameters : [ parameters : [
{ type : float4, name : BaseColorFactor }, { type : float4, name : BaseColorFactor },
@@ -51,12 +50,8 @@ fragment {
material.emissive = vec4( material.emissive = vec4(
materialParams.BaseColorFactor.rgb * materialParams.EmissiveFactor, 0.0); materialParams.BaseColorFactor.rgb * materialParams.EmissiveFactor, 0.0);
// The reflection is radiance arriving from the mirror direction, so it is // Apply reflection.
// weighted by the Fresnel term and added after lighting. Reflectance is
// the reflectivity at normal incidence; grazing angles approach a mirror.
vec4 reflection = texture(materialParams_Reflection, screen_uv); vec4 reflection = texture(materialParams_Reflection, screen_uv);
float f0 = materialParams.Reflectance; material.baseColor.rgb = mix(material.baseColor.rgb, reflection.rgb, materialParams.Reflectance);
float fresnel = f0 + (1.0 - f0) * pow(1.0 - getNdotV(), 5.0);
material.postLightingColor = vec4(reflection.rgb * fresnel, 0.0);
} }
} }
@@ -133,40 +133,30 @@ MaterialManager::MaterialType MaterialManager::GetMaterialType(
} else if (material.orm_texture) { } else if (material.orm_texture) {
if (material.opacity_texture) { if (material.opacity_texture) {
return ObjectManager::kPbrPackedTransparent; return ObjectManager::kPbrPackedTransparent;
} else if (material.reflectance > 0) {
return ObjectManager::kPbrPackedReflect;
} else { } else {
return ObjectManager::kPbrPacked; return ObjectManager::kPbrPacked;
} }
} else if (material.metallic_texture) { } else if (material.metallic_texture) {
if (material.opacity_texture) { if (material.opacity_texture) {
return ObjectManager::kPbrPackedTransparent; return ObjectManager::kPbrPackedTransparent;
} else if (material.reflectance > 0) {
return ObjectManager::kPbrReflect;
} else { } else {
return ObjectManager::kPbr; return ObjectManager::kPbr;
} }
} else if (material.roughness_texture) { } else if (material.roughness_texture) {
if (material.color[3] < 1.0f) { if (material.color[3] < 1.0f) {
return ObjectManager::kPbrTransparent; return ObjectManager::kPbrTransparent;
} else if (material.reflectance > 0) {
return ObjectManager::kPbrReflect;
} else { } else {
return ObjectManager::kPbr; return ObjectManager::kPbr;
} }
} else if (material.metallic >= 0) { } else if (material.metallic >= 0) {
if (material.color[3] < 1.0f) { if (material.color[3] < 1.0f) {
return ObjectManager::kPbrTransparent; return ObjectManager::kPbrTransparent;
} else if (material.reflectance > 0) {
return ObjectManager::kPbrReflect;
} else { } else {
return ObjectManager::kPbr; return ObjectManager::kPbr;
} }
} else if (material.roughness >= 0) { } else if (material.roughness >= 0) {
if (material.color[3] < 1.0f) { if (material.color[3] < 1.0f) {
return ObjectManager::kPbrTransparent; return ObjectManager::kPbrTransparent;
} else if (material.reflectance > 0) {
return ObjectManager::kPbrReflect;
} else { } else {
return ObjectManager::kPbr; return ObjectManager::kPbr;
} }