POV-Ray : Newsgroups : moray.win : SimCloth.lua plugin (Cloth simulation of MegaPov) Server Time
14 May 2024 06:04:16 EDT (-0400)
  SimCloth.lua plugin (Cloth simulation of MegaPov) (Message 12 to 21 of 21)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: leseur sylvain
Subject: Re: SimCloth.lua plugin (Cloth simulation of MegaPov)
Date: 22 Oct 2004 03:58:40
Message: <4178bdb0$1@news.povray.org>
Thanks Stephen.
Friendly
Sylvain


news:41785f15$1@news.povray.org...
> > Great ! But not easy and slow....
> > Is it possible to get a rounded nappe ?
> > Friendly
> > Sylvain
> The simcloth{} object will only accept a rectangular grid (N1xN2).
> You can fake a round nappe by having the texture with transparent parts.
>
> See picture in moray.binaries
>    simcloth_round_nappe
>
> The current plugin will not let you have more than one plugin.
>    'can not re-declare a function'
> Will be fixed in next update.
>
> Stephen
>
>


Post a reply to this message

From: Andre de Leiradella
Subject: Re: SimCloth.lua plugin (Cloth simulation of MegaPov)
Date: 22 Oct 2004 08:55:00
Message: <web.417902cbf62557f857904ff10@news.povray.org>
"StephenS" <sshonfield(at)ottawa(dot)net> wrote:
> > Great ! But not easy and slow....
> > Is it possible to get a rounded nappe ?
> > Friendly
> > Sylvain
> The simcloth{} object will only accept a rectangular grid (N1xN2).
> You can fake a round nappe by having the texture with transparent parts.
>
> See picture in moray.binaries
>    simcloth_round_nappe
>
> The current plugin will not let you have more than one plugin.
>    'can not re-declare a function'
> Will be fixed in next update.
>
> Stephen


Hi Stephen,

Could you provide more info about the error message? Maybe I can help you
correct the bug.

I took a look at SimCloth.lua and I have a couple of sugestions:

1) In methods listcloth, listsim and listUDO it'll be better to declare f as
a local variable instead of as a parameter (e.g. function
SimCloth:listsim() local f="" ... return f end). Don't forget to remove the
parameter when you call those methods (e.g. self:listsim() instead of
self:listsim(f))

2) You use dostring at some places to declare global variables (e.g.
dostring("Distance="..self.core:povtolua(self.Clothvalue[1]))). Plugins
should not use global variables since you never now if another plugin will
use a global variable with the same name. It'll be better to rewrite those
as

local Distance=dostring(self.core:povtolua(self.Clothvalue[1]))

You don't have to change code where those variables are used though.

Regards,

Andre de Leiradella


Post a reply to this message

From: Paolo Gibellini
Subject: Re: SimCloth.lua plugin (Cloth simulation of MegaPov)
Date: 22 Oct 2004 12:06:17
Message: <41792ff9@news.povray.org>
> A plugin to help with creating a cloth file (.cth), and passing on
> parameters to the simcloth{} object.
Nice tool, thank you!

But I have a little problem.
It works fine with the included samples, but in my test scene
I'm not able to assign a material to the object: I've used standard
"black_white_cow" material and MegaPov (1.0) returns with this error:

texture { Black_White_Cow <----ERROR
Parse Error: No matching } in 'texture', material identifier found instead

Perhaps the quesion is: how can I made a texture (not a material) with
Moray?

Thank you in advance,
;-)
Paolo Gibellini


Post a reply to this message

From: Marc Jacquier
Subject: Re: SimCloth.lua plugin (Cloth simulation of MegaPov)
Date: 22 Oct 2004 13:32:39
Message: <41794437@news.povray.org>

41792ff9@news.povray.org...
> Perhaps the quesion is: how can I made a texture (not a material) with
> Moray?
>
> Thank you in advance,
> ;-)
Easy to do but not evident :-)
Just right-click on the material in the material editor, then click on
"Property/rename" in the scrolldown, then check "This is a mesh2..." box
done :D

Marc


Post a reply to this message

From: StephenS
Subject: Re: SimCloth.lua plugin (Cloth simulation of MegaPov)
Date: 23 Oct 2004 06:17:13
Message: <417a2fa9$1@news.povray.org>
> Hi Stephen,
>
> Could you provide more info about the error message? Maybe I can help you
> correct the bug.
Sorry for the confusion. The error message is from Pov-Ray. The solution was
also provided, use #undef first and then redefine. I was using a function
to contain Morays transformations, so I can apply them to the mesh being
created.
        pov:write("#declare Object_trans = transform{")
        pov:transforms(self.xforms)
        pov:write("  }")
...
Pov-Ray code
      #local f_Trans = function {transform {Object_trans}}
...
Pov-Ray code
      #local xtemp=f_Trans(tempx,tempy,tempz).x;
      #local ytemp=f_Trans(tempx,tempy,tempz).y;
      #local ztemp=f_Trans(tempx,tempy,tempz).z;
To correct the error I add this to the end of the output
        pov:write("#undef Object_trans")

> I took a look at SimCloth.lua and I have a couple of sugestions:
Suggestions are most welcome :-)

> 1) In methods listcloth, listsim and listUDO it'll be better to declare f
as
> a local variable instead of as a parameter (e.g. function
> SimCloth:listsim() local f="" ... return f end). Don't forget to remove
the
> parameter when you call those methods (e.g. self:listsim() instead of
> self:listsim(f))
At one time I was having problems creating and using Lua functions (basic
understanding). When I slowly started to get things to work I had this
format self:listsim(f), I've been afraid the change anything ever since :-)

> 2) You use dostring at some places to declare global variables (e.g.
> dostring("Distance="..self.core:povtolua(self.Clothvalue[1]))). Plugins
> should not use global variables since you never now if another plugin will
> use a global variable with the same name. It'll be better to rewrite those
> as
>
> local Distance=dostring(self.core:povtolua(self.Clothvalue[1]))
>
> You don't have to change code where those variables are used though.
>
> Regards,
>
> Andre de Leiradella
I wanted to be able to use a text string, so I could:
   enter simple math expressions, 3+1/16
   use some declared variables, that the Lua plugin will understand
(wireframe)
      Precision=2
      9*Precision
   simple pre-defined substitutions, Pov-Ray syntax to Lua syntax
      from 'degrees' (pov) to 'deg' (Lua)

The dostring() seemed to be the only way to solve this, and have the Lua
plugin understand the resulting number for use in wireframes.

Thank you for looking at the code and suggesting better ways of doing
things. I will start using both immediately.

Stephen


Post a reply to this message

From: Marc Jacquier
Subject: Re: SimCloth.lua plugin (Cloth simulation of MegaPov)
Date: 23 Oct 2004 06:43:58
Message: <417a35ee@news.povray.org>

417a2fa9$1@news.povray.org...
> I wanted to be able to use a text string, so I could:
>    enter simple math expressions, 3+1/16
>    use some declared variables, that the Lua plugin will understand
And that's great :D

Marc


Post a reply to this message

From: StephenS
Subject: SimCloth.lua plugin 1a1
Date: 24 Oct 2004 14:21:30
Message: <417bf2aa@news.povray.org>
SimCloth1a1.zip and
SimCloth_Samples_1a.zip
now available for download linked from
http://ca.geocities.com/morayplugin
Comments welcome.

Stephen


Post a reply to this message

From: Paolo Gibellini
Subject: Re: SimCloth.lua plugin (Cloth simulation of MegaPov)
Date: 25 Oct 2004 03:40:51
Message: <417cae03$1@news.povray.org>
> Easy to do but not evident :-)
> Just right-click on the material in the material editor, then click on
> "Property/rename" in the scrolldown, then check "This is a mesh2..." box
> done :D
Thank you for the tip!
;-)
Paolo


Post a reply to this message

From: StephenS
Subject: Re: SimCloth1a3.lua plugin
Date: 1 Nov 2004 06:35:35
Message: <41861f87@news.povray.org>
SimCloth1a3.zip
SimCloth_Samples1a1.zip
now available for download linked from
http://ca.geocities.com/morayplugin

You can now select a material or texture. If 'texture' has an entry then
material is ignored. Wind pigment has moved to this new control.

Constraints are done by the colour of an image map RGB for x,y,z; if I get
it working fully :-)
For a 30x30 simcloth{} my plugin gives(watch for word wraps)
...
#local f_Constraint = function {pigment{Material2}}
#local I=0;
#while (I <= 30)
  #local J=0;
  #while (J <= 30)
#write(file,(I*30)+I+J,",",f_Constraint(I/30,J/30,0).x,",",f_Constraint(I/30
,J/30,0).y,",",f_Constraint(I/30,J/30,0).z,"\n")
    #set J=J+1;
  #end
  #set I=I+1;
#end
...
However the resulting simcloth file has
...
217, 0.000000000000, 0.000000000000, 0.000000000000,
248, 0.000000000000, 0.000000000000, 0.000000000000,
279, 0.262744992971, 0.262744992971, 0.262744992971,
310, 0.260048985481, 0.260048985481, 0.260048985481,
341, 0.262744992971, 0.262744992971, 0.262744992971,
...
The individual indexes can have different values but the x,y,z seem to
always be the same. Still working on a solution.

Comments welcome.

Stephen


Post a reply to this message

From: StephenS
Subject: SimCloth_Samples updated
Date: 1 Dec 2004 22:18:20
Message: <41ae897c$1@news.povray.org>
SimCloth_Samples1a2.zip now available for download linked from
http://ca.geocities.com/morayplugin

Comments welcome.

Stephen


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.