Textures Issue when loading obj with mtl file

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.
Post Reply
GabinMD
Posts: 8
Joined: Sat Jun 10, 2017 6:29 pm

Textures Issue when loading obj with mtl file

Post by GabinMD »

Hello,

I'm a beginner in irrlicht but i'm wanting to load and obj with a mtl file who load 5 textures.

but i have an issue with the render of the obj, in fact the textures is reversed ..

i realy don't understand why because i'm using the same command line of the irrilcht exemple to load the obj

i gave you 2 picture :
http://imgur.com/2LMizWY
http://imgur.com/cmwyxlY
the first one is abrove the obj and the second one is below.
i need to display the floor texture abrove the obj... it's working perfectly in blender

sorry for my bad english

Can you help me?
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Textures Issue when loading obj with mtl file

Post by CuteAlien »

Can't tell much without having the model for testing. But try experimenting with the exporter settings in Blender. You have to make sure "Inlude UV's" is enabled. Also mabye try to switch the Forward setting (not sure right now if it's ok for Irrlicht by default or wrong way around).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
GabinMD
Posts: 8
Joined: Sat Jun 10, 2017 6:29 pm

Re: Textures Issue when loading obj with mtl file

Post by GabinMD »

thanks for your answer

the include UV's was enabled

I tried forward in all directions but without success

this is a link to the obj, Could you try to load it?
https://mega.nz/#F!rRtRTRxa!gZx46Z6kX9YeqoDzDE7CAg
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Textures Issue when loading obj with mtl file

Post by CuteAlien »

Ah - I think I understood you wrong. Your textures are not reversed but displayed on the wrong side of the polygon? You have to fix the normals (or disable backface culling in SMaterial, but you should fix the normal). Your normals for the landscape have to point upwards. If that doesn't help you have to enable normal export additionally in Blender.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
GabinMD
Posts: 8
Joined: Sat Jun 10, 2017 6:29 pm

Re: Textures Issue when loading obj with mtl file

Post by GabinMD »

thanks for your answer

Yes the textures are displayed on the wrong side of the polygon
i tried to fix the normals, i recalculate them and make them consistent but nothing changed..
can you try to fix the normals ? i don't understand what i'm doing wrong

thanks in advance
kornwaretm
Competition winner
Posts: 189
Joined: Tue Oct 16, 2007 3:53 am
Location: Indonesia
Contact:

Re: Textures Issue when loading obj with mtl file

Post by kornwaretm »

i'm pretty sure blender's obj exporter is okay. one thing to note though, in blender normals are calculated from the object's origin ( the orange dot inside the object) if the floor or any flat surface that is not forming any volume is recalculated. The direction from origin to triangle or quad will becomes the reference (if not forming volume). easier way to check is to press 'N' in blender (3d view mode) to toggle property panel, find shading tab, check "backface culling" set it on. this way you can easily confirm you model normal directions. then select any wrong normal, and flip. to flip normal, make sure your editing tool is visible (press T to toggle editing tool) -> shading tab -> shading -> Normals -> flip normal. some times there is no automatic way.

from irrlicht side you can disable backface culling. this is not ideal though, since this cause the hidden faces will also get drawn (it depends on what you need).

Code: Select all

 
// pay attention on which material to manipulate
youNode->getMaterial(0).BackfaceCulling = false;
 
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Textures Issue when loading obj with mtl file

Post by CuteAlien »

You can also set "triangulate faces" to true on export. It might possibly also affect normals as non-triangulated polygons are triangulated inside Irrlicht and maybe that's when things go wrong. At least it won't hurt (except slightly larger file-size).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply