# Noise Functions

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 03/06/2010 at 18:57, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   11.5
Platform:   Windows  ;
Language(s) :     C++  ;

---------
Hey everyone.

I was wondering if any of the c4d noise functions were based on the Perlin noise function or if there is a particular noise function that allows for interpolation between points?

~Shawn

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 08:55, xxxxxxxx wrote:

I am looking for a way to make smooth transitons from one point to another with the noise functions provided in c4d.  Is this possible or do I need to find an outside noise function like Perlin Noise to accomplish this?

~Shawn

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 09:15, xxxxxxxx wrote:

Here is an example of the noise I am getting when I apply the Turbulence() noise function to my cube.

The code I use to do this is:

``````
Real arr[12];
InitFbm(arr,10,0.1,0.5);

for (int i = 0; i < pointCount; i++)
{
Real rmf = RidgedMultifractal(arr, points[i], octaves, offset, gain) * 2;
Real turb = Turbulence(points[i],octaves, abs) * 2;
Real wavturb = WavyTurbulence(points[i],time, octaves, 1) * 2;
Real noise = PNoise(points[i], points[i]) * 2;

turb = turb * pi;
Real turb1 = (1 - cos(turb)) * .5;

//RIDGED MULTIFRACTAL
if (bc->GetLong(SPACEROCK_NOISE_TYPE) == SPACEROCK_RIDGEDMULTIFRACTAL)
{
points[i] = points[i] * rmf;
}
//Turbulence
if (bc->GetLong(SPACEROCK_NOISE_TYPE) == SPACEROCK_TURBULENCE)
{
points[i] = points[i] * turb;
}
//Wavy Turbulence
if (bc->GetLong(SPACEROCK_NOISE_TYPE) == SPACEROCK_WAVY_TURBULENCE)
{
points[i] = points[i] * wavturb;
}
//Noise
if (bc->GetLong(SPACEROCK_NOISE_TYPE) == SPACEROCK_NOISE)
{
points[i] = points[i] * noise;
}

}

``````

This is for all noise functions but you can see within this how I am using the turbulence() function.  I get the same basci result for all the functions.  Just a clutter of noise.

I would like the have a more even transition between the points so that they are not flying all over the place.  Could anyone guide me toward how I would accomplish this?

Thanks,

~Shawn

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 11:46, xxxxxxxx wrote:

what about using Real Mix(Real v1, Real v2, Real t) to build certain inbetween values. works with Real and with Vector...

plus i'd use some slider to adjust the power of each noise type.. maybe add some checkbox for each noise and not just the option to use only one noise. this would enable to create much more different styles

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 11:47, xxxxxxxx wrote:

I'll give it a try..  thanks ello
~Shawn

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 11:49, xxxxxxxx wrote:

that was fast. you replied while i was editing

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 11:54, xxxxxxxx wrote:

So someting like this?

``````points[i] = Mix(points[i] * turb, points[i], .5);
``````

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 11:58, xxxxxxxx wrote:

exactly

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:04, xxxxxxxx wrote:

hmm. still getting some pretty funky results..   could it be because I am looping through all of the points and effecting each individual point?  is it possible to compare the result of a variable in one cycle of a loop to the result in the last cycle of a loop?

~Shawn

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:13, xxxxxxxx wrote:

I assume I'll need a global variable for that..   do you think it would be more effective to catch the location of the last point that was modified in the global variable  and use that to adjust the position of the next point. make the mix function mix the distance between the last point and the current point?

something like that?

~Shawn

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:14, xxxxxxxx wrote:

you could try to use some smaller value for the noise functions. for example point _/100.. and see what happens. i'd use a slider for this value than, too...

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:21, xxxxxxxx wrote:

ha, you are just too fast for my replies. however, i wouldnt care for that.. you have your base form and apply just some values to each point, so the form still stays similar to your original mesh. maybe you dont use a cube as a base, but a sphere with low polycount? maybe you apply some scale vector additionally so the object doesnt look so round anymore

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:22, xxxxxxxx wrote:

well smaller numbers definitely help but still don't quite give me what I'm looking for.  I think I might need to compare the current point position with the last point position..     Maybe.,.    LOL

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:23, xxxxxxxx wrote:

lol...   sorry I replied before you had a chance to again.  HAHA

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:30, xxxxxxxx wrote:

if you use Mix with keeping more to your original point, say values between 0.5 and 1 for t, you should be able to get exactly that (in theory of course, since i'm not actually trying atm)

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:37, xxxxxxxx wrote:

LOL..  yep you're right...   it worked/./   just had to do a little tweaking with the numbers..  Thanks a lot for your help ello.    I really appreciate you taking the time to help me.

~Shawn

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:39, xxxxxxxx wrote:

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:45, xxxxxxxx wrote:

Hey while you're here do you know if it is safe to subdivide an object from within the GetVirtualObjects() method?

~Shawn

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:53, xxxxxxxx wrote:

i place my object inside  a hypernurbs (Osds) to do so, but i think you mean something other. it should be able by using CommandData

here is a snippet of how i used the optimize command on a polygon object.

``````
if (op->GetType()==Opolygon)
{
ModelingCommandData cd;
cd.doc = doc;
cd.op = op;
BaseContainer bc;
bc.SetReal(MDATA_OPTIMIZE_TOLERANCE, tolerance);
bc.SetReal(MDATA_OPTIMIZE_POINTS, TRUE);
bc.SetReal(MDATA_OPTIMIZE_POLYGONS, TRUE);
bc.SetReal(MDATA_OPTIMIZE_UNUSEDPOINTS, TRUE);
cd.bc = &bc;
if(SendModelingCommand(MCOMMAND_OPTIMIZE, cd))
{
cd.op->Message(MSG_UPDATE, NULL);
BaseTag *phongTag = op->MakeTag(Tphong);
BaseContainer *bc = phongTag->GetDataInstance();
bc->SetBool(PHONGTAG_PHONG_ANGLELIMIT,TRUE);
} else {
GePrint("failed");
}
}
``````

hope this makes sense

edit: in your case it'd be the MCOMMAND_SUBDIVIDE .. check the sdk for its parameters...

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/06/2010 at 12:59, xxxxxxxx wrote:

I was doing something simliar with

#### MCOMMAND_SUBDIVIDE_<_h4_>_

but for some reason it keeps crashiung on me when I try to do it.