R: [Plib-devel] 3DS loader bug?
Brought to you by:
sjbaker
From: Paolo L. <p.l...@ci...> - 2000-07-12 13:08:31
|
Scott McMillan wrote: > > I am not sure what you are saying. Are you saying the scale is > swapped but the offset is not? In other words, is the code as > written in version 1.2.0 correct: > > parse_uscale goes to element [1] > but parse_uoffst goes to element [0] > > etc....? I personally don't have the capability of generating > 3ds models to test this aspect. > Premise: Max (like, perhaps, the older 3DStudio) conceptually separates UVW Mapping (per object) and transformations on the texture image (per material). The former implicitly modifies object texture coordinates, while the latter goes as explicit uv scale and offset values among the material params - these are the values we are talking about. In particular, scale is the Tiling value within the Max Material Editor user interface (the default 1.0 value is not written in the 3DS file, so the need of an initialization at the end of the file!). Back to our problem, I *never* had occasion to apply an offset to a (material) texture, yet normally put offset to objects' UVW mapping. Just now I did a test on texture uv-offset and experienced that the right Max -> SSG mapping can be obtained by negating the u-offset, i.e. in the source static int parse_uoffst( char **p, unsigned int length ) { texture_offst[ num_materials - 1 ][0] = -get((float*)*p); <<== ! return PARSE_OK; } static int parse_voffst( char **p, unsigned int length ) { texture_offst[ num_materials - 1 ][1] = get((float*)*p); return PARSE_OK; } so, for answering to your question, as to my datasets: - u-scale goes to index 1 - u-offset goes to index 0, but with the opposite sign. Scale/offset on object UV-mapping does correctly work since is directly managed by Max. I'll do some further tests on this, but I would like to hear some other experience on this. Per and I should then converge to a new version of the 3DS loader. ---------------------------------------------------------------------------- - Paolo Leoncini phone: +39 (0823) 623134 Scientific Visualization Group fax: +39 (0823) 623126 CIRA - Italian Center for Aerospace Researches p.l...@ci... Via Maiorise - 81043 Capua (CE) Italy www.cira.it/research/vis |