Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Pages: [1] 2

Author Topic: new - advanced_plane_plugin - available ;)  (Read 34783 times)

vobla

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
new - advanced_plane_plugin - available ;)
« on: January 16, 2008, 06:45:14 pm »

Hi all,

I'm very happy that I found this brilliant software by accident. ;)
It's very usefull, simple and quite powerfull.

I found the basics of syntax very simple, so I wrote this small script (called advanced, because it's a bit better than plane_plugin  ::)).
Now, you can draw a plane and divide it to as many segments as you like (it's a bit lie, but anyway :D )
BTW, comments in spring_pugin_1.a8s are helped alot, thanks. ;)

You can find it in the attachment.
Cheers. ;)

EDIT: please download the latest version from the very last post.
« Last Edit: January 18, 2008, 08:53:00 am by vobla »
Logged

sciwizeh

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #1 on: January 16, 2008, 07:06:19 pm »

cool! until now ive been using the original and subdived faces to get this result now i don't have too!
Logged
<a href="http://www.freewebs.com/sciwizehgames">My site</a>
<a href="http://matrixpeckham.googlepages.com">My other site</a>

hihosilver

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1294
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #2 on: January 16, 2008, 08:01:32 pm »

Great little script there.
I've been hoping there would be one with these options.
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #3 on: January 16, 2008, 08:52:32 pm »

Hi vobla

Good work.

I have a few suggestion if your interested.

1)Use a different line for comments.It would make your
code easier to read.

2)You don't need to initialize $i and $j to 0.

3)Right now,your faces(normals) are facing down toward -Y.It might
be better to have them facing up.You just have to reverse the winding(the
order you're adding the vertices)Seen from the top,you're going counter clock wise.
Go clock wise.

4)You could also calculate the UV coords so that your mesh would show a
complete texture,seen from the top.
Texture coords are:
Image                 UVcoords
Bottom left          0,0
Bottom right        1,0
Top left               0,1
Top right             1,1
So,you can calculate them in a way similar to the one you used for the vertices.

Hope it helps.
Welcome to Anim8or.
Claude
Logged

vobla

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #4 on: January 16, 2008, 09:19:54 pm »

Hi vobla

Good work.

I have a few suggestion if your interested.

1)Use a different line for comments.It would make your
code easier to read.

2)You don't need to initialize $i and $j to 0.

3)Right now,your faces(normals) are facing down toward -Y.It might
be better to have them facing up.You just have to reverse the winding(the
order you're adding the vertices)Seen from the top,you're going counter clock wise.
Go clock wise.

4)You could also calculate the UV coords so that your mesh would show a
complete texture,seen from the top.
Texture coords are:
Image                 UVcoords
Bottom left          0,0
Bottom right        1,0
Top left               0,1
Top right             1,1
So,you can calculate them in a way similar to the one you used for the vertices.

Hope it helps.
Welcome to Anim8or.
Claude


Hey thanks,

This help very much. I'll definitely take a look at that tomorow ;)

EDIT:
Hi all,

Here's the new version.

Roadmap:)

1) -- DONE --
2) I preffer to keep things clear ;) You are free to modify it anyway ;)
3) -- DONE --
4) According to my calculations, new ST (UV ..whatever) coords formula result is correct, but when I add texture to a plane in Anim8or it gets clamped. Is it normal behaviour? If not, I messed something up..  ::)
« Last Edit: January 17, 2008, 10:02:18 am by vobla »
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #5 on: January 17, 2008, 07:46:23 pm »

2)The reason  I was saying you don't need it is that your doing it
again in the loop: for $i = 0 to and for $j = 0 to

4)UV and ST are both used.I've made a few corrections to the
uvcoords calculation.Have a look.

Bye
Claude
Logged

vobla

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #6 on: January 17, 2008, 08:47:32 pm »

Hey,

And about that 2) I knaow I'm doing it twice, but I like to initialize default values even if its zero by default or I do it later in the code. It's just easyer to devide the script like that (params, vars, default values, code) and most importantly read.  ::)

Thank you for your corrections.



Thanks to Claude here's the newest version (suppose the last release :D )

Cheers
« Last Edit: January 17, 2008, 09:12:10 pm by vobla »
Logged

hihosilver

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1294
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #7 on: January 18, 2008, 03:50:00 pm »

I found another issue :p
Basically with your script, none of the points are actually connected.  It'd be much more useful if it was an attached grid rather than many small planes placed next to each other.  I'm not any kind of a coder, so I'm not sure how to do this, but I hope you can attach the sections of the plane.  Perhaps ASL can merge points or something?
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #8 on: January 18, 2008, 04:40:41 pm »

If this is what you want,then you simply have to reuse the points created for
the existing adjacent quad or more precisely their index that you would have
to store.
Logged

vobla

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #9 on: January 18, 2008, 07:59:11 pm »

In other word, I create too many points. If the coords are the same, I should just add reference of the point. I wish I could use C# list, PHP array or recursing funcion.. :D
Anyway, I'll try to fix it as soon as I can, it should be posible anyway, is't it ;)

And hey, thanks for commenting. I really appreciate that. ;)


EIDT:
I looked at http://www.anim8or.com/scripts/mesh_1.txt
example and found

$index[$i] = $mymesh.AddPoint(($x, $y, $z));

so what exactly "$mymesh.AddPoint(($x, $y, $z))" do? retuns int value ??? Added point index ?
« Last Edit: January 18, 2008, 09:47:04 pm by vobla »
Logged

vobla

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #10 on: January 18, 2008, 09:56:41 pm »

Is there a way to get point coords when you know index?
It's so hard when there's no documentation.. ;(
Logged

Claude

  • Sr. Member
  • ****
  • Posts: 285
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #11 on: January 18, 2008, 11:17:16 pm »

Here's what you're looking for I think:

http://www.anim8or.com/scripts/spec/Anim8or_Scripting_Language.html

Mesh and Meshdata Types section.
« Last Edit: January 18, 2008, 11:20:30 pm by Claude »
Logged

vobla

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #12 on: January 20, 2008, 08:12:14 pm »

Hi,

I managed to fix the script, finaly.  ;)

1. Plane is facing up the Y axis;
2. Texture coords are counted well, tnx Claude;
3. Drawn points are reused;
4. Icon updated;
5. Beer is gone.. ups, did I say too much ;)

Thank you for the link. Actually it helped alot in debuging ;)

Script is in the attachment. Any feedback appreciated.
Logged

BOB_I_Ts

  • Full Member
  • ***
  • Posts: 157
    • View Profile
    • Anim8rOrg
Re: new - advanced_plane_plugin - available ;)
« Reply #13 on: January 22, 2008, 06:23:02 am »

 :) cool plane with divisions another thing easily could add is scale_x and scale_z to the parametesr
Code: [Select]
#parameter("length", float, 10.0, 0.01, 99999, scale,scale_x);
#parameter("width", float, 10.0, 0.01, 99999, scale,scale_z);
then after plane is created the user could use the non uniform scale tool in top viewpoint to scale both length and width using just the mouse
Logged

kingku

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: new - advanced_plane_plugin - available ;)
« Reply #14 on: January 22, 2008, 11:34:22 pm »

Wow cool script. I'll definitely be using it in the future. :)
Logged
Pages: [1] 2