Procedural Material with Descriptor Initialization -Help?


Being new to Xenko, I’m having quite the time trying to perform seemingly simple tasks from code… all of the ‘documentation’ seems to be either outdated (referencing old versions), or only provides information pertaining to visual manipulation via instances created using the studio.

I am attempting to generate a simple model from code and apply a semi-transparent material. Nothing I have tried seems to work. I either get a non-transparent render, or nothing at all (depending on how I improperly attempt to apply materials).

I can’t seem to figure out how to correctly apply a loaded material to a model and apply a transparent descriptor at the same time…

Hopefully this code will explain what I’m trying to accomplish:

myModel.Materials.Add(new MaterialInstance(Content.Load<Material>("Materials/MatteBlack"))
	Material =
		Descriptor = new MaterialDescriptor
			Attributes =
				Transparency = new MaterialTransparencyBlendFeature
					Enabled = true,
					Alpha = new ComputeFloat(0.6f),
					Tint = new ComputeColor(Color.White)
				CullMode = CullMode.Front


I have been able to apply a new material in code without transparency using this approach though I don’t have access to source at the moment. Are you able to apply the material without the transparent descriptor/layer?

Also, when I’ve worked with transparent layers on materials in the studio I’ve had to change the Blend Mode (That may not be the correct property name - its the drop down box item) the default one does not render for me. Could you also need to make this adjustment in code?

Hopefully this can be of some service, if not, do you hang out in the Xenko discord?



I think I got it working… but it doesn’t seem to like using procedurally generated materials on top of procedural models with primitive meshes?
I have only gotten it to work when generating a model using prefabs