| 1 |
{ |
| 2 |
Copyright 2020-2020 Michalis Kamburelis. |
| 3 |
|
| 4 |
This file is part of "Castle Game Engine". |
| 5 |
|
| 6 |
"Castle Game Engine" is free software; see the file COPYING.txt, |
| 7 |
included in this distribution, for details about the copyright. |
| 8 |
|
| 9 |
"Castle Game Engine" is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 12 |
|
| 13 |
---------------------------------------------------------------------------- |
| 14 |
} |
| 15 |
|
| 16 |
{ Configuration of loading models in the glTF 2.0 format. } |
| 17 |
unit CastleLoadGltf; |
| 18 |
|
| 19 |
{$I castleconf.inc} |
| 20 |
|
| 21 |
interface |
| 22 |
|
| 23 |
var |
| 24 |
{ Makes model loaded from glTF use Phong materials (TMaterialNode) instead of |
| 25 |
Physically-Based Rendering materials (TPhysicalMaterialNode). |
| 26 |
|
| 27 |
Phong is a worse lighting model in general (less realistic, and most authoring |
| 28 |
tools now expose parameters closer to PBR, like Blender). |
| 29 |
However Phong lighting model is cheaper to compute, and it allows both |
| 30 |
Gouraud and Phong shading. And Phong lighting model combined with Gouraud shading |
| 31 |
is very cheap to render, which in effect means that your models render fast. |
| 32 |
|
| 33 |
We just interpret glTF pbrMetallicRoughness parameter "baseColor" (RGB part) |
| 34 |
as Phong "diffuseColor". } |
| 35 |
GltfForcePhongMaterials: Boolean = false; |
| 36 |
|
| 37 |
implementation |
| 38 |
|
| 39 |
end. |