Skip to content

class MappingImageSettings

Settings for the Simplygon mapping classes These settings control the properties of the mapping image that will be generated in the current simplification processor (reducer/remesher etc). The mapping image will be used when casting a new texture on the simplified geometry. In the settings object, the user is able to set the dimensions of the image (width/height) as well as whether the LOD should have new texture coordinates and some parameters for how they should be generated and all other settings regarding the mapping image.

Properties

PropertyDescription
AllowTransparencyMappingIf true, the remeshing processor will allow mapped transparency in the generated mapping image. This allows material casting where gaps filled by the remeshing processor will be cast as transparent.
ApplyNewMaterialIdsIf true, and also generating one or more mapping images for material casting, the material IDs in the process geometry will be updated to reflect the new, not yet cast output materials. This means the output scene will be temporarily invalid before the materialtable has been updated to reflect the new changes.
AutomaticTextureSizeMultiplierTexture dimension length multiplier for the automatic texture size.
ForcePower2TextureIf automatic_texture_size is enabled, then force the texture sizes to be a power of 2.
GenerateMappingImageIf set, the aggregation processor, reduction processor, or remeshing processor will create a mapping image that maps triangles on the reduced geometry back to triangles on the original geometry. The texture is insert into the MappingImage object. The image data will contain two fields: * RidArray, "TriangleIds", TupleSize:1, The id of the triangle * UnsignedShortArray, "BarycentricCoords", TupleSize:2, Items A & B of the barycentric coordinate on the triangle. The user can control the size of the mapped texture using the values MappingTextureWidth and MappingTextureHeight.
GenerateTangentsIf true, generates a new tangent space fields at position specified by TexCoordLevel, based on the vertex normals and texture coordinates. Tangent space fields will always be created if missing, and GenerateMappingImage is enabled. If GenerateTexCoords is enabled, new tangents will always be generated.
GenerateTexCoordsIf true, generates a new texcoords field at the position specified by TexCoordLevel. Will be ignored and always generate texcoords if none are available in the Geometry if GenerateMappingImage is enabled.
InputMaterialCountThe number of input materials used in the original geometry for mapping to multiple output materials. This needs to be set before you can set any specific in-out material mapping. 0 signifies that no in-out material mapping is used, ie. the process will produce one resulting mapping image.
MaximumLayersThe maximum number of layers in the mapping image. If a remeshed geometry has a lot of transparent triangles, use a higher number to be able to find intersections on the inside of parts of the geometry. This setting only has effect in the remeshing, when running reduction the number of layers is always 1.
NameThe name of the MappingImageSettings object. (Inherited from Object)
OnlyParameterizeInvalidUVsIf enabled, will aggregate all the valid original UVs. If there are invalid original UVs, those parts will receive new parameterized UVs.
OutputMaterialCountThe number of output mapping images that are to be generated. If this is set to more than 1, the material mapping also needs to be set.
ReplaceMappingImagesWhether to replace already existing mapping images in the scene.
TexCoordGeneratorTypeDetermines which method to use when generating the texture coordinates. Parameterizer generate from scratch based on the geometry. ChartAggregator generate based on the original texture coordinates.
TexCoordLevelThe texture coordinate level used for mapping image and texture generation. If the TexCoordName has been set, the TexCoordLevel is not used.
TexCoordNameThe texture coordinate level name used for mapping image and texture generation. If new UVs are created, they will replace the old coordinates in the texture channel with the TexCoordName. If no texture level with this name exists. It will be created. If the TexCoordName is not set, the TexCoordLevel (index) will be used instead.
UseAutomaticTextureSizeThe UseAutomaticTextureSize flag. If true, then texture sizes will be computed for the reduced mesh depending on its pixel size on screen.
UseFullRetexturingIf set, all original texcoord sets are replaced by a single new one which will be used for the mapping image. This means the output scene will be temporarily invalid before the materialtable has been updated to reflect the new changes. This flag has no effect on the remeshing, which always does a full retexturing.

Methods

MethodDescription
AddObserverAdds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)
GetBoolParameterGet a named parameter boolean value. (Inherited from SettingsObject)
GetChartAggregatorSettingsThe settings for the chart aggregator.
GetClassGet the name of the MappingImageSettings class. (Inherited from Object)
GetDoubleParameterGet a named parameter floating point value. (Inherited from SettingsObject)
GetErrorStringReturns a string describing the error that was found the last time ValidateSettings was performed. (Inherited from SettingsObject)
GetInputMaterialSettingsGet the input material settings for the given index.
GetIntParameterGet a named parameter integer value. (Inherited from SettingsObject)
GetOutputMaterialSettingsGet the output material settings for the given index.
GetParameterizerSettingsThe settings for the parameterizer.
GetStringParameterGet a named parameter string value. (Inherited from SettingsObject)
GetUIntParameterGet a named parameter unsigned integer value. (Inherited from SettingsObject)
IsAReturns true if MappingImageSettings is a or is a descendant of the class named as the type parameter. (Inherited from Object)
IsNullReturns true if the MappingImageSettings object is invalid. (Inherited from Object)
IsSameObjectAsReturns true if the MappingImageSettings object is valid. (Inherited from Object)
NonNullReturns true if the MappingImageSettings object is valid. (Inherited from Object)
PrintInfoPrints the content/info of the MappingImageSettings object to the log. (Inherited from Object)
RemoveObserverRemoves a previously added observer object. (Inherited from Object)
SetBoolParameterSet a named parameter boolean value. (Inherited from SettingsObject)
SetDoubleParameterSet a named parameter floating point value. (Inherited from SettingsObject)
SetIntParameterSet a named parameter integer value. (Inherited from SettingsObject)
SetStringParameterSet a named parameter string value. (Inherited from SettingsObject)
SetUIntParameterSet a named parameter unsigned integer value. (Inherited from SettingsObject)
SetValidateParameterNamesSet if parameter names should be validated or not. Parameters that previously do not exist will generate and error if validation is enabled and be allowed if validation is disabled. (Inherited from SettingsObject)
ToJSONGet settings as JSON for debugging purposes. (Inherited from SettingsObject)
ValidateSettingsValidates the current settings values. (Inherited from SettingsObject)

Static methods

MethodDescription
IsClassAReturns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)
SafeCastSafeCast makes sure the input object is of a class that can be cast into spMappingImageSettings, and if this is the case, returns the object cast into spMappingImageSettings. (Inherited from Object)

Properties details

AllowTransparencyMapping

If true, the remeshing processor will allow mapped transparency in the generated mapping image. This allows material casting where gaps filled by the remeshing processor will be cast as transparent.

Syntax

cpp
// Setter
void SetAllowTransparencyMapping( bool value ) const;

// Getter
bool GetAllowTransparencyMapping() const;

SetAllowTransparencyMapping parameters

TypeNameMinMaxDescription
boolvalueThe desired value of AllowTransparencyMapping.

GetAllowTransparencyMapping return value

Type: bool

Default: false

ApplyNewMaterialIds

If true, and also generating one or more mapping images for material casting, the material IDs in the process geometry will be updated to reflect the new, not yet cast output materials. This means the output scene will be temporarily invalid before the materialtable has been updated to reflect the new changes.

Syntax

cpp
// Setter
void SetApplyNewMaterialIds( bool value ) const;

// Getter
bool GetApplyNewMaterialIds() const;

SetApplyNewMaterialIds parameters

TypeNameMinMaxDescription
boolvalueThe desired ApplyNewMaterialIds flag.

GetApplyNewMaterialIds return value

Type: bool

Default: true

AutomaticTextureSizeMultiplier

Texture dimension length multiplier for the automatic texture size.

Syntax

cpp
// Setter
void SetAutomaticTextureSizeMultiplier( real value ) const;

// Getter
real GetAutomaticTextureSizeMultiplier() const;

SetAutomaticTextureSizeMultiplier parameters

TypeNameMinMaxDescription
realvalue0REAL_MAXThe desired multiplier.

GetAutomaticTextureSizeMultiplier return value

Type: real

Default: 1.0

ForcePower2Texture

If automatic_texture_size is enabled, then force the texture sizes to be a power of 2.

Syntax

cpp
// Setter
void SetForcePower2Texture( bool value ) const;

// Getter
bool GetForcePower2Texture() const;

SetForcePower2Texture parameters

TypeNameMinMaxDescription
boolvalueThe desired flag.

GetForcePower2Texture return value

Type: bool

Default: false

GenerateMappingImage

If set, the aggregation processor, reduction processor, or remeshing processor will create a mapping image that maps triangles on the reduced geometry back to triangles on the original geometry. The texture is insert into the MappingImage object. The image data will contain two fields: * RidArray, "TriangleIds", TupleSize:1, The id of the triangle * UnsignedShortArray, "BarycentricCoords", TupleSize:2, Items A & B of the barycentric coordinate on the triangle. The user can control the size of the mapped texture using the values MappingTextureWidth and MappingTextureHeight.

Syntax

cpp
// Setter
void SetGenerateMappingImage( bool value ) const;

// Getter
bool GetGenerateMappingImage() const;

SetGenerateMappingImage parameters

TypeNameMinMaxDescription
boolvalueThe desired GenerateMappingImage flag.

GetGenerateMappingImage return value

Type: bool

Default: false

GenerateTangents

If true, generates a new tangent space fields at position specified by TexCoordLevel, based on the vertex normals and texture coordinates. Tangent space fields will always be created if missing, and GenerateMappingImage is enabled. If GenerateTexCoords is enabled, new tangents will always be generated.

Syntax

cpp
// Setter
void SetGenerateTangents( bool value ) const;

// Getter
bool GetGenerateTangents() const;

SetGenerateTangents parameters

TypeNameMinMaxDescription
boolvalueThe desired GenerateTangents flag.

GetGenerateTangents return value

Type: bool

Default: false

GenerateTexCoords

If true, generates a new texcoords field at the position specified by TexCoordLevel. Will be ignored and always generate texcoords if none are available in the Geometry if GenerateMappingImage is enabled.

Syntax

cpp
// Setter
void SetGenerateTexCoords( bool value ) const;

// Getter
bool GetGenerateTexCoords() const;

SetGenerateTexCoords parameters

TypeNameMinMaxDescription
boolvalueThe desired GenerateTexCoords flag.

GetGenerateTexCoords return value

Type: bool

Default: false

InputMaterialCount

The number of input materials used in the original geometry for mapping to multiple output materials. This needs to be set before you can set any specific in-out material mapping. 0 signifies that no in-out material mapping is used, ie. the process will produce one resulting mapping image.

Syntax

cpp
// Setter
void SetInputMaterialCount( unsigned int value ) const;

// Getter
unsigned int GetInputMaterialCount() const;

SetInputMaterialCount parameters

TypeNameMinMaxDescription
unsigned intvalue0SG_MAXIMUM_MAPPING_IMAGE_INPUT_MATERIAL_COUNTThe number of inputs.

GetInputMaterialCount return value

Type: unsigned int

Default: 0

MaximumLayers

The maximum number of layers in the mapping image. If a remeshed geometry has a lot of transparent triangles, use a higher number to be able to find intersections on the inside of parts of the geometry. This setting only has effect in the remeshing, when running reduction the number of layers is always 1.

Syntax

cpp
// Setter
void SetMaximumLayers( unsigned int value ) const;

// Getter
unsigned int GetMaximumLayers() const;

SetMaximumLayers parameters

TypeNameMinMaxDescription
unsigned intvalue0UINT_MAXThe desired number of layers in the mapping image.

GetMaximumLayers return value

Type: unsigned int

Default: 3

Name

The name of the MappingImageSettings object. (Inherited from Object)

Syntax

cpp
// Setter
void SetName( const char * name ) const;

// Getter
spString GetName() const;

SetName parameters

TypeNameMinMaxDescription
const char *nameNew name of the object.

GetName return value

Type: spString

OnlyParameterizeInvalidUVs

If enabled, will aggregate all the valid original UVs. If there are invalid original UVs, those parts will receive new parameterized UVs.

Syntax

cpp
// Setter
void SetOnlyParameterizeInvalidUVs( bool value ) const;

// Getter
bool GetOnlyParameterizeInvalidUVs() const;

SetOnlyParameterizeInvalidUVs parameters

TypeNameMinMaxDescription
boolvalueThe new flag.

GetOnlyParameterizeInvalidUVs return value

Type: bool

Default: false

OutputMaterialCount

The number of output mapping images that are to be generated. If this is set to more than 1, the material mapping also needs to be set.

Syntax

cpp
// Setter
void SetOutputMaterialCount( unsigned int value ) const;

// Getter
unsigned int GetOutputMaterialCount() const;

SetOutputMaterialCount parameters

TypeNameMinMaxDescription
unsigned intvalue1SG_MAXIMUM_MAPPING_IMAGE_OUTPUT_MATERIAL_COUNTThe number of outputs.

GetOutputMaterialCount return value

Type: unsigned int

Default: 1

ReplaceMappingImages

Whether to replace already existing mapping images in the scene.

Syntax

cpp
// Setter
void SetReplaceMappingImages( bool value ) const;

// Getter
bool GetReplaceMappingImages() const;

SetReplaceMappingImages parameters

TypeNameMinMaxDescription
boolvalueThe new value.

GetReplaceMappingImages return value

Type: bool

Default: true

TexCoordGeneratorType

Determines which method to use when generating the texture coordinates. Parameterizer generate from scratch based on the geometry. ChartAggregator generate based on the original texture coordinates.

Syntax

cpp
// Setter
void SetTexCoordGeneratorType( Simplygon::ETexcoordGeneratorType value ) const;

// Getter
Simplygon::ETexcoordGeneratorType GetTexCoordGeneratorType() const;

SetTexCoordGeneratorType parameters

TypeNameMinMaxDescription
ETexcoordGeneratorTypevalueThe TexCoordGeneratorType value to use.

GetTexCoordGeneratorType return value

Type: ETexcoordGeneratorType

Default: Parameterizer

KeyValueComment
Parameterizer0Texture coordinates are generated from scratch based on the geometry.
ChartAggregator1Texture coordinates are generated based on the original texture coordinates.

TexCoordLevel

The texture coordinate level used for mapping image and texture generation. If the TexCoordName has been set, the TexCoordLevel is not used.

Syntax

cpp
// Setter
void SetTexCoordLevel( rid value ) const;

// Getter
rid GetTexCoordLevel() const;

SetTexCoordLevel parameters

TypeNameMinMaxDescription
ridvalue-1INT_MAXThe desired texture coordinate level.

GetTexCoordLevel return value

Type: rid

Default: 0

TexCoordName

The texture coordinate level name used for mapping image and texture generation. If new UVs are created, they will replace the old coordinates in the texture channel with the TexCoordName. If no texture level with this name exists. It will be created. If the TexCoordName is not set, the TexCoordLevel (index) will be used instead.

Syntax

cpp
// Setter
void SetTexCoordName( const char * value ) const;

// Getter
spString GetTexCoordName() const;

SetTexCoordName parameters

TypeNameMinMaxDescription
const char *valueThe TexCoord level name.

GetTexCoordName return value

Type: spString

Default: nullptr

UseAutomaticTextureSize

The UseAutomaticTextureSize flag. If true, then texture sizes will be computed for the reduced mesh depending on its pixel size on screen.

Syntax

cpp
// Setter
void SetUseAutomaticTextureSize( bool value ) const;

// Getter
bool GetUseAutomaticTextureSize() const;

SetUseAutomaticTextureSize parameters

TypeNameMinMaxDescription
boolvalueThe desired flag.

GetUseAutomaticTextureSize return value

Type: bool

Default: false

UseFullRetexturing

If set, all original texcoord sets are replaced by a single new one which will be used for the mapping image. This means the output scene will be temporarily invalid before the materialtable has been updated to reflect the new changes. This flag has no effect on the remeshing, which always does a full retexturing.

Syntax

cpp
// Setter
void SetUseFullRetexturing( bool value ) const;

// Getter
bool GetUseFullRetexturing() const;

SetUseFullRetexturing parameters

TypeNameMinMaxDescription
boolvalueThe desired UseFullRetexturing flag.

GetUseFullRetexturing return value

Type: bool

Default: false

Methods details

AddObserver

Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)

Syntax

cpp
rid AddObserver( const spObserver & observer ) const;

Parameters

TypeNameMinMaxDescription
ObserverobserverObserver is the object that will receive events.

Return value

Type: rid

GetBoolParameter

Get a named parameter boolean value.

Syntax

cpp
bool GetBoolParameter( const char * name ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.

Return value

Type: bool

GetChartAggregatorSettings

The settings for the chart aggregator.

Syntax

cpp
spChartAggregatorSettings GetChartAggregatorSettings() const;

Parameters

GetChartAggregatorSettings takes no parameters.

Return value

Type: ChartAggregatorSettings

GetClass

Get the name of the MappingImageSettings class. (Inherited from Object)

Syntax

cpp
spString GetClass() const;

Parameters

GetClass takes no parameters.

Return value

Type: spString

GetDoubleParameter

Get a named parameter floating point value.

Syntax

cpp
double GetDoubleParameter( const char * name ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.

Return value

Type: double

GetErrorString

Returns a string describing the error that was found the last time ValidateSettings was performed.

Syntax

cpp
spString GetErrorString() const;

Parameters

GetErrorString takes no parameters.

Return value

Type: spString

GetInputMaterialSettings

Get the input material settings for the given index.

Syntax

cpp
spMappingImageInputMaterialSettings GetInputMaterialSettings( unsigned int index ) const;

Parameters

TypeNameMinMaxDescription
unsigned intindex0SG_MAXIMUM_MAPPING_IMAGE_INPUT_MATERIAL_COUNTInput index

Return value

Type: MappingImageInputMaterialSettings

GetIntParameter

Get a named parameter integer value.

Syntax

cpp
int GetIntParameter( const char * name ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.

Return value

Type: int

GetOutputMaterialSettings

Get the output material settings for the given index.

Syntax

cpp
spMappingImageOutputMaterialSettings GetOutputMaterialSettings( unsigned int index ) const;

Parameters

TypeNameMinMaxDescription
unsigned intindex0SG_MAXIMUM_MAPPING_IMAGE_INPUT_MATERIAL_COUNTOutput index

Return value

Type: MappingImageOutputMaterialSettings

GetParameterizerSettings

The settings for the parameterizer.

Syntax

cpp
spParameterizerSettings GetParameterizerSettings() const;

Parameters

GetParameterizerSettings takes no parameters.

Return value

Type: ParameterizerSettings

GetStringParameter

Get a named parameter string value.

Syntax

cpp
spString GetStringParameter( const char * name ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.

Return value

Type: spString

GetUIntParameter

Get a named parameter unsigned integer value.

Syntax

cpp
unsigned int GetUIntParameter( const char * name ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.

Return value

Type: unsigned int

IsA

Returns true if MappingImageSettings is a or is a descendant of the class named as the type parameter. (Inherited from Object)

Syntax

cpp
bool IsA( const char * type ) const;

Parameters

TypeNameMinMaxDescription
const char *typeName of the class to check if MappingImageSettings is, or is a descendant of.

Return value

Type: bool

IsNull

Returns true if the MappingImageSettings object is invalid. (Inherited from Object)

Syntax

cpp
bool IsNull() const;

Parameters

IsNull takes no parameters.

Return value

Type: bool

IsSameObjectAs

Returns true if the MappingImageSettings object is valid. (Inherited from Object)

Syntax

cpp
bool IsSameObjectAs( const spObject & object ) const;

Parameters

TypeNameMinMaxDescription
ObjectobjectObject to compare with.

Return value

Type: bool

NonNull

Returns true if the MappingImageSettings object is valid. (Inherited from Object)

Syntax

cpp
bool NonNull() const;

Parameters

NonNull takes no parameters.

Return value

Type: bool

PrintInfo

Prints the content/info of the MappingImageSettings object to the log. (Inherited from Object)

Syntax

cpp
void PrintInfo() const;

Parameters

PrintInfo takes no parameters.

RemoveObserver

Removes a previously added observer object. (Inherited from Object)

Syntax

cpp
void RemoveObserver( rid observerId ) const;

Parameters

TypeNameMinMaxDescription
ridobserverIdObserverId is the id returned by AddObserver when the observer was added.

SetBoolParameter

Set a named parameter boolean value.

Syntax

cpp
bool SetBoolParameter( const char * name , bool value ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.
boolvalueNew value for parameter.

Return value

Type: bool

SetDoubleParameter

Set a named parameter floating point value.

Syntax

cpp
bool SetDoubleParameter( const char * name , double value ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.
doublevalueNew value for parameter.

Return value

Type: bool

SetIntParameter

Set a named parameter integer value.

Syntax

cpp
bool SetIntParameter( const char * name , int value ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.
intvalueNew value for parameter.

Return value

Type: bool

SetStringParameter

Set a named parameter string value.

Syntax

cpp
bool SetStringParameter( const char * name , const char * value ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.
const char *valueNew value for parameter.

Return value

Type: bool

SetUIntParameter

Set a named parameter unsigned integer value.

Syntax

cpp
bool SetUIntParameter( const char * name , unsigned int value ) const;

Parameters

TypeNameMinMaxDescription
const char *nameParameter name.
unsigned intvalueNew value for parameter.

Return value

Type: bool

SetValidateParameterNames

Set if parameter names should be validated or not. Parameters that previously do not exist will generate and error if validation is enabled and be allowed if validation is disabled.

Syntax

cpp
void SetValidateParameterNames( bool validate ) const;

Parameters

TypeNameMinMaxDescription
boolvalidateFlag indicating if validation is performed or not.

ToJSON

Get settings as JSON for debugging purposes.

Syntax

cpp
spString ToJSON() const;

Parameters

ToJSON takes no parameters.

Return value

Type: spString

ValidateSettings

Validates the current settings values.

Syntax

cpp
bool ValidateSettings() const;

Parameters

ValidateSettings takes no parameters.

Return value

Type: bool

Static methods details

IsClassA

Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)

Syntax

cpp
static bool IsClassA( const char * type ) const;

Parameters

TypeNameMinMaxDescription
const char *typeName of the class to check if the class is, or is a descendant of.

Return value

Type: bool

SafeCast

SafeCast makes sure the input object is of a class that can be cast into spMappingImageSettings, and if this is the case, returns the object cast into spMappingImageSettings. (Inherited from Object)

Syntax

cpp
static spMappingImageSettings SafeCast( const spObject & object ) const;

Parameters

TypeNameMinMaxDescription
ObjectobjectObject to cast.

Return value

Type: MappingImageSettings