HELP: Object import errors

Started by jritchie777, October 04, 2009, 01:19:04 AM

Previous topic - Next topic

jritchie777

I'm trying to import a wavefront object into a scene in T2 and keep getting the error -

trImage : Cannot locate file /Maps/filename.jpg

Yet when I go to the path, the file does exist and is properly named.  I also tried to copy the file in the same dir as the object - still get the error.  I've checked the file for corruption and it is fine so I am at a loss why I am getting an error...

Does anyone know what I might be doing wrong?

Thanks in advance for the help!!
JR

Klas

Edit the .mtl: replace /Maps/filename.jpg with Maps/filename.jpg

jritchie777

That worked!!  Thanks.  I'm not an expert in T2 by any means, but being a 20 year veteran programmer I'm thinking this might be a slight bug...

Anyway easy enough to fix with a quick edit - thanks again!!
JR

jaf

Again, this is a good place to mention the free Poseray program.  I think it's a great companion program for TG2.

One feature I like is the materials tools.  After loading your model, may get a warning about missing maps.  This is normal if you store the image maps in a different folder from where the object is located.

So now you can click on the Materials tab and get a list of all the models named surfaces.  There's a button labled "Tools..." and one of the options is "Find all missing maps."  Selecting that option gives you a Map Search dialog where you can add paths to where your images are stored.  Then, clicking "Find" should result in a "0 warnings" if everything is found.

The "Groups" tab lets you recalculate normals, remove orphaned vertices, etc.  Many options here that can come in handy.

Then there's the OBJ output tab where you actually set up the export of your model to your TG2 scene folder.  One option is "fix material and group names."  Click on "Export..." and there you can choose the option "Copy all maps to the same directory."  I usually choose this because I think it simplifies things -- you have all your TG2 scene files, including object and maps, in one folder.  There's also an option to "Fix map max resolution to xxx".  If you wish to keep the largest maps to the original size, set this value to the largest size.  The aspect is maintained and no smaller maps are resized (to the value you entered.) The maps are stored as jpg.

There's also a POV-Ray Output tab which I've found to be handy to get a quick render of what you've loaded and set up in Poseray.  It's much better seeing obvious problems with your model in a quick POV render than a long TG2 render. Of course you need to have the free POV-Ray renderer installed.  Once you set the path to POV in Poseray, you can then do a "Save and render..."

Anyway, I think Poseray is a great way to prepare models for TG2.
(04Dec20) Ryzen 1800x, 970 EVO 1TB M.2 SSD, Corsair Vengeance 64GB DDR4 3200 Mem,  EVGA GeForce GTX 1080 Ti FTW3 Graphics 457.51 (04Dec20), Win 10 Pro x64, Terragen Pro 4.5.43 Frontier, BenchMark 0:10:02

rcallicotte

Agreed.


Quote from: jaf on October 04, 2009, 11:59:41 AM

Anyway, I think Poseray is a great way to prepare models for TG2.

So this is Disney World.  Can we live here?

Henry Blewer

I have been having good results using Blender. The tutorial on Importing Blender objects is nearly complete (minus images). I am still having difficultly with Blender Units and making them work in the real world units which Terragen 2 uses. Blender does not include or use real size data. Even if something is modeled with 10 Blender units equaling a meter, it does not translate. When I have this worked out, I'll post the tutorial. When the images are ready, I'll put both into the Wiki.
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

Klas

If the model has smooth normals like some car models then blender is not a good choice for modifying the model. The importer does not read the vn's and the smoothing is lost.

Henry Blewer

Actually Blender does export the smoothing information. I explained how to export out of Blender here.

http://forums.planetside.co.uk/index.php?topic=7567.0
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

scyweb

Have to confess, I was a little bit down on Blender a few weeks ago.  But after struggling (which means, fighting, with some screaming and cussing thrown in) and some helpful guidance from others,  I'm coming to appreciate its capabilities. I can do quite a bit more than I previously thought. So I'm probably going to stay with it as my primary modeling software for now.  Even though I'm a blender noob, I've made some decent models and rendered them in Terragen 2. Not bad for a free program. :)

P.S. Would still like to see that tutorial when it's done.

Klas

Quote from: njeneb on October 05, 2009, 05:05:34 PM
Actually Blender does export the smoothing information.
But it does not import the vn's. The car in front is imported in blender then exported. (download: http://gfx-3d-model.blogspot.com/2009/06/dodge-charger-3d-model.html).
The code from the importer script:
elif line.startswith('vn '):
pass

elif...

Henry Blewer

I see what you are talking about. If you import models/objects from other 3D apps., it is necessary to go through the model and re-create the smoothed normals. Sometimes the parts which share vertices have to be cloned. The old vertices have to be selected and deleted, EXCEPT for the vertices where the smoothed normals adjoined the non smoothed normals. This prevents the smoothing from bleeding over onto the non smoothed area.
It is a lot of work. I do my own modeling, so for me it is not an issue. This may be rectified by an update of the Blender import script at some point.
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

Matt

Quote from: jritchie777 on October 04, 2009, 03:30:08 AM
That worked!!  Thanks.  I'm not an expert in T2 by any means, but being a 20 year veteran programmer I'm thinking this might be a slight bug...

If the filename starts with a forward slash, Terragen interprets this as an absolute path, not a relative path. I don't consider that a bug, but there is a case for searching as a relative path if the absolute path fails to find a file.

Matt
Just because milk is white doesn't mean that clouds are made of milk.

Klas

#12
I think this is a bug in DAZ Studio.
If you export something from DS there is the slash, but if you import the object back in DS then all images are gone, DS can not find them.

D.A. Bentley (SuddenPlanet)

One thing I just figured out with paths is when using relative paths you have a couple of different starting points depending on what your pathing too.
For example most of the time you can relative path based off of the location of your TGD file like this:

C:\Terragen_Scenes\test_scene.tgd
C:\Terragen_Scenes\Project_Assets\Masks\mask_001.png

Within Terragen you could use the path "Project_Assets\Masks\mask_001.png" leaving off the "C:\Terragen_Scenes" which will allow you to move your project anywhere.

The problem I discovered is when using imported objects that reference image maps.

C:\Terragen_Scenes\test_scene.tgd
C:\Terragen_Scenes\Project_Assets\ColorMap\colormap_001.png
C:\Terragen_Scenes\Project_Assets\Objects\Trees\object_001.obj
C:\Terragen_Scenes\Project_Assets\Objects\Trees\object_001.mtl

In this case the OBJ is the starting point for the relative path, so the path to the colormap_001.png would look like this:
"..\..\..\Project_Assets\ColorMap\colormap_001.png"

Since the OBJ Object file is the starting point we have to step backwards three directories (Trees --> Objects --> Project_Assets) before stepping forward into the "Project_Assets\ColorMap\" directory.

Before I figured this out it was driving me crazy, because I would get missing file errors on scene loading with strange paths like this:

"Project_Assets\Objects\Trees\Project_Assets\ColorMap\colormap_001.png"

NOTE:  this assumes there are no paths in your MTL file if you are using an MTL along with your OBJ.  I always strip my paths in any mtl files used so just the file name alone remains in the mtl file.

I hope this helps someone.  The key to know is you can use the double period slash (..\) to reference a directory up the path tree, and knowing the starting point of the relative path is a must.  I only know of the two reference points mentioned above, so if there are more maybe Matt or Oshyan can let us know.


-Derek

D.A. Bentley (SuddenPlanet)

Although I have found it easier just to have my obj, mtl, and texture maps all in the same directory.  ;)

-Derek