How to get texture filename using rendering API
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2012-12-17
02:11 AM
- last edited on
‎2023-08-02
03:29 PM
by
Doreena Deng
‎2012-12-17
02:11 AM
Hi
I am using the Rendering Dev Kit, and wish to obtain the texturemap FILENAME for a give material. Does anyone know how to do this for a given GSModeler::Polygon?
Also, I have been trying to use ACAPI_Goodies (APIAny_GetTextureCoordID, &texCoordPars, &uvCoord, NULL) to get UV coordinates (using the standard dev kit, not the rendering dev kit), however the call always return an invalid index error - even with valid bodyIdx, elemIdx and pgonIndex). Is this a bug - or am I doing it wrong? Code is :
I am using the Rendering Dev Kit, and wish to obtain the texturemap FILENAME for a give material. Does anyone know how to do this for a given GSModeler::Polygon?
Also, I have been trying to use ACAPI_Goodies (APIAny_GetTextureCoordID, &texCoordPars, &uvCoord, NULL) to get UV coordinates (using the standard dev kit, not the rendering dev kit), however the call always return an invalid index error - even with valid bodyIdx, elemIdx and pgonIndex). Is this a bug - or am I doing it wrong? Code is :
// Get the UVs for vert1 API_TexCoordPars texCoordPars; API_UVCoord uvCoord; texCoordPars.bodyIdx = iBody; texCoordPars.elemIdx = elementId; texCoordPars.pgonIndex = iPoly; texCoordPars.surfacePoint.x = comp3D.vert.x; texCoordPars.surfacePoint.y = comp3D.vert.y; texCoordPars.surfacePoint.z = comp3D.vert.z; err = ACAPI_Goodies (APIAny_GetTextureCoordID, &texCoordPars, &uvCoord, NULL);Thanks in advance.
Labels:
- Labels:
-
Add-On (C++)
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2012-12-17 11:30 AM
‎2012-12-17
11:30 AM
paulk wrote:I haven't used the Rendering kit, but I'm not certain that you can get anything beyond the texture
I am using the Rendering Dev Kit, and wish to obtain the texturemap FILENAME for a give material. Does anyone know how to do this for a given GSModeler::Polygon?
paulk wrote:Try using the ModelAccess API instead. I haven't tested
Also, I have been trying to use ACAPI_Goodies (APIAny_GetTextureCoordID, &texCoordPars, &uvCoord, NULL) to get UV coordinates
Ralph Wessel BArch
Central Innovation
Central Innovation
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2012-12-17 10:11 PM
‎2012-12-17
10:11 PM
Thanks Ralph
Older API = no UV's
ModelAccess API = no texturemap filenames.
Unfortunately I need both.
Also - GetTextureCoordinate does not seem to work - is returns UV's well outside the 0-1 range (the v coordinates always seems to be the same as the vertex x coords that was input).
Paul
Retrieve the GSModeler::Texture for the material and call its GetName method.This only gives me the texture name (like "concrete"). I need the source filename (ie. directoryname + concrete.jpg).
Try using the ModelAccess API instead. I haven't tested APIAny_GetTextureCoordID, but the GetTextureCoordinate method of the GSModeler::Polygon class does the trick.If I use the ModelAccess API instead - then I cannot get the full filename of the texturemaps.
Older API = no UV's
ModelAccess API = no texturemap filenames.
Unfortunately I need both.
Also - GetTextureCoordinate does not seem to work - is returns UV's well outside the 0-1 range (the v coordinates always seems to be the same as the vertex x coords that was input).
Paul
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2012-12-18 06:43 AM
‎2012-12-18
06:43 AM
I have largely been able to answer my own questions. For anyone else wanted to do this...
1) The can get the full path name using the GSModeler API by iterating through scene materials with ACAPI_Attribute_Get and matching the material name.
2) The uv's can be calculated, however GetTextureCoordinate is only part of the story. You need to convert the result of GetTextureCoordinate into uv coords, check the code in ExampleRenderingAddOn, specifically NewRend::GetTextureUV for how to do this.
1) The can get the full path name using the GSModeler API by iterating through scene materials with ACAPI_Attribute_Get and matching the material name.
2) The uv's can be calculated, however GetTextureCoordinate is only part of the story. You need to convert the result of GetTextureCoordinate into uv coords, check the code in ExampleRenderingAddOn, specifically NewRend::GetTextureUV for how to do this.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2012-12-18 11:30 AM
‎2012-12-18
11:30 AM
paulk wrote:That's not necessarily the same thing. For example, objects can contain embedded texture maps and create material definitions on the fly that won't be picked up by
1) The can get the full path name using the GSModeler API by iterating through scene materials with ACAPI_Attribute_Get and matching the material name.
Ralph Wessel BArch
Central Innovation
Central Innovation