Hi,
I just append to have a problem with the Texel Density tool from the UV Toolkit.
We have to get a very precise Texel Density among the whole project, and the way this tool reacts is causing us problems at the moment.
The same texel density on different UV shells results on really significant changes and i don't know why.
I tried to find the way this attribute is calculated in order to python my way out of this problem, and I am still on it, but I cannot find a proper way to calculate it at the moment.
Anybody have a similar problem ? Or better, a hint of a solution ?
Thank you by advance !
Solved! Go to Solution.
I just found the mel script which does this :
// ===========================================================================
// Copyright 2017 Autodesk, Inc. All rights reserved.
//
// Use of this software is subject to the terms of the Autodesk license
// agreement provided at the time of installation or download, or which
// otherwise accompanies this software in either electronic or hard copy form.
// ===========================================================================
// ===========================================================================
//
// Creation Date: October 27, 2016
//
// Procedure Name:
// texCalculateTexelDensity
//
// Description:
// UV workflow function used for calculating the texel density value of
// input faces
//
// Input Arguments
// faces - String[] - Names of face components.
// mapSize - Int - The texture size to scale against.
// progressBar - Int - Update the progressBar
//
// Return Values:
// Float - The calculated texel density value.
//
// Notes:
// This script is part of the implementation of Nightshade UV Editor into
// Autodesk Maya. This script is sourced by other scripts. Do not run it
// directly.
//
// ===========================================================================
global proc float texCalculateTexelDensity(string $faces[], int $mapSize, int $progressBar)
{
float $area3DSum = 0.0;
float $area2DSum = 0.0;
$faces = `filterExpand -ex false -sm 34 $faces`;
// Begin progressBar
global string $gMainProgressBar;
if ($progressBar)
progressBar -e -bp -max (size($faces)) $gMainProgressBar;
float $area3D[] = `polyEvaluate -worldFaceArea $faces`;
float $area2D[] = `polyEvaluate -uvFaceArea $faces`;
for ($i = 0; $i < size($area3D); $i++){
// Break if cancelled by user
if ($progressBar && `progressBar -q -isCancelled $gMainProgressBar`)
{
warning((uiRes("m_texCalculateTexelDensity.kUvEditorGetTexelDensityInteruptMsg")));
break;
}
$area3DSum += $area3D[$i];
$area2DSum += $area2D[$i];
// Update the progress window
if ($progressBar)
progressBar -e -s 1 $gMainProgressBar;
}
// End progressBar
if ($progressBar)
progressBar -e -endProgress $gMainProgressBar;
return (`sqrt $area2DSum` / `sqrt $area3DSum`) * $mapSize;
}
Can't find what you're looking for? Ask the community or share your knowledge.