Polygon::HasMaterialTexture vs Polygon::HasPolygonTexture vs MeshBody::GetTexture()
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-07-01
03:30 AM
- last edited on
2021-09-14
09:29 AM
by
Noemi Balogh
2021-07-01
03:30 AM
Hi.
It seems there are different ways of getting textures while iterating through the mesh bodies of an element.
There's:
- MeshBody::GetTexture( &texture );
- MeshBody::GetMaterial( &material ); material.HasTexture() and then material.GetTexture( &texture )
- MeshBody::GetPolygon(ipolygon, &polygon); polygon.HasPolygonTexture(); polygon.GetTexture( &texture );
- MeshBody::GetPolygon(ipolygon, &polygon); polygon.HasMaterialTexture(); polygon.GetTexture( &texture );
So....
- Is it guaranteed that a mesh body will have only a single texture?
- Is there a possibility that a polygon in a mesh body gets overridden with texture other than the one of the mesh body?
- What's the difference between Polygon::HasPolygonTexture() and Polygon::HasMaterialTexture() ?
Thanks!
It seems there are different ways of getting textures while iterating through the mesh bodies of an element.
There's:
- MeshBody::GetTexture( &texture );
- MeshBody::GetMaterial( &material ); material.HasTexture() and then material.GetTexture( &texture )
- MeshBody::GetPolygon(ipolygon, &polygon); polygon.HasPolygonTexture(); polygon.GetTexture( &texture );
- MeshBody::GetPolygon(ipolygon, &polygon); polygon.HasMaterialTexture(); polygon.GetTexture( &texture );
So....
- Is it guaranteed that a mesh body will have only a single texture?
- Is there a possibility that a polygon in a mesh body gets overridden with texture other than the one of the mesh body?
- What's the difference between Polygon::HasPolygonTexture() and Polygon::HasMaterialTexture() ?
Thanks!
Labels:
- Labels:
-
Add-On (C++)
4 REPLIES 4

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-07-02 11:34 AM
2021-07-02
11:34 AM
That's a tricky one. Basically Modeler API returns the parameters used by the OpenGL rendering engine. It means every polygon can have at most 1 texture.
The texture and the material is assigned to polygons and not meshes, so there can be different materials and textures in one mesh body.
There are two ways to assign textures to a polygon:
The texture and the material is assigned to polygons and not meshes, so there can be different materials and textures in one mesh body.
There are two ways to assign textures to a polygon:
- The polygon refers to a material that refers to a texture. This is the case in 99% of the time. In this case it's the best if you access texture from the material.
- The polygon refers to a texture directly. This case can be detected by the HasPolygonTexture call. In this case the texture doesn't come from the material, but directly assigned to the polygon.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-07-05 05:06 AM
2021-07-05
05:06 AM
Thanks for the clarification.
So then, I should interpret the HasPolygonTexture to mean that the polygon still uses the material, but overrides the texture portion of the material?
So then, I should interpret the HasPolygonTexture to mean that the polygon still uses the material, but overrides the texture portion of the material?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-07-05 05:20 AM
2021-07-05
05:20 AM
Viktor wrote:So, what approach would you suggest I use if I want to obtain the non-basic material/texture properties, in order to do better than the standard OpenGL properties?
Basically Modeler API returns the parameters used by the OpenGL rendering engine. It means every polygon can have at most 1 texture.
Right now with that single texture of the basic renderer, I can generate a normal map from alpha intensity (or from rgb intensity if alpha is uniform or not present), Premultiplied RGB and RGBA maps, in order to simulate the alpha transparency effects of the basic renderer. The net effect actually looks pretty decent, if I may say so, and with my rendering model I'm not sure how much I would actually gain by reading those c4d properties, unless they are much higher resolution vs the stock textures.
Is there a way to easily enumerate the C4D rendering properties? Do all objects/materials suppport C4D rendering and properties?

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2021-07-06 11:52 AM
2021-07-06
11:52 AM
drjustice wrote:Yes, that's right.
Thanks for the clarification.
So then, I should interpret the HasPolygonTexture to mean that the polygon still uses the material, but overrides the texture portion of the material?