OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Unable to load texture in the same folder as the scene file


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins]
View previous topic :: View next topic  
Author Message
EonStrife
Newbie


Joined: 27 Oct 2016
Posts: 12

PostPosted: Mon Nov 27, 2017 2:37 am    Post subject:
Unable to load texture in the same folder as the scene file
Reply with quote

Hi,
I have an fbx file (authored) using Maya, which is using two textures, table-cloth-2.jpg and table-cloth-3.jpg. Just say, now the files in this folder

E:\Data\3D Models\Watercolor\fruits-uvs\scenes - JPG\
- table-cloth-2.jpg
- table-cloth-3.jpg
- simple.fbx

With both textures are linked to the materials in the simple.fbx.

Just say, I create another variant of simple.fbx with different texture format, I will be using png format instead of jpeg format for table-cloth-3.jpg, but I do not modify link to table-cloth-2.jpg. So, now we have the second folder :

E:\Data\3D Models\Watercolor\fruits-uvs\scenes - PNG\
- table-cloth-2.jpg
- table-cloth-3.png
- simple.fbx

I then rename or remove the "E:\Data\3D Models\Watercolor\fruits-uvs\scenes - JPG\" folder to simulate opening it in other PC.

When I loadethe "E:\Data\3D Models\Watercolor\fruits-uvs\scenes - PNG\simple.fbx" into my osg application, the application is unable to load "table-cloth-2.jpg" even though the texture is located in the same folder as the simple.fbx.

I then do some checking. Inside the ReaderWriterJPEG.cpp, I put breakpoint at :

Code:
virtual ReadResult readImage(const std::string& file, const osgDB::ReaderWriter::Options* options) const


I see that it makes three attempts to load the texture, with the value of file parameter :

1st try : E:\Data\3D Models\Watercolor\fruits-uvs\scenes - PNG\E:/Data/3D Models/Watercolor/fruits-uvs/scenes - JPG/table-cloth-2.jpg

2nd try: E:/Data/3D Models/Watercolor/fruits-uvs/scenes - JPG/table-cloth-2.jpg

3rd try: E:\Data\3D Models\Watercolor\fruits-uvs\scenes - PNG\..\scenes - JPG\table-cloth-2.jpg

After that it gives up, and it doesn't try to check in the "scenes - PNG" folder.

I attach and also upload the scene file to dropbox, in case you want to try it :

https://www.dropbox.com/s/vnm4mji0jxes4g3/scenes%20-%20PNG.rar?dl=0

Extra information:
- Compiler : VC++ 2013 SP5
- Debug x64
- OSG version 3.5.6 (osg148-*.dll, /osgPlugins-3.5.6)
- FBX SDK 2017.0.1 (possibly)
- The plugins are copied to the correct folders (osgdb_jpegd.dll, osgdb_pngd.dll, and osgdb_fbxd.dll are in "osgPlugins-3.5.6" foder, and libpng16d.dll is in my application root folder).

Thanks.

...

Thank you!

Cheers,
Eon
Back to top
View user's profile Send private message
EonStrife
Newbie


Joined: 27 Oct 2016
Posts: 12

PostPosted: Tue Nov 28, 2017 1:31 am    Post subject:
Reply with quote

My deepest apology, I just realized I accidentally made double posting after I received the daily email newsletter. I believe it was because yesterday I received an error when I posted the original message, thinking that it was not posted, so I re-posted a new one.
Back to top
View user's profile Send private message
a.terenzi (Alessandro Terenzi)
Appreciator


Joined: 03 Sep 2009
Posts: 250

PostPosted: Fri Jan 19, 2018 10:49 am    Post subject:
Reply with quote

Hi,
if you open the FBX file with a text editor you will see that, for each texture, the corresponding path is stored to refer to the absolute path in your computer file system... try to modify those paths by removing all the paths components but the filename of the texture (if you want the textures to be in the same folder as the .fbx file).

You could also try to export the binary variant of the FBX file instead of ASCII, in that case be sure to check the embed media option in order to include the textures inside the FBX file itself.

Cheers,
Alessandro
Back to top
View user's profile Send private message
EonStrife
Newbie


Joined: 27 Oct 2016
Posts: 12

PostPosted: Mon Jan 22, 2018 2:23 am    Post subject:
Reply with quote

Thank you, terenzi Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> Plugins [osgPlugins] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Minor change proposal : Blacklist usa... mp3butcher General 1 Mon Aug 13, 2018 1:42 pm View latest post
No new posts Load an obj file and mapping a given ... aaa3d General 3 Mon Aug 06, 2018 2:27 pm View latest post
No new posts osgconv osgjs bug file not found memory_thrasher Plugins [osgPlugins] 0 Tue Jul 31, 2018 5:21 pm View latest post
No new posts Load OSG trimesh to ODE: Read Vertice... TKoller General 2 Fri Jul 20, 2018 3:06 pm View latest post
No new posts Model(s) load ~10 times longer in 3.6... davisjamesf General 16 Wed Jul 04, 2018 7:18 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP