imageBestRatio function


  • string imageBestRatio(searchQuery, axisSelector)


  1. searchQuerystring
    Search query to apply on list of all files in the workspace. See fileSearch for details about the syntax.
  2. axisSelectorstring
    { xy | xz | yx | yz | zx | zy }—selector which defines which scope axes ratio is used as a reference.


Returns texture with best ratio match (according to axisSelector).


The imageBestRatio function returns the texture with the best ratio match, from the list specified in searchQuery, according to the specified combination of axes.


In case multiple files share the best ratio, a random file is returned among those.



Setting up texturing based on the best pixel ratio

The goal is to set up the texturing, depending on the best pixel ratio of the list of desired textures. The following textures all have different resolutions.

Textures with different resolutions
Lot --> s('.9,'.9,'.9) center(xz) recursiveSplit(0)
recursiveSplit(n) -->
	case >= 1.5 && >= 1.5:
		split(x){ split(z){ recursiveSplit(n+1)}*}*
	else: doTexturing
doTexturing -->
	set(material.colormap, imageBestRatio("/myProject/assets/textures/*.jpg", "xz"))
	setupProjection(0, scope.xz,,
Texture with best ratio resolution

In this topic