Textured 3D

(This forum has been closed. Please use the General Moho Discussion forum.)

Moderators: Víctor Paredes, slowtiger

Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Textured 3D

Post by Barliesque »

Will 3D objects eventually support textures? If they already do, then I must be doing something wrong...
User avatar
Lost Marble
Site Admin
Posts: 2354
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

They support textures right now. You can't apply or change a texture in Moho, but if your imported OBJ file has texture maps included, Moho will use them.
Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Post by Barliesque »

Hmmm... I can't seem to get it to show textures. No matter what I do, the resulting model appears all black.

Does the .obj loader look for an mtl file for material info?

What image file types are supported? I doubt that's it, though---I've tried bmp, jpg and png.

I can e-mail you my test object if you like.
User avatar
Lost Marble
Site Admin
Posts: 2354
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

Ah, if your object appears all black, that's probably because the faces are clockwise. I believe the OBJ specification says faces should be counter-clockwise, but that's obviously not always the case. Double-click the layer in Moho after you've imported it to bring up the Layer Settings dialog, and go to the 3D Options tab. Switch from counter-clockwise to clockwise, or vice versa.

Yes, the OBJ loader is looking for an mtl file. The image type can be JPEG, BMP, PNG, or TGA.
Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Post by Barliesque »

I tried that too. The result goes from all black to all white.

3D file formats always seem to cause problems for applications, and this looks very clearly like some applications are saving the format a little differently than Moho is expecting.

I've saved the same model with two different applications: 3D Exploration and UnWrap3D, both of which have been fairly reliable in situations like this. Both files load correctly in both apps, but not in Moho. Wings3D also loses track of the texture image.

Have a look...
http://www.barliesque.com/misc/3D_egg.zip


Off the subject: Is texture alpha supported for transparency?

Also off the subject: Since OBJ files can contain normal data, why not use normals to determine face orientation if they do exist in the model?
Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Post by Barliesque »

Well, the texture is at least showing up now, but it looks like UV values are messed up. Here's how the model should look, and how it appears in Moho 5b3.

Image
Armaani
Posts: 17
Joined: Fri Aug 06, 2004 1:01 pm

Post by Armaani »

A tip for Carrara users on the Mac:

Be sure to name your shaders in Carrara with the extension appropriate to the texture file format before you export to Wavefront (OBJ). For example, if your shader is called "Texture1" in Carrara, and the texture map is a jpg file, rename the shader to "Texture1.jpg". Also, in the Wavefront export options, make sure that "Write File Names As:" is set to "Name Only". If you don't do these two things, you'll find that Moho won't import your textures, because of a quirk in how Carrara exports OBJ material files.


LM, I noticed some serious texture warping when you rotate the object and move the camera around it. Not a big deal for me, because I'll be using solid fills in all my 3D objects for the forseeable future, but some people might be concerned.
Courtesy of: Your Friendly Neighbourhood Armaani
Independent Storyteller, Humourist, Absurdist, and All-’Round Nice Guy
http://armaankhan.blogspot.com
User avatar
Lost Marble
Site Admin
Posts: 2354
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

Barliesque - That's really odd. I've got your 3D egg file here, and this is how it looks when I import it into Moho:

Image

I tried to re-download your egg, but the file seems to be gone. Did you make changes to the egg? If so, can I try out the new file?

Armaani - You're right about the texture warping. We're currently using a not-so-great texture mapping algorithm. If you can divide your 3D model up into smaller polygons, the problem will become less noticeable. Hopefully we can fix this before version 5 is finished.[/img]
Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Post by Barliesque »

:? That is really odd. I haven't made any changes at all. I get the same results with the U3D version as well.

I must have accidentally delteted the file from the server--I'll upload it again when I get home.

Could you send me another 3D file that loads correctly? It would be interesting to see if I have the same problem with other files as well.
User avatar
Lost Marble
Site Admin
Posts: 2354
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

Here's another textured 3D file that works fine for me here. Let me know if the texture comes out messed up on your computer:

http://www.lostmarble.com/downloads/moh ... mple3D.zip
Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Post by Barliesque »

The mystery deepens... :?


Image
Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Post by Barliesque »

Was that helpful? Let me know if you'd like me to do any testing, since this happens on my computer but not yours.

If you want to send me an alternate exe to test with, you can send it to: david@barliesque.com
User avatar
Lost Marble
Site Admin
Posts: 2354
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

I don't know - it seems like something must have changed in the file. I can't imagine how it would look so different on our two computers. The file I sent you shows that texture mapping can work on your copy of Moho - that's why I feel like something must have changed in the egg. Can you either upload it somewhere, or send it to support@lostmarble.com? Thanks.
Barliesque
Posts: 45
Joined: Sun Aug 08, 2004 10:58 am
Location: Los Angeles

Post by Barliesque »

Oh, sorry! I forgot to mention that I'd re-uploaded the egg model.

http://www.barliesque.com/misc/3D_egg.zip

The thing is, though. I definitely haven't changed anything. I just double-checked, and the results are the same.

Usually if things are different from one computer to another, it's down to graphics card drivers. I've got an NVidia FX 5800, and NVidia has had some driver problems to be sure.

My guess is that it's something to do with floating point precision in the UV data. But I can't think of any way that could happen. I haven't got an OBJ inspector to help me offer further suggestions. Obviously there must be *something* different about these files--even if the difference only shows up on my computer.
User avatar
Lost Marble
Site Admin
Posts: 2354
Joined: Tue Aug 03, 2004 6:02 pm
Location: Scotts Valley, California, USA
Contact:

Post by Lost Marble »

Now that you re-uploaded the file, I can tell you that something definitely did change. The file headers say that one was created by 3D Exploration, and one by Ultimate Unwrap3D.

In the picture below, the left egg is the file you originally uploaded. The egg on the right is the one you most recently linked to.

Image

Here's a copy of your original egg file if you want to take a look:

http://www.lostmarble.com/misc/original_egg.zip

If you look at the U3D OBJ file in a text editor, you'll see that most of the texture coordinates go beyond 1.0. I'm not sure if this is technically allowed in the OBJ file format, but we can update Moho to deal with it. Incidentally, in the X3D OBJ file you uploaded, the texture coordinates go beyond 2, so it seems like one of those programs you're using keeps adding 1 to the texture coordinate. This could start to be a bad thing if you keep working on the same file for a long time.

So, the summary is that yes, the egg file did in fact change, and we'll update Moho to deal with it.
Locked