|
3D math shapesHi! Today I ve download Kineme3D pack and I am very happy to improve my designs. I am wondering if its possible to create a shape from a equation formula like on these site: http://local.wasp.uwa.edu.au/~pbourke/geometry/ I couldn't do it with 'Kineme 3D Parametric Surface' Thank you!
|
some yes, some no. It depends on the equations. If they're parametric (x, y, z in terms of u, v), they can be created with this patch, given appropriate equations.
I'm guessing that you're not scaling u and v to the proper range -- in many of his equations u and v go from 0 to 2π, or -π to +π (radians), or whatever, while u and v in kineme3d only go from 0 to 1, and the sin/cos functions expect values in degrees, so you have to do silly stuff like ((u*360)-180) to map it from 0-1 to -180-+180 (which is -π-+π radians).
Here's a klein bottle example. (don't try simplify on it, it might freak out due to some simplify bugs in the 1.2 beta).
Sorry for the late replay... I will try to work with other shapes once I have more time. Still having many things to learn... Cheers!
In the X expression for the Klein bottle example, say i want to turn the constant 1.5 into a variable i can interpolate:
cos((u * 360-180)) * ( -->1.5 + sin((v * 360-180)) * cos((u * 360-180)/2) - sin(2 * (v * 360-180)) * sin((u * 360-180)/2)/2)
i.e., inserting an input splitter reveals the equation as a string, so i guess my question is, how do i insert a number variable into the string?
You can replace the 1.5 with a variable (such as the letter r, or "bob", or "awesome" or whatever).
Then, you have to make a structure with a member called you variable name, set it's value to the value you want, and feed that into the Variables input.
thanks so much!
For writing equations I am using JavaScript patch.
Thanks so very much! Delightful!
Thanks for that!
javascript question: why do the variables have to have + symbols around them, ie, "+a+" and "+b+"?
(and i'm at >3 fps for the posted example-- that sucks! any solutions?)
For up the framerate, drop the u/v subdivisions (u is 96, v is 64 -- try 32 for both, or even 24)
You can also set Normals to Faceted to save on normal smoothing (it won't look as nice, but it'll be a bit faster).
the vars have '+'s because he's building strings. Here's the code:
He's got "a" in +'s because he's "adding" "a" to the string (string concatenation).
For example (simpler than the above, which is really long), if we had the line
result.something = "aVar: " + 42
, it would set result.something to the string "aVar: 42". Similarly, if it wasresult.something = "aVar: " + x
, it would set it to "aVar: ..." where "..." is the whatever "x" is.very much appreciated, thanks.
(and by the way, of course i meant "<3 fps"-- slow! halving the U/V subdivisions bumped me up to ~20fps-- good!)
You were at less that 3fps using Rinboku's example? That IS really slow. None of my business, but what are you using (graphics card)? I'm just surprised I guess. I use a frickin white macbook with a GMA X3100 (which isn't exactly the top of the line). On this laptop, it hovers between 20~30fps.
A slightly older MBP (2.16 core duo) with a stock ATI Radeon X1600. I guess that's the difference with the GMA cards? I really don't know, but i thought it was strangely slow, too. didn't seem like there was that much going on with that patch... but chris's suggestion worked out. i also don't get 32-bit processing, even though the specs say i should...
Excellent!! I love your JS patch. Looks more clean in order to work. I still don't get some maths conversion. I am tring to make this one: http://local.wasp.uwa.edu.au/~pbourke/geometry/horn/ x = (2 + u cos(v)) sin(2 pi u) y = (2 + u cos(v)) cos(2 pi u) + 2 u z = u sin(v) 0 <= u <= 1, 0 <= v <= 2pi
this is java code :
//result.Xexpression = "("+a+" + 2 + (u * cos(v * 2 * 3.1415))) * sin(2 * 3.1415 * u)";
//result.Yexpression = "("+b+" +2 + (u * cos(v * 2 * 3.1415))) * cos(2 * 3.1415 * u) + 2 * u";
//result.Zexpression = " u * sin(v * 2 * 3.1415)";
also. A: How to include a PI funtion instead 3.1415?
B: Is possible to add a viariable V = (0 <= v <= 2pi) so cos(V)?
Thank's!
Stop Everything.
Hold Option, open QC preferences.
Select the (Editor) tab.
Make sure the following are Disabled:
Those all give bad performance in QC -- the last two will actually use the CPU to do all rendering.
I'm on a GMA950 -- the generation before George's MacBook, and I get ~20fps too, so if you're not hitting that there's something terribly wrong.
Not in the expressions
Math.PI in Javascript will expand to 3.1415926..., but in the Expression stuff, you can just use the variable "pi" (set automagically, along with "e")
Thank you.
In this case pi = 180 degree.
Cool posts Rinboku :o)
Thanks, Chris. All are disabled. Here's a screenshot of performance inspector.
zoinks...
This is a real stab in the dark... Chris, would it make any difference if someone isn't running the most recent build of QC?
That's expected -- with a fast GPU (non-intel), the rendering of 96*64 (6144) polygons will take next to no time -- the only thing doing any work would be the surface generator (since it's making a new mesh _every frame_).
Even on a crap GPU (GMA95), here's what it looks like:
Rendering takes ~25% of the time, generation takes ~75%.
But it's taking almost half a second in your case, while it's taking much less on mine (~1/30th second). -- This is entirely CPU-bound stuff, so OpenGL/GPU won't affect this at all.
Possible reasons for this disparity:
I think that covers all our bases.
Thank you so much!!!! I will have a look soon!!
Strange and a little frustrating-- thanks for looking into this.
Using kineme3d 1.2 beta, QC version 3.1 (63.2). Attached is a sample of QC from activity monitor running cwright's original klein bottle with a structure / variable / interpolator (thought i'd try to eliminate the javascript patch just to see).
btw, same issue with the horn.qtz posted below...
edit: to be clear, you mean it seems i should be able to run at >20fps with u subdivisions = 96, v subdivs = 64, right?
and let me know if there's anything else i can send you to help sort this out. the ~.44 sec processing time for Parametric Surface patch corresponds directly to 2.16 fps-- does the trouble lie within?
oh yeah-- i'm not running anything else heavy on my system and smooth normals made no difference.
There are a couple 1.2 betas -- make sure you've got the latest. If it's still a problem, just wait for the next one (or try a previous one, or something).
The sample doesn't help at all -- Kineme3D doesn't associate symbols names with addresses, so you usually won't see meaningful names where it's taking time, just a number (0x4182ed64). Internally we can map these back, but it's time consuming when we've got different builds (the addresses don't match once the source code is changed).
George, can you post which beta version you're using? (not 1.2, but the actual beta date (200901blah))
ah-ha! i was running the 2/16 version and i just installed the latest beta and now it works!
thanks so much for your patience! ah, well... :oops:
20090219.... Looks like jersmi has that one now!
thanks, gt.
thanks so much, Rinboku!
i'm still chasing this trying to understand a little more how the numbers work. i started from scratch with a sphere, but the lighting is reversed on half the sphere. any hints?
X expression: cos(u * 180) * cos((v * 360)-180)/2
Y expression: sin(u * 180) * cos((v * 360)-180)/2
Z expression: sin((v * 360)-180)/2
also, why do some expressions create "noise" across the surface? for ex., change the Z expression to: cos((v*360)-180)/2
the kineme 3D parametric shape patch is cool, but either i'm not understanding something or it appears to have a couple glitches? like the reversed lighting mentioned above, and when i plug it into a 3D Noise patch, i lose lighting altogether?
When you run through any deformer patch, it strips normals... so make sure that you select either faceted or smooth on the renderer. If you don't use a deformer and you have smooth selected on your loader, it will be smooth no matter what the renderer setting.
I think the cause of the noise is that the surface has overlapped. Because sin and cos are periodic function, creating surface will be repeated depending on the value of u or v.
And the undesirable shadow is probably because the back of the surface is seen by your equations.
thanks for the info-- i'm learning! no excuse for math mistakes, but i make lots of them. :) anyway, i figured out the sphere-- it was my math, of course.
here's a .qtz with a few more parametric surfaces, and an experiment with kineme 3D.
Hello! That's very interesting.
Now I downloaded Kineme Structure Tools. So I came to be able to make structure easily and understood that using this patch make equations more simpler.
Thanks once again for the update. I like your javascript patch a lot.
You can use javascript for the variables too... when this was in alpha/beta(?), I was using the structure patch too, and asked Chris about it, so that I wouldn't be using two plugins (my theory is, less plugins for stuff that doesn't strictly require plugs, the better)- he referred me to this technique. It's not exactly what he sent me, but modded for the occasion.
This is the same comp, w/ javascript instead of the structure plugin....
That's a good example, makes sense. More questions:
For ex., say i want different versions of the horn animations. Makes sense to me to keep the basic surface patch intact with the first JS patch and use the other JS patch to animate the form. Is it possible / practical to insert an expression as a variable in the second patch? Say i wanted to now animate the pointy tip of the horn and make it swoosh around-- could i do this with the second patch without altering the basic surface?