THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 13/12/2007 at 02:39, xxxxxxxx wrote:
Did you ever get this figured out? I'm getting ready to look into these functions for my Riptide .obj import/export plugin. I haven't actually written any code yet, but maybe the following thoughts will help clear up some things...
In my case, the issue I'm trying to resolve is not in producing new bitmap texture files, but instead it is producing the proper "Texture Tag - modified uv-mapping". To get an idea of what I'm talking about, try this:
1. in a new scene, add a Cube primitive object and make it editable (making it editable will create a UVW Tag on it, with default Cubic mapping).
2. create a new Material, using some recognizable bitmap texture in the Color channel.
3. drag the Material onto the Cube in the Object Manager to create a Texture Tag.
...at this point, with the Texture Tag selected, note that it has options that modify how the Material gets mapped onto the cube - Offset X/Y, Length X/Y, Tiles X/Y - these settings are applied on top of the UVW Mapping...
4. with the Projection still set to UVW Mapping, change the Tiles X value to 10 (or Length X to 10% - same thing).
5. switch to BodyPaint UV Edit mode, where you can see the mapping.
6. alternately, click on the Texture Tag and then the UVW Tag and view the differences.
...note how the uv-mapping (in the UVW Tag) gets stretched along the X/U axis by the Texture Tag (which is tiling it 10 times). If you were to export this mesh to an .obj file using C4D's built-in exporter, the resulting uv-mapping will be the combined affect of the UVW Tag, modified by the Texture Tag settings. Currently, my Riptide plugin only looks at the UVW Tag, so any Texture Tag adjustments get discarded.
So, moving on...
7. back in the modeller, select the Texture Tag and change the Projection from UVW Mapping to Cylindrical.
8. activate the Texture Tool.
9. activate the Rotation Tool and rotate the texture around some (note - the Rotation, Scaling and Translation tools don't have any affect on the UVW Mapping projection, but they do on other projection types).
10. with the Projection still set to Cylindrical, switch back to the UV Editor and click back and forth on the Texture Tag and the UVW Tag.
...note that the uv-mapping (in the UVW Tag) is still set as a standard Cubic mapping (but currently being ignored by the editor/renderer), but when you are looking at the modified (Texture Tag) mapping, it's stretched, rotated and Cylindrically mapped.
Again, exporting with the built-in .obj exporter would result in the Cylindrical mapping which is currently active, but my Riptide exporter just outputs the UVW Tag data, so you get incorrect results.
So, obviously, the built-in exporter is 'baking' the uv-mapping, based on the Projection type, as well as any other Texture Tag settings, modified by the current texture matrix (rotation, scaling and translation if the Projection is set to something besides UVW Mapping).
Of particular note, relative to your situation is...
- the Texture Tag settings (Offset X/Y, Length X/Y, Tiles X/Y, etc) can/do affect UVW Mapping projection.
- you're only baking if it's set to UVW Mapping and...
- you're passing a NULL pointer for the result UVs (?)
...I'm thinking that the result UVs pointer needs to be a valid/allocated UVW Tag to hold the baked uv-mapping results - regardless of Projection type - because those other Texture Tag settings can modify them. So maybe the error code you're getting is actually due to InitBakeTexture() not getting things set up correctly for BakeTexture() ?
I realize that my situation/goal is different than yours, but I hope my ramblings can help :).