I am just getting started with a MAUI/Evergine integration. The project builder is very smooth and it works out of the box with no glitches which is great. Really fantastic work on the integration.
I would like to instantiate an object with a standard diffuse material (no PNG texture/graphic wanted - just based on color, specularity, roughness, etc).
public override void Initialize()
{
base.Initialize();
// Get ScreenContextManager
var screenContextManager = this.Container.Resolve<ScreenContextManager>();
var assetsService = this.Container.Resolve<AssetsService>();
// Navigate to scene
var scene = assetsService.Load<MyScene>(EvergineContent.Scenes.MyScene_wescene);
ScreenContext screenContext = new ScreenContext(scene);
screenContextManager.To(screenContext);
// Load the effect...
Effect standardEffect = assetsService.Load<Effect>(EvergineContent.Effects.StandardEffect);
//var standardTexture = assetsService.Load<Texture>(EvergineContent.Textures.dfgLut_png); //NEEDED OR JUST RENDERS FLAT COLOR
// Load a Render Layer description...
RenderLayerDescription layer = assetsService.Load<RenderLayerDescription>(EvergineContent.RenderLayers.Opaque);
// Create your own material...
StandardMaterial materialDecorator = new StandardMaterial(assetsService.Load<Effect>(EvergineContent.Effects.StandardEffect));
//materialDecorator.BaseColorTexture = standardTexture; //NEEDED OR JUST RENDERS FLAT COLOR
materialDecorator.Material.LayerDescription = layer;
// Apply to an entity
Entity primitive = new Entity()
.AddComponent(new Transform3D())
.AddComponent(new MaterialComponent() { Material = materialDecorator.Material })
.AddComponent(new TeapotMesh())
.AddComponent(new MeshRenderer());
scene.Managers.EntityManager.Add(primitive);
}
If I try to generate a teapot this way, without a Texture set to the Material Decorator I get only a flat color with no shading (bottom left is programmatically instantiated by the above without the texture applied, to the right is a normal teapot already added to the scene in Evergine editor rendering correctly):
If I activate the lines in the code above to load that texture (the only thing I could find just by autocomplete default options in there), I get this:
This is at least rendering some shading on it, so presumably the Texture is what is missing.
If I am doing this correctly, how do you then create a blank Texture then just for a flat color?
I am just getting started with a MAUI/Evergine integration. The project builder is very smooth and it works out of the box with no glitches which is great. Really fantastic work on the integration.
I would like to instantiate an object with a standard diffuse material (no PNG texture/graphic wanted - just based on color, specularity, roughness, etc).
I tried following the tutorial here: https://docs.evergine.com/2023.9.28/manual/graphics/materials/create_materials.html and put in my MyApplication.cs:
If I try to generate a teapot this way, without a Texture set to the Material Decorator I get only a flat color with no shading (bottom left is programmatically instantiated by the above without the texture applied, to the right is a normal teapot already added to the scene in Evergine editor rendering correctly):
If I activate the lines in the code above to load that texture (the only thing I could find just by autocomplete default options in there), I get this:
This is at least rendering some shading on it, so presumably the Texture is what is missing.
If I am doing this correctly, how do you then create a blank Texture then just for a flat color?
I see this article which explains how to create a Texture from code: https://docs.evergine.com/2023.9.28/manual/graphics/low_level_api/texture.html
If we need a flat color Texture, are we supposed to use that guide and create a 1x1 pixel texture on the fly for the color we need?
Or am I missing something?
Thanks for any help.