Normal mapping

May 23, 2013 at 12:19 AM
Models can have a normal map in the engine. The only way it seems to work is to use the xml loader. But is there an easy way to pass a normal map to a model in code? Without complex plugins and stuff?
Something like myDeferredNormalShader.normalMap = "/content/normalmap";

Thanks!
Emile
Coordinator
May 23, 2013 at 12:45 AM
yes, there are some.
are you using our latest version from here http://ploobs.com.br/?page_id=1395 ?

if yes, just the method setTexture with the right texture type parameter and also use the DeferredCustomShader (passing yes in the bump parameter constructor)


Thiago Dias Pastor


May 23, 2013 at 3:29 AM
Hmm, sounds good but I got this error: "The current vertex declaration does not include all the elements required by the current vertex shader. Tangent0 is missing."
So i tried to make a CustomModel, but I can not fill in all the parameters :s (ObjectInformation[0] is always an empty reference)

How can I let ploobs now how to fill in the TANGENT0 semantic?
SimpleModel sm_Vieuw = new SimpleModel(factory, "Model/aWorkingFbxModel", bumpTextureName: "Level_Files/tex/floor1a_NM");
IObject obj2 = new IObject(new DeferredMaterial(new DeferredCustomShader(false, true, false, false)), sm_Vieuw, triangleMesh);
(the version of the engine I use is pretty recent, like two months)
Coordinator
May 23, 2013 at 3:33 AM
you need to tell the xna to generate this for you.
in the standard model processor you can set this option (called Generate Tangent Frames) --- just left click on the model file and properties

Thiago Dias Pastor


May 23, 2013 at 3:40 AM
Thanks man, it works!
Obrigado! :D