Normalmaps look rubbish

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Normalmaps look rubbish

Post by Asimov »

Hi all,

I have used normalmaps with 3ds max, Unity, CryEngine, mudbox and marmoset so obviously I want to use them in my game.
However in irrlicht they look rubbish. They just look flat and don't seem to work. I am using an obj file that I created for another game.

Basically I haven't had time to make a dog, and car etc for my monopoly game and I am using a hand grenade as a temporary replacement.
My game pieces will need normalmaps to get the detail I need on a low poly model.

Bear in mind I have removed the diffuse map to show only the normalmap.

Is there anyway to enhance normalmaps in irrlicht.

The pictures attached. Left no normalmap in max, middle grenade with normalmap, and right normalmap added in irrlicht.
Image
juanjpro
Posts: 12
Joined: Mon Nov 24, 2014 12:54 pm

Re: Normalmaps look rubbish

Post by juanjpro »

Does it look better if you move the camera closer to it? It might be mipmapping that's fading out the details of your normal map.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Normalmaps look rubbish

Post by Asimov »

Hi Juan,

Unfortunately the answer is no. I set up a 3rd camera just to see it close heh heh, and not it still looks utter rubbish.
Image
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Normalmaps look rubbish

Post by mongoose7 »

Maybe you could post the normal map?
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Normalmaps look rubbish

Post by The_Glitch »

Are you using Irrlicht default materials?

I can honestly say Irrlicht did seem to have normal mapping issue's in the past but I believe they have been worked out, no to sure though.

Also is your grenade one mesh. For example the pin didn't get split into another mesh buffer and the grenade body it's own separate meh buffer?

I had issue's in the past were I was applying one normal map material to my objects thinking it was one whole mesh, turn's out it looked terrible because my model once in Irrlicht was
split unto 2 or even 3 mesh buffers.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Normalmaps look rubbish

Post by mongoose7 »

Actually, it looks as if the normal map is working, but your model is too big to notice it. Either scale your model dowm or increase the message type param.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Normalmaps look rubbish

Post by Asimov »

Hi mongoose,

I will post the normalmap when I get home, but the normalmap should not depend on the size of the model.
I have used normalmaps in many engines, and so far this is the first time I have had a problem with them.
I can see why you said that, as yes in the above picture it looks like the normalmap is working but at a very low setting.

In 3ds max all normalmaps are set at a height of 100, but I don't think there is a setting for this in irrlicht.

This grenade isn't actually going to be in this game actually, but I am using it to test the normalmaps in irrlicht, and obviously there is a problem somewhere heh heh.

I am not sure what the message type param is? Is this something in the mtl file?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Normalmaps look rubbish

Post by mongoose7 »

Look in Smaterial.h. So, you never had a problem in a modeller before, and now you are having trouble in a renderer. Looks like you have strayed in to the deep, dark woods.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Normalmaps look rubbish

Post by Asimov »

Hi mongoose,

Here is my normalmap. This one was baked in 3ds max, but sometimes I use mudbox for baking normalmaps also.
So, you never had a problem in a modeller before, and now you are having trouble in a renderer. Looks like you have strayed in to the deep, dark woods.
I have built 3d models and normalmaps for use in game engines such as Unity, CryEngine and a few others, but not had this much trouble getting a normalmap to view properly.
Sometimes you have to swap the red and green colours in the maps if you transfer from max to Maya, but that is the only trouble I have ever had.

http://www.asimoventerprises.co.uk/foru ... de_nrm.tga

Had to link this instead of showing it as an image, because for some reason it didn't show up.
juanjpro
Posts: 12
Joined: Mon Nov 24, 2014 12:54 pm

Re: Normalmaps look rubbish

Post by juanjpro »

Could you share the diffuse texture and code related to the grenade as well? The screenshot has several details that aren't defined in the normal map.
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Normalmaps look rubbish

Post by Asimov »

Hi juanjpro,

I have purposely not put on the diffuse texture, so that you can just see the normalmap.
All the detail you see on the handgrenade is done by the normalmap.

I have a video of the wireframe that I made to show off the normalmap on vimeo ages ago.
http://vimeo.com/38296780

I have a meshloading class
and I call the code with

Code: Select all

LoadMesh grenade;
grenade.loadPiece(smgr,driver,L"data/grenade/grenade.obj");
grenade.nodePosition(0,79.3f,22);
and here is the function in my class which loads the mesh, sets up the mesh node, and creates the camera node

Code: Select all

void LoadMesh::loadPiece(ISceneManager* smgr,IVideoDriver* driver,const wchar_t* modelname)
{
    mesh = smgr->getMesh(modelname);
    node = smgr->addMeshSceneNode(mesh);
    if (node)
    {
        node->setMaterialFlag(EMF_LIGHTING, true);
        node->setPosition(core::vector3df(0,0,0));
        node->addShadowVolumeSceneNode();
        camera = smgr->addCameraSceneNode(node,vector3df(0, 10, 5));
        camera->bindTargetAndRotation(true);
        camera->setTarget(node->getPosition());
    }
}
 
void LoadMesh::nodePosition(float x,float y,float z)
{
    node->setPosition(vector3df(x,y,z));
}
 
Please ignore the camera code. That is there because I will be adding a camera to every piece so that when it is moving you will get a closeup of the piece in action.

I will use an array of the class later when I get all the pieces in the game.
I didn't think you wanted all my code, but this is the important code that loads my mesh.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Normalmaps look rubbish

Post by mongoose7 »

Nice normal map. However, Irrlicht is expecting a *bump* map, like it says in the MTL file. Do you have a bump map? (Or you could change the Irrlicht source so that makeNormalMap is not called.)
Asimov
Posts: 246
Joined: Thu Dec 04, 2014 7:41 pm
Contact:

Re: Normalmaps look rubbish

Post by Asimov »

Hi mongoose
Nice normal map. However, Irrlicht is expecting a *bump* map, like it says in the MTL file. Do you have a bump map? (Or you could change the Irrlicht source so that makeNormalMap is not called.)
In 3ds max I exported the obj with a mesh, a diffuse map and a normalmap.

Unfortunately a bumpmap will not cut it in todays games. Bumpmaps in games have not been used for years. However normapmaps have replaced them.
Bumpmaps are just a grey monochromatic grey scale which simulates light in one direction, however a normalmap simulates light in 3d space.

My model will look rubbish with a bumpmap applied, however a normalmap should look good and is used in all games now.

In Unity game engine they call normalmaps bumpmaps, but that is not really the case. As you cannot actually use a bumpmap in Unity game engine. The just called a normalmap a bumpmap.

The mtl file is auto generated by 3d max on export of the obj, so if it is wrong, then how do I change it so that it loads in the normalmap?
A game engine that does not use normalmaps would be prehistoric.
juanjpro
Posts: 12
Joined: Mon Nov 24, 2014 12:54 pm

Re: Normalmaps look rubbish

Post by juanjpro »

So you don't load the normal map directly, instead it's referenced by the .obj file? Maybe the textures aren't ordered the way Irrlicht expects, try applying the textures manually:

Code: Select all

node->getMaterial(0).setTexture(0,diffuse); //give the model a diffuse texture, otherwise you'll see garbage
node->getMaterial(0).setTexture(1,normalmap); //normal map must be texture index 1
Last edited by juanjpro on Tue Jan 06, 2015 4:42 pm, edited 1 time in total.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: Normalmaps look rubbish

Post by mongoose7 »

You need to get all the materials. The OBJ loader sets the 'Name' field in the material so you can find a specific material. Then you can set the normal map. Although, if you use the release version of Irrlicht, this will not work because the normal map has been modified. You will need to load the normal map under a different name. Or you can use the 'trunk' version from SVN. (I thought it was fixed here but I can't see it in the code, so maybe it isn't fixed.)
Post Reply