# Anim8or Community

• December 13, 2018, 03:05:59 am
• Welcome, Guest

### News:

An update to Anim8or, v1.00b, is available with a few bug fixes. Get your copy HERE. See the "ReadMe" file for details.

Pages: 1 [2] 3 4

### AuthorTopic: PHUR v1.4  (Read 32979 times)

#### Raxx

• Hero Member
• Posts: 1461
##### Re: PHUR v1.3
« Reply #15 on: April 26, 2013, 12:49:31 am »

I didn't use any known algorithms for it (known to me anyway), so my method is probably not the most efficient, nor is the distribution perfect. But here goes:

• Find the midpoint of the polygon. Put that and the vertices of that polygon into an array
• Divide each edge of the polygon into subsections the same length as the spacing you desire. Toss those into the array as well
• Now loop through each edge point (including the subsections) and do this:
• Create an imaginary edge from the midpoint to the edge point
• Divide that edge into subsections the same length as the spacing desired
• At each subsection, compare its distance to all of the points in the array so far
• If none of the distances are less than the desired spacing, push that imaginary point into the array
• Do this for each polygon, but ignore shared edges when pushing into the array
• All of those points in the array are now the origins for the grass

A flaw with this is that regardless of how small the polygon is, there is guaranteed to be an origin at every original vertex and midpoint of every polygon. Also, like I said, the distribution won't be perfect. But they will be spaced pretty consistently, as you can see if you test out tiny spacing on a single quad. You probably don't have to use the midpoint and can instead pick any point on the edge for the second step -- I just preferred to make sure the midpoint was always in there.

I'm not a huge fan of that method, but it worked well enough, and I'm a pragmatic person For a game engine, if everything is triangulated you end up having a higher concentration of edges and midpoints, and therefore more origins regardless of what kind of spacing you desire.

Attached is an image that shows how my distribution looks on a quad that gets divided multiple times. As you can see, there's a pattern on each polygon that you can make out, when the spacing is very low -- this pattern probably won't be noticeable at all on terrain, however. To help reduce the pattern, you can loop through all of the origins and randomly take out a number of them, prior to generating the grass.
Logged

#### cooldude234

• Sr. Member
• Posts: 902
• You know what I realized, I dont have an avatar :\
##### Re: PHUR v1.3
« Reply #16 on: April 26, 2013, 02:54:21 am »

Thanks, this will help me get an understanding of how to implement something like this into the engine.
Will try to take a crack at it sometime in the next day or two.
Logged
¼

#### captaindrewi

• Sr. Member
• Posts: 455
• errm...errr?
##### Re: PHUR v1.3
« Reply #17 on: April 26, 2013, 03:12:21 am »

"Make my own PHUR Strands?
To implement your own strands, take note of these things:
When modeling a strand
It must have STRAND_PHUR at the beginning of its name
It must have the same material as the PHUR and base".

Where would i put a strand [model]?
have 1.3 but console says 1.2.
Logged
!

#### Raxx

• Hero Member
• Posts: 1461
##### Re: PHUR v1.3
« Reply #18 on: April 26, 2013, 03:15:57 am »

Oops, forgot to update that little header. Shame on me.

You can place the strand anywhere, the script doesn't use its location in world space. So long as it has "STRAND_PHUR" in front of its name, and has the same material as the PHUR and base mesh, it'll work.

Note that you can't delete it, or else PHUR won't be able to use it. You can just tuck it away somewhere out of sight.
« Last Edit: April 26, 2013, 03:19:36 am by Raxx »
Logged

#### cooldude234

• Sr. Member
• Posts: 902
• You know what I realized, I dont have an avatar :\
##### Re: PHUR v1.3
« Reply #19 on: April 27, 2013, 05:52:37 am »

It seems to not be idiot proofed.
If I accidentally click on one spot with the
Oh wait, I was clicking a broken script not even related to any of yours raxx XD

However I cannot change the amount of stands without subdividing the mesh. I don't if I'm just being an idiot again or if it's something else but I made this pic
Logged
¼

#### johnar

• Sr. Member
• Posts: 814
• Make it, Move it--Give it Life
##### Re: PHUR v1.3
« Reply #20 on: April 27, 2013, 12:30:35 pm »

Sorry to butt in guys....
Havn't got in to experimenting much yet, but....

Phroyd just LOVES his new hair...

Logged
%

#### Raxx

• Hero Member
• Posts: 1461
##### Re: PHUR v1.3
« Reply #21 on: April 27, 2013, 02:03:59 pm »

Nice pic, cooldude234! To increase strand amount without subdividing, you have to set the spacing pretty low. The spacing is in Anim8or units, so if the length of the edges are smaller than the spacing, or if the distance between the midpoint and outer vertices are smaller than the spacing, you won't see any extra strands popping up. Even a spacing of 10 is usually too high unless you're working on very large polygons.

johnar, I honestly have no idea what to say, haha. Nice job with the hair dynamics.
Logged

#### cooldude234

• Sr. Member
• Posts: 902
• You know what I realized, I dont have an avatar :\
##### Re: PHUR v1.3
« Reply #22 on: April 27, 2013, 07:52:32 pm »

Ah, I was being stupid, I was setting the spacing up not down XD
Also I don't see how you'd think 10 is overly high but okay (I won't complain to the hands that make the scripts ).

I feel like there's an anim8or binge coming up

EDIT: LOL johnar, love the hair shake at the end
Logged
¼

#### cooldude234

• Sr. Member
• Posts: 902
• You know what I realized, I dont have an avatar :\
##### Re: PHUR v1.3
« Reply #23 on: April 27, 2013, 08:01:56 pm »

I found a BUG raxx!!! It was crawling on my screen, then it landed on my desk, it was an ant!
But I also found a bug in the script, when I group the phur and base object together, the phur dissapears. I'm not even sure if this is just the way anim8or want's to handle it or if its fixable in the script code itself, but I thought I'd let you know anyway.

EDIT: it crashed when I ungrouped it ):

EDIT: the image shows spacing at 1, it's not super dense at all, and spacing at 10 was ridiculously spaced apart
« Last Edit: April 27, 2013, 08:47:50 pm by cooldude234 »
Logged
¼

#### Janro

• Full Member
• Posts: 160
##### Re: PHUR v1.3
« Reply #24 on: April 28, 2013, 02:06:51 am »

Skies! What sorcery is this?

This looks pretty good Raxx. Amazing in fact. I'd try it once I find a keyboard with a numpad- my laptop has none. I'm too dependent on my hotkeys. xD I suppose this is just static phur? Sorry if it was mentioned. Just skimmed through the posts.

p.s. Hi anim8or community long time no see :3
Logged

#### Raxx

• Hero Member
• Posts: 1461
##### Re: PHUR v1.3
« Reply #25 on: April 28, 2013, 03:10:18 am »

cooldude234, I neglected to mention that grouped meshes were ignored. Parametric shapes get regenerated when grouped (but not when ungrouped), so if the base mesh was grouped with the parametric mesh, then the parametric mesh no longer has an ungrouped mesh to work with. Not sure why it crashed, but to be safe don't group the fur (other weird things happen as well). There isn't much reason to group PHUR anyway (don't seriously generate PHUR unless you're satisfied with the base mesh, and you'll be fine). I would implement groups if it wasn't so...complicated...

Janro, thought you disappeared for good! Glad you're back. Yes, PHUR is static in that it doesn't go swishing around by itself. It's generated in the object editor, so at best you can rig it and animate it or use morphs on it. You can however comb it or give it a random bending direction in the parameters.
Logged

#### neirao

• Sr. Member
• Posts: 606
• Neirao
##### Re: PHUR v1.3
« Reply #26 on: April 29, 2013, 08:06:43 pm »

RAXX THIS IS AMAZING!
I only see this now, im try!!
thanks!
« Last Edit: April 30, 2013, 03:11:01 am by neirao »
Logged

#### Raxx

• Hero Member
• Posts: 1461
##### Re: PHUR v1.3
« Reply #27 on: April 29, 2013, 11:45:36 pm »

Thanks neirao, I hope it proves useful to you

Johnar, referring to your ghost post, as you probably found out parametric shapes don't work with morph targets. It's a nice idea however, and I think would be great if it were implemented. A long time ago an old member named Howitzer had created a tool called MorphEnvy, perhaps you can find it somewhere (if you don't already have it), and it might convert between parametric shapes (assuming they have the same number of divisions, and they are converted to mesh first).

I think I'm about done regularly working on PHUR. I went ahead and updated to v1.3a, with two bug fixes:

• Where if you rotate the PHUR it doesn't revert back to original rotation when OK'ed again.
• Where custom PHUR strands with random direction didn't work properly.

Otherwise the development of this plugin has nearly run its course!
« Last Edit: April 29, 2013, 11:48:13 pm by Raxx »
Logged

#### johnar

• Sr. Member
• Posts: 814
• Make it, Move it--Give it Life
##### Re: PHUR v1.3
« Reply #28 on: April 30, 2013, 01:34:14 am »

Plenty of possibilities here, with Phur, to keep  busy for quite a while.
A gr8 tool to hav. Thanks again.

sorry to say, but I think i'm missing something when it comes to using Combs....?

I made a sphere, converted to mesh, added Phur, with length of 50, and spacing of 5.
Added a comb, resized and rotated it, and moved it onto the sphere mesh so it was covering half the mesh and the Phur on that half...  (So far, so good... luv the way you can manipulate the comb, is in keeping with other Anim8or tools.)
But, its like, how to 'apply' the comb to make an effect.
I double clicked the comb, and thought by clicking 'ok' it would act like an 'apply' button. ?
But nothings happening....?
Sorry if i've missed something obvious...

Janro    Gr8 to c u.  Have also been absent for some time. Good to see another familiar face reappearing.

Logged
%

#### Raxx

• Hero Member
• Posts: 1461
##### Re: PHUR v1.3
« Reply #29 on: April 30, 2013, 02:38:31 am »

Unfortunately you can't use one shape to refresh another. So instead of double clicking the comb to see its immediate effects, you have to double click the PHUR shape. Also, make sure you set the Direction parameter in the PHUR shape to '1' for its strongest effect, with any value between 0 and 1, 1 and 2, and 2 and 3 having different weights for the normal vs combed vs random effects. Sounds complicated in writing, but if you test out the range of values you'll see it's pretty easy to figure out.

I might have to write better documentation sometime
Logged
Pages: 1 [2] 3 4