Stride Forums Archive

How to create a Xenko.Rendering.Material programmatically?

3 posts, 1406 views, 2019-08-14 to 2020-05-01

Subrahmanya_Chakrava (O.S.Chakravarthi) 2019-08-14 #1

Hi,

I am trying to create a Xenko.Rendering.Material programmatically. I need to load am image file too as DiffuseTexture.

How can I build it?

Thanks in advance.

tonfilm 2019-08-15 #2

i think a material is only an object tree, so start with the top level class and fill all properties and options. it should be a 1 to 1 translation from the material properties in game studio…

david_j (David J) 2020-05-01 #3

For the next person who stumbles upon this forum post looking for an answer…

https://doc.xenko.com/latest/en/manual/scripts/create-a-model-from-code.html

And here is a project sample that runtime loads a wavefront OBJ file, including textures.