Create Materials and Texture coordinates
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 14/03/2008 at 09:23, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 10.5
Platform: Windows ;
Language(s) : C++ ;---------
Hello,I am currently working on an import filter for our generic 3D format. Importing the actual mesh data works fine so far. However I am stuck at importing our materials and assigning the correct texture coordinates.
I have two questions:
-
How do I set the texture filename of the color_channel of a material?
-
How do I set the uv coordinates for the polygon mesh? I know how to create a texture tag and attach this tag to the object, but I can't find out how to add the uv coordinates?
Any help would be appreciated.
Regards,
Mark -
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/03/2008 at 08:10, xxxxxxxx wrote:
You set the path for textures through the BaseChannel's container.
>
\> BaseMaterial \*mat = NULL; \> mat = doc->GetFirstMaterial(); \> if(!mat) return TRUE; \> \> BaseChannel \*color = mat->GetChannel(CHANNEL_COLOR); \> if(!color) return TRUE; \> \> BaseContainer data = color->GetData(); \> data.SetString(BASECHANNEL_TEXTURE, "my_texture.jpg"); \> data.SetFilename(BASECHANNEL_SUGGESTEDFOLDER, "C:\ extures"); \> color->SetData(data); \> \> mat->Message(MSG_UPDATE); \>
You have to create an UVW tag for the polygon object. It contains as much UVW structures as the object has polygons. The UVWStruct contains four vectors, one for each point per polygon.
>
\> UVWTag \*uvw = NULL; \> uvw = UVWTag::Alloc(op->GetPolygonCount()); \> if(!uvw) return FALSE; \> \> op->InsertTag(uvw, NULL); \> \> op->Message(MSG_UPDATE); \>
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 18/03/2008 at 13:28, xxxxxxxx wrote:
Hello Matthias,
thank you very much. This is exactly what I was looking for.
As a possible suggestion for a future SDK: Putting a slightly more complex IMPORT/EXPORT C++ sample plugin (maybe for 3DS format) into the SDK would reduce the number of questions in this forum and will tremendously increase the steepness of the learning curve.