AsImpL 1.0
Asynchronous Importer and run-time Loader for Unity
AsImpL.ModelUtil Class Reference

Utility class for model import More...

Public Types

enum  MtlBlendMode { OPAQUE , CUTOUT , FADE , TRANSPARENT }
 Blend mode for Unity Material More...
 

Static Public Member Functions

static void SetupMaterialWithBlendMode (Material mtl, MtlBlendMode mode)
 Set up a Material for the given mode. More...
 
static bool ScanTransparentPixels (Texture2D texture, ref MtlBlendMode mode)
 Scan a texture looking for transparent pixels and trying to guess the correct blend mode needed. More...
 
static void DetectMtlBlendFadeOrCutout (float alpha, ref MtlBlendMode mode, ref bool noDoubt)
 Detect if the blend mode must be set to FADE or CUTOUT according to the given alpha value and the current value of mode. More...
 
static Texture2D HeightToNormalMap (Texture2D bumpMap, float amount=1f)
 Convert a bump map to a normal map More...
 

Detailed Description

Utility class for model import

Member Enumeration Documentation

◆ MtlBlendMode

Blend mode for Unity Material

Enumerator
OPAQUE 
CUTOUT 
FADE 
TRANSPARENT 

Member Function Documentation

◆ DetectMtlBlendFadeOrCutout()

static void AsImpL.ModelUtil.DetectMtlBlendFadeOrCutout ( float  alpha,
ref MtlBlendMode  mode,
ref bool  noDoubt 
)
static

Detect if the blend mode must be set to FADE or CUTOUT according to the given alpha value and the current value of mode.

Parameters
alphainput alpha value
modeblend mode set to FADE or CUTOUT
noDoubtflag set to true if the mode is finally detected (it can be used to break from a scan loop)

◆ HeightToNormalMap()

static Texture2D AsImpL.ModelUtil.HeightToNormalMap ( Texture2D  bumpMap,
float  amount = 1f 
)
static

Convert a bump map to a normal map

Parameters
bumpMapinput bump map
amountoptionally adjust the bump effect with the normal map
Returns
The new normal map

Get depth component

◆ ScanTransparentPixels()

static bool AsImpL.ModelUtil.ScanTransparentPixels ( Texture2D  texture,
ref MtlBlendMode  mode 
)
static

Scan a texture looking for transparent pixels and trying to guess the correct blend mode needed.

Parameters
textureinput rexture (it must be set to readable)
modeblend mode set to FADE or CUTOUT if transparent pixels are found.
Returns
Return true if transparent pixels were found.

◆ SetupMaterialWithBlendMode()

static void AsImpL.ModelUtil.SetupMaterialWithBlendMode ( Material  mtl,
MtlBlendMode  mode 
)
static

Set up a Material for the given mode.

Here is replicated what is done when choosing a blend mode from Inspector.

Parameters
mtlmaterial to be changed
modemode to be set

The documentation for this class was generated from the following file: