57 lines
2.1 KiB
Plaintext
57 lines
2.1 KiB
Plaintext
// Copyright 2025 DeepMind Technologies Limited
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
material {
|
|
name : pbr,
|
|
shadingModel : lit,
|
|
flipUV: false,
|
|
parameters : [
|
|
{ type : sampler2d, name : BaseColor },
|
|
{ type : sampler2d, name : Normal },
|
|
{ type : sampler2d, name : Occlusion },
|
|
{ type : sampler2d, name : Roughness },
|
|
{ type : sampler2d, name : Metallic },
|
|
{ type : sampler2d, name : Emissive },
|
|
{ type : float4, name : BaseColorFactor },
|
|
{ type : float, name : MetallicFactor },
|
|
{ type : float, name : RoughnessFactor },
|
|
{ type : float, name : EmissiveFactor }
|
|
|
|
],
|
|
requires : [
|
|
uv0
|
|
]
|
|
}
|
|
|
|
fragment {
|
|
void material(inout MaterialInputs material) {
|
|
vec2 uv = getUV0();
|
|
|
|
material.normal = texture(materialParams_Normal, uv).xyz * 2.0 - 1.0;
|
|
prepareMaterial(material);
|
|
|
|
material.baseColor = materialParams.BaseColorFactor;
|
|
material.baseColor *= texture(materialParams_BaseColor, uv);
|
|
material.ambientOcclusion = texture(materialParams_Occlusion, uv).r;
|
|
material.roughness = materialParams.RoughnessFactor;
|
|
material.roughness *= texture(materialParams_Roughness, uv).r;
|
|
material.metallic = materialParams.MetallicFactor;
|
|
material.metallic *= texture(materialParams_Metallic, uv).r;
|
|
material.emissive = texture(materialParams_Emissive, uv);
|
|
material.emissive.rgb *= materialParams.EmissiveFactor;
|
|
material.emissive.a = (1.0 - material.emissive.a) *
|
|
materialParams.EmissiveFactor;
|
|
}
|
|
}
|