Message 1 of 2
Mesh texturing?

Not applicable
01-20-2012
08:46 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everybody,
For a study project, I have to create a plugin which loads a mesh (OBJ), and change the texture image file (which is stored on the disk, PNG files) several times, in relation with the current time in the timeline.
But my problem is, how to apply a texture to a mesh?
I know I have to do several steps :
- Create a blinn shader,
- Get the "surfaceShader" attribute from my mesh,
- Connect the Blinn "outColor" attribute to the Mesh "surfaceShader" attribute,
- Create a file node,
- Set the file node "fileTextureName" attribute to the image path,
- And connect the file node "outColor" attribute to the Blinn "color" attribute.
But I don't know how to do this with the API (C++ for my project).
First problem :
When I do the first connection (material outColor -> mesh surfaceShader), the MDGModifier::connect function returns MStatus::kSuccess, but when I call the MDGModifier::doIt (just after), it returns kFailure.
And second problem:
How to create a file node?
Thanks a lot for your attention!
Romuuu
For a study project, I have to create a plugin which loads a mesh (OBJ), and change the texture image file (which is stored on the disk, PNG files) several times, in relation with the current time in the timeline.
But my problem is, how to apply a texture to a mesh?
I know I have to do several steps :
- Create a blinn shader,
- Get the "surfaceShader" attribute from my mesh,
- Connect the Blinn "outColor" attribute to the Mesh "surfaceShader" attribute,
- Create a file node,
- Set the file node "fileTextureName" attribute to the image path,
- And connect the file node "outColor" attribute to the Blinn "color" attribute.
But I don't know how to do this with the API (C++ for my project).
First problem :
When I do the first connection (material outColor -> mesh surfaceShader), the MDGModifier::connect function returns MStatus::kSuccess, but when I call the MDGModifier::doIt (just after), it returns kFailure.
And second problem:
How to create a file node?
Thanks a lot for your attention!
Romuuu