These different methods are the following:
First of all, If you want to keep the uv provided with your mesh (through CUVWChannel) you have to specify OPTIMIZE_KEEP_UV.
Code: Select all
// Keep uv is on. If not defined, UV are removed // OPTIMIZE_PROTECT_UV/OPTIMIZE_KEEP_UV are optional, if none used then // UV are optimized with minimal take care of them (something like OPTIMIZE_PRESERVE_UV) OPTIMIZE_KEEP_UV = 0x400, OPTIMIZE_PROTECT_UV = 0x800, OPTIMIZE_EXCLUDE_UV = 0x1000, OPTIMIZE_UV_MASK = (OPTIMIZE_PROTECT_UV|OPTIMIZE_EXCLUDE_UV),
Without that flag, UVs are ignored during optimization process.
if your mesh does not have UVs seams, there is no real difference between these modes.
Note that an UV seams exists when you have different UVs value falling at the same geometric point.
This might occur when you have a break between different texture along an edge for example.
OPTIMIZE_KEEP_UV used alone keeps the UVs along the optimization process.
There is a minimal care of UV seams, and the flag is perfect if your mesh does not have such seams.
OPTIMIZE_PROTECT_UV will protect UV seams as long as it is possible.
If the specified required optimization ratio is too high, there might be seam losses.
OPTIMIZE_EXCLUDE_UV freezes UV seams, meaning that a point that has seams cannot be optimized.
One more important thing to know is that you can define a tolerance for detecting UV seams.
This is done through CSceneOptimizer::SetUVWTolerance.
Let's say you set the UVW tolerance to 0.0001. This means:
- the point has an an UV seams if the difference between 2 of its UVs is greater than 0.0001
- the point is not a seam if the difference between 2 of its UVs is lower than 0.0001
Only point that are on a seams are affected by OPTIMIZE_PROTECT_UV or OPTIMIZE_KEEP_UV