Developer forum
cancel
Showing results for 
Search instead for 
Did you mean: 

Polygon::HasMaterialTexture vs Polygon::HasPolygonTexture vs MeshBody::GetTexture()

drjustice
Newcomer
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!
4 REPLIES 4

Viktor Kovacs
Graphisoft
Graphisoft
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 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.
To test the second case use the Carpet object from the Library.

drjustice
Newcomer
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?

drjustice
Newcomer
Viktor wrote:
Basically Modeler API returns the parameters used by the OpenGL rendering engine. It means every polygon can have at most 1 texture.
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?

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?

Viktor Kovacs
Graphisoft
Graphisoft
drjustice wrote:
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?
Yes, that's right.

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!