3d - Monogame imported Blender .FBX unaffected by lighting -
i upgraded old monogame project latest version of monogame. running used to, however, imported .fbx models appearing pure black (implying they're not being lit up).
(the burgers+tapes made dynamically using quads @ runtime. affected lighting should be).
my code (which worked in older versions of monogame) displaying model follows:
public override void draw() { foreach (modelmesh mesh in model.meshes) { foreach (basiceffect effect in mesh.effects) { effect.world = matrix.createrotationz(rotx); effect.world *= matrix.createrotationx(roty); effect.world *= matrix.createtranslation(new vector3(pos.x, pos.y, 0f)); effect.view = maingame.matrixview; effect.projection = maingame.matrixproj; effect.textureenabled = true; effect.texture = tex; effect.enabledefaultlighting(); effect.ambientlightcolor = new vector3(0.2f, 0.2f, 0.2f); effect.emissivecolor = new vector3(1, 0, 0); } mesh.draw(); } }
the models exporteed blender fbx 7.4 binary (the project doesn't compile if use fbx 6.1 ascii).
thanks in advance. hope it's not silly i've overlooked.
i having same issue last week. i'm thinking problem blender's binary fbx exporter textures aren't being exported or referenced in *.fbx file properly. i'm assuming because built ascii version in xna , referenced compiled *.xnb file in monogame version of game , render's properly. fix i've been using is:
export ascii , build in xna first
it's not cleanest way it, until fbx exporter get's patched it's needed.
reference *.xnb file in monogame
reference compiled xnb files , set 'build action' 'copy'. remember you'll need reference built texture files well.
hope clears up.
Comments
Post a Comment