[Closed] maxscript equivalent of mel dnoise function?
Does anyone know if there’s a straightforward maxscript equivalent of the mel “dnoise” function?
description from maya help docs:
dnoise
Returns a vector with each component containing a random number from -1 to 1. It works like the noise function except it expects and returns a vector argument. The returned vector represents the gradient of the noise field in three dimensions.
vector dnoise(vector argument)
The vector argument specifies a vector for generating a random number. This gives a three-dimensional distribution of return values.
Example:
dnoise (<<10,20,-30>>)
Returns <<-0.185, 0.441, 0.686>>
Many thanks for any help!
Adam
Hey Paul!
I’m pretty sure that’s not the same thing. That would just give me a random point3 number each time. Just checked in Maya and it’s kinda like the Max noise3 function – if you give it the same point3 value, the function should always return the same value.
Grrrr … I don’t think I’ve got my work head back on yet…
sometimes a noise/random needs to be seeded to return true random numbers …
Maybe this is true for the maya dnoise.
As maya is such a superior package, I can imagine it needs random seeds.
Georg
Hi.
I’ve seen some implementations for Perlin’s DNoise function and what it does is compute the gradient (partial derivatives) for the noise function. For example this one on this C code. What it does is compute all the perlin noise stuff and then compute the derivatives. So in theory you can use the noise3 function from MAXScript (that I think it’s based on Perlin’s) and do:
fn dnoise p = (
local n = noise3 p
2.0 * [n,n,n] - [1.0,1.0,1.0]
)
I’ve based this code in the one I’ve found here.
Anyway it can’t be guaranteed that the results thrown by this function are the same to the Maya counterparts because maybe the noise implementation is different (maybe the random generator is different).
Hope that helps.
Ah! Very interesting – that helps a bunch! You never quite realize how much math you’ve forgotten until you sit down and try to do some – d’oh!
Incidentally I heard back from Oleg (pflow creator) and he said that in his Pflow:Box3 particle operators Maya dnoise (or Perlin noise) is actually replicated as the random operator Turbulence V (where v is the vector value). I can probably hook something up to double-check the maxscript results I’m getting and tweak them to suit.
Thanks!