Q: texturing OBJ files

Started by Sp34k, July 06, 2009, 12:26:08 PM

Previous topic - Next topic

Sp34k

Hey Folks

I've been doing some researching here on the forum about texturing OBJ files, I found some topics related to my question but I didn't really find the answer that I was looking for, so ill try to make a topic myself..
Now, I have a obj file I would like to use in my scene, but when I import it into TG2 and render the scene, the object shows up BLACK.. I haven't used OBJ files before so Im not sure how to texture them, I cant do as I do with TGO files..

In this Topic: http://forums.planetside.co.uk/index.php?topic=5850.0 bobbystahr explains:

Quote4. If that is not available go to Create new shader and choose one to work with, ie:
   a Colour Shader, a Default Shader or in fact a Multi shader but as there would be no
   assignments at this point it would be pointless. You'd have to texture it first in an app that textures .obj
   first to give the Multi shader something to show.

Now which software can texture OBJ files? - This is all a really confusing:)
I have uploaded a small preview to show the messing texture here:




Cheers,
Mike
Learning history and science, wait,
Knowing that, will that put food on my plate?
Yeah, can I walk into McDonald's, into the counter,
And tell them you can make limestone from gunpowder,
Will they give me a cheeseburger if I know that shit?

jaf

You might want to look at PoseRay (http://mysite.verizon.net/sfg0000/).  This free application has a nice model preview and many tools to fix normals, etc.  You can check your materials and there's a tool to find missing image maps.  You can also set various material attributes there too, and of course export.

Don't be misled by the POV references (though it's great for working with the POV renderer).  It is very useful in fixing problems with normals.

I use Lightwave which PoseRay also supports so I can input a lwo file without converting (to obj) and check it out.  Then I export in PoseRay as an obj.  PoseRay will also export all the material support files to the chosen (export) directory.
(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

Sp34k

Hey jaf

Thank you for your reply! I have just downloaded it. So far I think I have managed to put some textures on, we'll see:P But thank you so very much for sharing these informations, I have heard about RoseRay before but I didn't really know what it was used to, so thanks for clearing that out for me:)

This will come on handy:) Thanks buddy,
Mike
Learning history and science, wait,
Knowing that, will that put food on my plate?
Yeah, can I walk into McDonald's, into the counter,
And tell them you can make limestone from gunpowder,
Will they give me a cheeseburger if I know that shit?

Sp34k

I might be doing this the wrong way, but to texture a OBJ file, I do this:

1. Open PoseRay
2. Load my OBJ file
3. Go to "Materials"
4. Select the parts on the left
5. Confused here.. Which of the 3 options should I choose?
   5a. Pigment
   5b. Bump map
   5c. Transparency Map or Specular/Finish map

I can see in the preview imagne that some texture are on my object but when I Explort the obj file and open it in TG2, it's just black/Grey, is there anyhing I have missed?

Cheers,
Mike
Learning history and science, wait,
Knowing that, will that put food on my plate?
Yeah, can I walk into McDonald's, into the counter,
And tell them you can make limestone from gunpowder,
Will they give me a cheeseburger if I know that shit?

buzzzzz1

Check the diffuse color, it may be set to black, if so set it to .5 (Med. grey) then test render the dark area again.

As far as poseray you can load the texture maps in the top section. if you have bump maps for your image maps they go into the center section.
alpha or opacity images go in the bottom section.

Be warned, even though you apply all your textures/image maps correctly in Poseray and save the object you will still need to reload the bump maps and opacity maps once the object is loaded into TG as TG won't read the mtl file properly. If you are having problems figuring out what goes where once loaded into TG you can open the mtl file in notepad to see where things go. Especially helpful if the object has lots of textures.

Also your building looks like it may have some textures loaded by looks of the porch brown color and this might just be a lighting problem. Have you loaded your object into a default sceen, zoomed in and test rendered to check the textures?  Also, below is a little guide from Harvey Birdman for using Poseray which ma also shed some light for you.

1) Download the plant and unzip the stuff into a new directory.

2) Open the png textures in an image editor which does not show any blocky artifacts around the leaf edges. (If you see them you'll know what I mean; if you don't, don't worry about it.) Create separate 24-bit .bmp or .jpg images for the leaf color and alpha maps. If the bark .png image is 24 bit (I think a couple were 32 bit) it can probably be used as is, otherwise convert it to a 24-bit .bmp or .jpg image. Place these textures in the same directory as the original obj.

3) Load the original obj into PoseRay. Examine the 'Material's and 'Groups' lists. I like to have at least a 1:1 relationship between groups and materials. If there isn't, select the 'Materials' tab and click the 'Rearrange' button. Select 'Groups->Materials'. Click 'OK' when asked if you're sure. (Some models have less than a 1:1 ratio, some have more. The Silver Maple, in particular, has separate material groups set up for different groups of branches.)

4)Select Materials/UV. Set remap method to Cylindrical, Z axis = 1, X and Y = 0. Check 'Weld UV Coordinates'. Select the trunk group and click 'Update'. Repeat for level 1, 2 and 3 branches, as applicable (Some groups may already have valid coordinates. Alternatively, you could skip texture coordinates on the smaller branch groups (the highest numbered groups), and assign a diffuse color to the material. This will result in a smaller final .obj.) The leaves should already have UV coordinates - don't disturb these.

5) Select the 'Basic texture properties' tab. For the 'leaf' material, select the color and alpha maps you created at the beginning as the pigment and transparency maps. Uncheck the 'metallic' checkbox. For the trunk and branch groups, select the bark texture as the pigment and bump maps, and set the bump size to .01. Uncheck the 'metallic' checkbox. (You may also want to assign diffuse colors to the leaves and bark groups. This can optionally be done later, in TG2.) After modifying all the materials, click 'Update'.

6) Select 'Groups'. Click 'Options' and make sure 'Reset camera...' is checked.  If the object has Z as the up axis (it probably is), check the 'Flip Y-Z Axis' button. Check 'Weld vertices', then uncheck 'Calculate Normals'. Click 'Update'.

7) Select the 'Obj Output' tab. Make sure 'Save Normals' and 'Save texture coordinates' checkboxes are checked, but not the other two. Enter the desired name into the 'Modified obj file' textbox, then click 'Save'. Make sure the 'Include file paths...' and 'Copy all maps...' are unchecked. (The textures should already be in the same directory, right?) Click 'OK'. (Make sure the name you give the new obj doesn't have any spaces in it. TG2 may not like spaces in the names.)

8 ) Import the obj into TG2, selecting 'NO' when asked if the object is from XFrog. you will have to re-specify the alpha texture for the leaves and the bump (now displacement) texture for the bark. Render the tree beside a 1-meter radius sphere. (Set the sphere location so it's sitting on the ground beside the tree.) Note any scaling discrepancy. At this point you have two options. You can either re-scale the tree every time you use it, or you can go back to PoseRay, scale it there and re-export it. To re-scale it once, open the new modified obj in PoseRay. Select the 'Groups' tab. MAKE SURE NO CHECKBOXES ARE CHECKED, AND THAT 'NO AXIS FLIP' IS SELECTED. Enter the desired scaling factors in the appropriate textboxes and click 'Update'. Re-export the obj. Import it into TG2 again (again re-specifying the alpha and displacement textures), and this time set the multishader and component shader names to something more appropriate than the defaults. Export the obj into a tgo and you should be all set.

Note, line 1 and 2
XFX 750i SLI  nFORCE Mobo
Intel Core2 Duo E8400 3.00 GHz Wolfdale
8 Gig Corsair DDR2 6400
Nvidia GForce 9600 GSO 768 MB
XP Pro 64 bit OS

Henry Blewer

You have answered my questions also! Thank you. :)
http://flickr.com/photos/njeneb/
Forget Tuesday; It's just Monday spelled with a T

jaf

Another small tip.  PoseRay has a nice integration with the POV renderer (Persistence of Vision) which is also free at:  www.povray.org/

POV is not an easy program to master, but with PoseRay, you can prepare your model as buzzzzz1 explained and also choose to save and render to the POV app.  POV will open and render your model.  This might be desirable for a couple reasons.  First, the render is quite quick and second. you get a good idea of how your model shapes up.  You can then do the obj export or go back and fix obvious problems with the mesh or materials.  This may save a lot of time verses doing a lot of TG setup when the model has problems.

I've found I can build some bad models in Lightwave but some don't look that bad until exposed (rendered) in other programs.  That's what I like about PoseRay and POV.

(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