ModelMeshPart.Effect


Hi guys something i am not understanding about model mesh part effect. As this returns null.

Just intending to get a little terrain system up and running to mess around with how it can all go. You know.

Any guidance here will be fantastic.

It does state it is depreciated and will be removed, this method of specifying i am hoping it is not related. that is coming from new ModelMeshPart() specification;

ModelMeshPart · microsoft/DirectXTK Wiki · GitHub
Here is an interesting resource on the topic.

Still not sure what i am doing wrong but maybe i’ll work it out.


On a side note

NormalMapEffect · microsoft/DirectXTK Wiki · GitHub

effect.CurrentTechnique.Equals(“NormalMapEffect”);

seems to work. But there is no way to define the normal texture. My original normals just cheated the norms and they aren’t technically normals. But seems this effect is valid, that is the dx11 has it rendering. But yeah, not able to use those parameters. Its like a vending machine with no cash. I think i am just at a point i have nobody to turn to and can’t obtain the correct education on things. I am thinking about, maybe you should do it too, Going to a job interview and just paying the guy 2000 bucks to stick me on payroll for 1 year and show some lenience. Its a good idea i think with the way companies work nowadays, the guy doing the interview walks home with 2 grand, immediately, and just slip me on the payroll.
Using the modern internet for stuff is starting to feel a little futile.

MonoGame is not built on top of the DirectX Tool Kit. There are a lot of similarities in the code as some of the same staff at Microsoft were involved in developing XNA and DirectXTK, but they’re not the same. For MonoGame normal mapping (or bump mapping) will require a custom shader.

I would recommend working through Riemer Grootjans’ 2D & 3D Tutorials to learn more (originally for XNA and ported to MonoGame by Simon “Darkside” Jackson):

In particular once you get to this chapter you’ll be able to render terrain with normals:

I would add;
My guess is, when you set the Effect, it tries to do this (inside Set):
foreach (var part in parent.MeshParts)
but if the part has no parent assigned (ie: null), it’ll give you null ref exception.
So probably you’ll need to make sure a parent is set (like parent to ModelMesh for all ModelMeshParts) and then you could set the effect after.