In Houdini->pointVop-> anti-aliased noise or turbulent noise returns 3d noise in given xyz position.
In Maya there is no equivalent node for this, 3d noiseTexture->textureToArray returns same value for x,y,z.

So is there any alternative way to get 3d noise in Maya??
Quote 0 0
Here is proof


def sampleColorAtPoint(shadingNode, points):
  #these are the arguments required to sample a 3D texture:
  textureNodeAttr = shadingNode
  numSamples = len(points)
  pointArray = om.MFloatPointArray()
  refPoints = om.MFloatPointArray()
  for i in range(len(points)):
    point = points[i]
    location = om.MFloatPoint(point[0], point[1], point[2])
    pointArray.set(location, i)
    refPoints.set(location, i)
  # but we don't need these
  useShadowMap = False
  reuseMaps = False
  cameraMatrix= om.MFloatMatrix()
  uCoords= None
  vCoords= None
  normals= None
  tangentUs= None
  tangentVs= None
  filterSizes= None
  # and the return arguments are empty....
  resultColors = om.MFloatVectorArray()
  resultTransparencies = om.MFloatVectorArray()
  # this is the command wot samples
  omr.MRenderUtil.sampleShadingNetwork(textureNodeAttr, numSamples, useShadowMap, reuseMaps, cameraMatrix, pointArray, uCoords, vCoords, normals, refPoints, tangentUs, tangentVs, filterSizes, resultColors, resultTransparencies )
  # return the sampled colours
  sampledColorArray = []  
  for i in range(resultColors.length()):
    resultVector = om.MFloatVector(resultColors[i])
    rgb = [resultVector.x, resultVector.y, resultVector.z]
  return sampledColorArray
# end of sampleColorAtPoint

take a locator & volumeNoise texture


import maya.cmds as cmds
import maya.OpenMaya as om
import maya.OpenMayaRender as omr
pointArray = []
pos1 = cmds.xform("locator1", query=True, ws=True, rp=True)
sampledColors = sampleColorAtPoint("volumeNoise1.outColor", pointArray)
print sampledColors

Quote 0 0
Every 3D procedural texture node in Maya has a vector attribute called referencePointCamera.
Set it to something and then getAttr .outColor - the result will be for the provided reference 3D point.
Two lines of MEL in a loop !
This technique works well. It is used in "overburn" to apply voxel properties from any 3d procedural texture.

The code you provided does the same, but in unnecessary complex way.

SOuP's textureToArray node has a parameter called "accurate sampling". By default i use the MDynamicUtil which is much faster than MRenderUtil::sampleShadingNetwork.
Turn this option on and everything will work as expected with 3D textures.

Hope this helps.
Quote 0 0

Add a Website Forum to your website.