Problems with textures in complex OBJ files.

Nov 2, 2011 at 12:47 AM

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

Coordinator
Nov 2, 2011 at 7:58 PM

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

Nov 2, 2011 at 8:11 PM

Hi,

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

 

Vladimir

Coordinator
Nov 3, 2011 at 11:11 PM

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!

Feb 28, 2012 at 2:51 PM

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

Feb 29, 2012 at 11:49 AM

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.

Coordinator
Mar 10, 2012 at 4:36 PM

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...

Coordinator
Mar 11, 2012 at 8:36 PM

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.