Fractal surface
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/05/2010 at 16:58, xxxxxxxx wrote:
Hey Jack. Thanks for the reply, for some reason whenever I try to create a cube in GetVirtualObjects, nothing gets shon in the viewport. Do you have a sample code of how to create a cube in GetVirtual Objects.
Also,
when you say noise functions do you mean RidgedMultifractal()
Thanks,
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/05/2010 at 13:45, xxxxxxxx wrote:
Originally posted by xxxxxxxx
Do you have a sample code of how to create a cube in GetVirtual Objects.
How about this?
BaseObject *cube = BaseObject::Alloc(Ocube); return cube;
If the default settings of the cube are not suitable for what you're trying to do, just get the cube's container and change them.
Originally posted by xxxxxxxx
when you say noise functions do you mean RidgedMultifractal()
Also, but not only
Cheers,
Frank -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/05/2010 at 13:54, xxxxxxxx wrote:
Hey Thanks for the reply Jack. I did manage to figure that part out after doing some tweaking. I'm not sure why it wasn't working for me before.. LOL
What other noise functions are you refering to?
Also, I am finding out that I can't make changes to objects within GetVirtualObjects() like add a material to them or anything like that. Am I allowed to change the cubes default settings within GetVirtualObjects or will that cause a threading problem?
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/05/2010 at 14:00, xxxxxxxx wrote:
Also, another question is, when I get this rock object made within GetVirtualObjects, how do I then add a material to that object? I have tried adding a material to the sky object I am trying to do and I get all sorts of problems. Check https://developers.maxon.net/forum/topic/5051/4975_questionto see what I am refering to.
Is there a better safer way to do this than I am with the link I sent?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 05:48, xxxxxxxx wrote:
Check your other threads regarding this topic. I have posted some examples there.
cheers,
Matthias -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 05:50, xxxxxxxx wrote:
Okay Jack here's what I have...
BaseObject *SpaceRock::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh) { Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTY_DATA); if (!dirty) return op->GetCache(hh); BaseObject *cube = BaseObject::Alloc(Ocube); if(!cube) goto Error; cube->SetParameter(PRIM_CUBE_SUBX, GeData(4),0); cube->SetParameter(PRIM_CUBE_SUBY, GeData(4),0); cube->SetParameter(PRIM_CUBE_SUBZ, GeData(4),0); PolygonObject *polyCube = ToPoly(cube); if(!cube) goto Error; Vector * points = polyCube->GetPointW(); LONG pointCount = polyCube->GetPointCount(); for (int i = 0; i < pointCount; i++) { Real arr[20]; InitFbm(arr,10,2.0,0.5); RidgedMultifractal(arr, points[i], 10, 3, 7); Turbulence(points[i],10, TRUE); SNoise(points[i]); Fbm(arr, points[i], 10); } cube->Message(MSG_UPDATE); return polyCube; Error: return NULL; }
Unfortunately nothing happens to the cube .. so I must be doing something wrong... I figured I'd try all the noise functions just to see what happened.... Do you see anything I should change?
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 05:51, xxxxxxxx wrote:
And Thanks again Matthias...
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 06:55, xxxxxxxx wrote:
Maybe the changes you're making to the point positions are just too small to see? Remember, the noise functions only return values between 0 and 1 (or -1 and 1), so you'll want to multiply them with some value control the deformation intensity.
Cheers,
Frank -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 08:06, xxxxxxxx wrote:
Could you post a quick example of what you mean by that?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 17:19, xxxxxxxx wrote:
Originally posted by xxxxxxxx
What other noise functions are you refering to?
All of them, just take a look into the SDK documentation.
Originally posted by xxxxxxxx
Could you post a quick example of what you mean by that?
Well, just multiply it.
Real x = Turbulence(points[i],10, TRUE) * 5.0;
You actually do know that those Noise functions return values, right? In your code it looks like you just call them without doing anything with their results.
I strongly advise you to stick your nose into the SDK documentation and read about the basics, since most of your questions here are answered there!
Also your code looks quite inefficient in several places, e.g. initializing the Fbm array in every iteration of your loop is neither necessary nor does it lead to a good performance. Last but not least, you have to convert your allocated object to a polygon object. In your code, you just cast it. Read about Current State To Object in the SDK docs. Don't forget to check for memory leaks by using the c4d_debug.txt file.
Cheers,
Jack -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 17:34, xxxxxxxx wrote:
Hey Jack,
Yeah I did know that the functions returned a value. I often seem to come off a bit naive when I am charting in to new territory for myself because I am mostly learning as I go. I do appreciate you answering my questions as it helps to make it all more clear.
I will poke around in the SDK to get a better understanding of these concepts. The Current State To Object I have not used before but i will look in to that.
Thanks again.
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 17:39, xxxxxxxx wrote:
Originally posted by xxxxxxxx
I often seem to come off a bit naive when I am charting in to new territory
Sometimes, maybe, a little
Originally posted by xxxxxxxx
I am mostly learning as I go.
That's how most of us learned it, I guess. Nothing wrong with that.
Originally posted by xxxxxxxx
I do appreciate you answering my questions as it helps to make it all more clear.
I don't mind answering lots of questions, but I want people to do some research on their own.
"Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime."Cheers,
Frank -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 17:41, xxxxxxxx wrote:
I'll go fishing. Thanks!
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 18:06, xxxxxxxx wrote:
I am only find this about Current State To Object:
Current State To Object (CSTO)
CSTO has to be executed on a duplicate of an object because CSTO modifies the existing caches. In some cases you have to use a temporary document as well (GetVirtualObjects()).Is there more in the SDK about it? Should I use a CallCommand() to do CSTO?
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 31/05/2010 at 19:21, xxxxxxxx wrote:
Okay so after doing some more digging in the SDK and some searches here at the cafe, I have found two ways to do the current State To Object.
BaseObject *SpaceRock::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh) { Bool dirty = op->CheckCache(hh) || op->IsDirty(DIRTY_DATA); if (!dirty) return op->GetCache(hh); ModelingCommandData mcd; BaseObject *cube = BaseObject::Alloc(Ocube); if(!cube) goto Error; cube->SetParameter(PRIM_CUBE_SUBX, GeData(4),0); cube->SetParameter(PRIM_CUBE_SUBY, GeData(4),0); cube->SetParameter(PRIM_CUBE_SUBZ, GeData(4),0); PolygonObject *polyCube = ToPoly(cube); if(!polyCube) goto Error; Vector * points = polyCube->GetPointW(); LONG pointCount = polyCube->GetPointCount(); //mcd.op = polyCube; //mcd.mode = MODIFY_ALL; //SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, mcd); Real arr[20]; InitFbm(arr,10,2.0,0.5); for (int i = 0; i < pointCount; i++) { Real rmf = RidgedMultifractal(arr, points[i], 10, 3, 7) * 5.0; Real turb = Turbulence(points[i],10, TRUE) * 5.0; Real snoise = SNoise(points[i]) * 5.0; Real fbm = Fbm(arr, points[i], 10) * 5.0; points[i] = points[i] * turb; points[i] = points[i] * rmf; points[i] = points[i] * snoise; points[i] = points[i] * fbm; } //CallCommand(12233); //Current State To Object cube->Message(MSG_UPDATE); return polyCube; Error: return NULL; }
I have commented both ways out but you can see that I do it with the CallCommand() and I also do it with a SendModelingCommand(). Is there a particularly more effective way to do it? Also, I still must not be doing it correctly, because nothing is happening to my cube. I believe that given the changes I made to the loop that at least something should happen to the points _but nothing is which leads me to believe that it is still not correctly doing the CSTO.
Do you notice anything in particular that I am doing wrong? I will keep looking for more info here and in the SDK as well. Thanks,
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/06/2010 at 00:43, xxxxxxxx wrote:
You need to use SendModelingCommand(), then get the result.
Also remember that you sometimes have to clone your original object, and use the modeling command on the clone, as it's shown in some threads here in the forum.The ToPoly cast can be removed, since it does not change the object. Rather cast the modeling command result to a PolygonObject, that would make more sense
Also, if you would have taken a close look into the SDK, as I advised you, you would have found some nice demo code for exactly this modeling command in the documentation. It also shows you how to get the result.
Cheers,
Jack -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/06/2010 at 16:11, xxxxxxxx wrote:
Well after some blood, sweat, and SDK searching I finally figured it out. When you're right you're right Jack,,, I learned much more by combing through the SDK...
Thanks for the pep talk.. LOL
~Shawn -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 03/06/2010 at 18:26, xxxxxxxx wrote:
If I want to subdivide the rock using the SendModelingCOmmand() is this okay to do from within GetVirtualObjects or is that unsafe? I know it says you can't chan ge the scene from within GVO but if the object hasn't been added to the scene yet, is it safe to subdivide it?
Thanks,
~Shawn
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 05/06/2010 at 21:38, xxxxxxxx wrote:
Hey Jack,
So I have successfully created an object and am using noise functions to alter the look of the object.
Here is the code I am using.
Real arr[20]; InitFbm(arr,20,7,0.5); for (int i = 0; i < pointCount; i++) { Real rmf = RidgedMultifractal(arr, points[i], octaves, offset, gain) * .8; Real turb = Turbulence(points[i],octaves, abs) * .8; Real wavturb = WavyTurbulence(points[i],time, octaves, 1) * .8; Real noise = Noise(points[i]) * .8; //RIDGED MULTIFRACTAL if (bc->GetLong(SPACEROCK_NOISE_TYPE) == SPACEROCK_RIDGEDMULTIFRACTAL) { points[i] = Mix(points[i] * rmf, points[i], amt); } //Turbulence if (bc->GetLong(SPACEROCK_NOISE_TYPE) == SPACEROCK_TURBULENCE) { points[i] = Mix(points[i] * turb, points[i], amt); } //Wavy Turbulence if (bc->GetLong(SPACEROCK_NOISE_TYPE) == SPACEROCK_WAVY_TURBULENCE) { points[i] = Mix(points[i] * wavturb, points[i], amt); } //Noise if (bc->GetLong(SPACEROCK_NOISE_TYPE) == SPACEROCK_NOISE) { points[i] = Mix(points[i] * noise, points[i], amt); } } //SUBDIVISION Real subAmount = bc->GetReal(SPACEROCK_SUBDIVISIONS); bc2.SetBool(MDATA_SUBDIVIDE_HYPER, TRUE); bc2.SetLong(MDATA_SUBDIVIDE_SUB, subAmount); bc2.SetReal(MDATA_SUBDIVIDE_ANGLE, pi); mcd2.bc = &bc2; mcd2.op = polyCube; mcd2.mode = MODIFY_ALL; mcd2.doc = hh->GetDocument(); if(SendModelingCommand(MCOMMAND_SUBDIVIDE, mcd2)) { GePrint("done"); } else { GePrint("failed"); }
My results are okay but I would like to get a more detailed and fine noise look. Do you have any tips on how to improve the way I am affecting the object with the noise functions. This is how my object looks right now with noise applied.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 06/06/2010 at 10:57, xxxxxxxx wrote:
well, i guess you first need to create more faces to get more details. than you could apply more layers of noise at different scales and coordinates.. or you simply add the detail using a nice mix of noises in the relief channel
cheers,
Ello