Create Materials
Materials describe the appearance of object surfaces and how they react to light.
Create a Material asset in Evergine Studio
You can create a material click button on from Assets Details panel to deploy a create menu options and click on the option "Create material"
Inspect materials in Asset Details
You can find the material assets in the Assets Details panel when you select a folder in the Project Explorer.
Material files in content directory
The material file has the .wemt
extension.
Create a new Material from code
The following sample code can be used to create a new material and apply to an entity in your scene. In that case the material will be created using the StandardEffect effect and the Opaque render layer:
protected override void CreateScene()
{
var assetsService = Application.Current.Container.Resolve<AssetsService>();
// Load the effect...
Effect standardEffect = assetsService.Load<Effect>(EvergineContent.Effects.StandardEffect);
// Load a Render Layer description...
RenderLayerDescription layer = assetsService.Load<RenderLayerDescription>(EvergineContent.RenderLayers.Opaque);
// Create your own material...
Material material = new Material(standardEffect);
material.LayerDescription = layer;
// Apply to an entity
Entity primitive = new Entity()
.AddComponent(new Transform3D())
.AddComponent(new MaterialComponent() { Material = material })
.AddComponent(new SphereMesh())
.AddComponent(new MeshRenderer());
this.Managers.EntityManager.Add(primitive);
}