VRML Import has incorrect texture coordinates
Closed, ResolvedPublic

Description

Duplicates: T32621

When specifying texture coordinates using just a coordIndex array the values are off by 1. If you specify them using a texCoordIndex array things are fine.

box_1_texcoord.wrl and box_1_coord.wrl should both render the same. They don't in the current blender. When using the coordIndex only the index values need to be subtracted by one. I couldn't track down why they differ I suspect something starts indexes by 1 someplace instead of 0. The fix I propose is to check do_uvmap and change indexing schemes. I also tested with no texture coordinate provides such that locally they are generated and those came out right with the proposed fix as well.

Checked the patch and (fuv[j] - 1) will be a negative number in some cases, could you provide a textured mesh which displays properly in a VRML2 viewer but not in blender? - testing with 3 triangles isn't really enough to validate a fix.

giles7777 (Alan Hudson) added a comment.Via Old WorldSep 21 2012, 6:12 PM

The small example was just to easily show the problem. All textured models that provide explicit texture coordinates but don't provide texCoordIndex show the problem. I'll attach a more complete example.

giles7777 (Alan Hudson) added a comment.Via Old WorldSep 21 2012, 6:22 PM

Every time I try to add attachments to this existing ticket it gives me a "Missing Parameters" error. Not sure why. I'm going to create a new ticket with the new test case. If you know what my issue is tell me so I can avoid creating extra tickets in the future.

giles7777 (Alan Hudson) added a comment.Via Old WorldSep 21 2012, 6:27 PM

I created a new ticket 32621 with the requested test file. I can make plenty more but they all come down to not having a texCoordIndex field but providing texture coordinate values.

Moving files from duplicated report to original one. That's easier this way.

Alan, next time please use pasteall.org, dropbox or download.blender.org/ftp/incoming to share files instead of opening new tickets in cases you've got uploading issues -- that's easier to keep a track on bugs.

Campbell, could you please check the files? :)

fixed r3793.

campbellbarton (Campbell Barton) closed this task as "Resolved".Via Old WorldSep 28 2012, 6:42 AM

Add Comment