Developer Luxophia on Github developed a powerful library, MyMaterial, that works with Direct 3D and lets you create your own material and apply them to 3D objects in Delphi 10 Berlin with FireMonkey. Normally in FireMonkey in order to give a texture, such as colors and patterns to 3D components, TColorMaterialSource, TTextureMaterialSource and TLightMaterialSource are used but if you require more complex material you have to create your own. At the core of MyMaterial library stand: TShaderSource, TShaderVar which are used in TMaterial. The TShaderVar contains information about the color, vertex, light, shader of the material. One thing to remember is that Direct3D uses HLSL (High-Level Shader Language or High-Level Shading Language), a proprietary shading language used to describe the shader. MyMaterial library translated the HLSL into TShaderSource and TShaderVar, thus you are no longer required to describe each shader variable, it will do this automatically. You can even load the shader from an external file (text file).
TMyMaterial = class (TMaterial)
///// Method procedure DoInitialize; override;
procedure DoApply (const Context_: TContext3D); override;
constructor Create; override;
destructor Destroy; override;
///// Property property EmisColor: TShaderVarColor read _EmisColor;
property AmbiColor: TShaderVarColor read _AmbiColor;
property DiffColor: TShaderVarColor read _DiffColor;
property SpecColor: TShaderVarColor read _SpecColor;
property SpecShiny: TShaderVarFloat read _SpecShiny;
property Texture: TShaderVarTexture read _Texture;
TMyMaterialSource is the component that puts the textures on top of the 3D components. MyMaterial library is available for Delphi 10 Berlin with FireMonkey and it looks to be open source. Demos are available for you to test its features. For those developers who want to study the source code, it is available on Github. With MyMaterial libray you can easily create your own custom textures and effects and apply them to the components you create.
Material Texture Library With 3d Models For FireMonkey In Delphi 10 Berlin On Windows by Delphi XE5 XE6 XE7 XE8 10 Seattle Berlin Firemonkey, Delphi Android, Delphi IOS is licensed under a Creative Commons Attribution 4.0 International License.