0

Problems with textures in complex OBJ files.

Anonymous 6 years ago 0
This discussion was imported from CodePlex

_ViSoR_ wrote at 2011-11-02 00:47:

Hello,

 

I have model that is a composition of 17 parts. Each part uses same material with texture. This model is stored as .OBJ file and looks fine in the 3D Studio Max, but Helix renders it with incorrect positions and scallings of the textures.

Helix 2011.7 and 2010.10 produce same result.

3D Studio Max: http://i.imgur.com/lfDUf.png

Helix 3D: http://i.imgur.com/UyPOO.png

Texture: http://i.imgur.com/W2SSP.jpg

Matherial description file: http://pastie.org/2796173 

 

What can I do for correct rendering? Same behavior if model is saved as .3DS file. Model is about 8MB and can't be imported by Expression Blend - it crashes on import.

 

Thanks,

Vladimir


objo wrote at 2011-11-02 19:58:

hi Vladimir, can you also upload the .obj file?


_ViSoR_ wrote at 2011-11-02 20:11:

Hi,

It is link to the full package http://dl.dropbox.com/u/11097641/roomba_625.zip

 

Vladimir


objo wrote at 2011-11-03 23:11:

thanks, I see there is an error in the handling of texture coordinates here. I didn't find the bug yet, the texture coordinates (only flipped in Y direction) looks correct. Does anyone know how texture coordinates are scaled in obj files? It seems like some files have texture coordinates in ranges like [-5,5], when I expected [0,1]...

ps. MeshLab is great for testing these files!


bcblanka wrote at 2012-02-28 14:51:

Hi objo,

 

I think this bug is caused by the viewport unit of the image brush applied on the material. http://msdn.microsoft.com/en-us/library/system.windows.media.tilebrush.viewportunits.aspx

Here is the change I made in the code to make this OBJ model display correctly: ObjReader.cs, line 798

var textureBrush = new ImageBrush(img) { Opacity = this.Dissolved, ViewportUnits = BrushMappingMode.Absolute };

I have tested this fix on a few OBJ models and they are displayed correctly.

 

PS: Do you know already what is the date of the next stable release?

 

Cheers,

Blanka


bcblanka wrote at 2012-02-29 11:49:

I found some OBJ files where the BrushMappingMode.Absolute is breaking the texture, so this fix is not quite right. Those OBJ models have texture coordinates outside the 0-1 interval.


objo wrote at 2012-03-10 16:36:

thanks for the ViewportUnits fix - I submit it even if you have seen errors when the texture coordinates are outside [0,1]. It seems to work well on the roomba model. We should make some simple test .obj files with different variations on texture coordinates.

release plan: No, there is no release schedule since this is a side project without deadlines :) But I try to keep the default branch as stable as possible so you can always use the latest version. The Nuget package is updated at every build. The downloads are updated manually, when some bugs have been fixed or major features have been added. But I will try to make a roadmap for the project, listing some ideas of what could be added/improved...


objo wrote at 2012-03-11 20:36:

See change set f96d75e7d15a. Adding TileMode = TileMode.Tile to the ImageBrush seems to help. I also added three texture test models - they are all working now.