Jump to content

randomize edges and points translation/extrusion


Recommended Posts

hello everybody,

I am having big headache with rand().

I want to randomize extrusion of edges or translation of points but me not understand how.

I make grid sop and I select all edges on far right (3 edges) and I append polyextrude sop. Now I want to extrude these 3 edges in x direction but I don't want them all to extrude same time. I want to randomize the extrusion so maybe 1st edge is extruded 1.0 2nd edge is extruded 1.5, etc.

I also tried using points and connecting point sop with no luck when trying to translate random points..

I want to do animation so they start extruding and different times but end up in same place like at frame 100. I thought clamp would be good idea for this animation but I am lost.

Any help you give makes me much thankful,

Perry

Link to comment
Share on other sites

I want to do animation so they start extruding and different times but end up in same place like at frame 100. I thought clamp would be good idea for this animation but I am lost.

13048[/snapback]

Heya renderpipe,

I think the trick in this case is that the polyextrude SOP will no allow you to easily cook individual edge extrusions [as far as I can tell].

If you are dealing with a simple-ish case of 3 faces that need to get animated, I would suggest putting down three separate polyextrude SOP, and animating their values by hand [to affect only the desired edges].

I think the trick in this case, would be to isolate the individual edges that you wish to animate, extrude them individually, then merge them into one big piece of geometry.

As a side note, this approach sets off a few red flags in my head, as you will probably run into a situation where your point count is likely to change midway through the animation [when the extrution is 0 length - a facet sop down the chain may consolidate the points] which is never a good thing.

Hope this helps a little bit,

Cheers,

G

Link to comment
Share on other sites

Heya renderpipe,

Just had a thought, if the above does not work for you, you might want to try the approach below. simply save the code segment into a file, and source it via the textport (make sure you source it into a valid piece of geometry though).

The trick in this case is that the line segment has a predictable point order, which allows for an easy way of breaking the curve into smaller segments. Applying a similar procedure to a grid is also possible, but the expression for the deletion will be slightly more involved. :blink:

Let me know if this sheds some light on the matter.

Cheers,

G

# Automatically generated script: Thursday August 05, 13:26
\set noalias = 1
set saved_path = `execute("oppwf")`
opcf /obj/model

# Node add1
opadd -n add add1
oplocate -x 1.86789 -y 1.58341 add1
opparm add1 stdswitcher ( 0 0 ) keep ( off ) points ( 1 )  remove ( off ) switcher ( 0 0 ) prims ( 1 )  group ( "" ) add ( all ) inc ( 2 ) attrname ( "" ) closedall ( off ) usept0 ( on ) pt0 ( 0 0 0 ) weight0 ( 1 ) prim0 ( "" ) closed0 ( off )
chlock add1 -*chautoscope add1 -*opcolor -c 0.7 0.7 0.7 add1
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -c off -C off -p off -e on -b off add1
opcf /obj/model

# Node copy1
opadd -n copy copy1
oplocate -x 1.86789 -y 0.458413 copy1
opparm copy1 sourceGrp ( "" ) templateGrp ( "" ) stdswitcher ( 0 0 ) ncy ( 100 ) nml ( on ) cum ( on ) xOrd ( srt ) rOrd ( xyz ) t ( 0 0 -0.05 ) r ( 0 0 0 ) s ( 1 1 1 ) p ( 0 0 0 ) scale ( 1 ) vlength ( on ) newg ( off ) preservegroups ( off ) copyg ( 'copyGroup$CY' ) stamp ( off ) param1 ( "" ) val1 ( 0 ) param2 ( "" ) val2 ( 0 ) param3 ( "" ) val3 ( 0 ) param4 ( "" ) val4 ( 0 ) param5 ( "" ) val5 ( 0 ) param6 ( "" ) val6 ( 0 ) param7 ( "" ) val7 ( 0 ) param8 ( "" ) val8 ( 0 ) param9 ( "" ) val9 ( 0 ) param10 ( "" ) val10 ( 0 ) param11 ( "" ) val11 ( 0 ) param12 ( "" ) val12 ( 0 ) param13 ( "" ) val13 ( 0 ) param14 ( "" ) val14 ( 0 ) param15 ( "" ) val15 ( 0 ) param16 ( "" ) val16 ( 0 ) param17 ( "" ) val17 ( 0 ) param18 ( "" ) val18 ( 0 ) param19 ( "" ) val19 ( 0 ) param20 ( "" ) val20 ( 0 ) param21 ( "" ) val21 ( 0 ) param22 ( "" ) val22 ( 0 ) param23 ( "" ) val23 ( 0 ) param24 ( "" ) val24 ( 0 ) param25 ( "" ) val25 ( 0 ) param26 ( "" ) val26 ( 0 ) param27 ( "" ) val27 ( 0 ) param28 ( "" ) val28 ( 0 ) param29 ( "" ) val29 ( 0 ) param30 ( "" ) val30 ( 0 ) param31 ( "" ) val31 ( 0 ) param32 ( "" ) val32 ( 0 ) param33 ( "" ) val33 ( 0 ) param34 ( "" ) val34 ( 0 ) param35 ( "" ) val35 ( 0 ) param36 ( "" ) val36 ( 0 ) param37 ( "" ) val37 ( 0 ) param38 ( "" ) val38 ( 0 ) param39 ( "" ) val39 ( 0 ) param40 ( "" ) val40 ( 0 ) param41 ( "" ) val41 ( 0 ) param42 ( "" ) val42 ( 0 ) param43 ( "" ) val43 ( 0 ) param44 ( "" ) val44 ( 0 ) param45 ( "" ) val45 ( 0 ) param46 ( "" ) val46 ( 0 ) param47 ( "" ) val47 ( 0 ) param48 ( "" ) val48 ( 0 ) param49 ( "" ) val49 ( 0 ) param50 ( "" ) val50 ( 0 ) doattr ( off ) setpt ( * ) setprim ( "" ) setvtx ( "" ) mulpt ( "" ) mulprim ( "" ) mulvtx ( "" ) addpt ( "" ) addprim ( "" ) addvtx ( "" ) subpt ( "" ) subprim ( "" ) subvtx ( "" )
chlock copy1 -*chautoscope copy1 -*opcolor -c 0.7 0.7 0.7 copy1
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -c off -C off -p off -e on -b off copy1
opcf /obj/model

# Node add2
opadd -n add add2
oplocate -x 1.86789 -y -0.666587 add2
opparm add2 stdswitcher ( 1 1 ) keep ( off ) points ( 1 )  remove ( off ) switcher ( 0 0 ) prims ( 1 )  group ( "" ) add ( all ) inc ( 2 ) attrname ( "" ) closedall ( off ) usept0 ( off ) pt0 ( 0 0 0 ) weight0 ( 1 ) prim0 ( * ) closed0 ( off )
chlock add2 -*chautoscope add2 -*opcolor -c 0.7 0.7 0.7 add2
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -c off -C off -p off -e on -b off add2
opcf /obj/model

# Node delete1
opadd -n delete delete1
oplocate -x 1.86789 -y -1.79159 delete1
chblockbegin
chadd -t 0 0 delete1 rangeend
chkey -t 0 -v 0 -m 0 -A 0 -F '$N' delete1/rangeend
chkey -t 0 -v 0 -m 0 -a 0 delete1/rangeend
chblockend
opparm delete1 group ( "" ) negate ( keep ) entity ( point ) geotype ( all ) stdswitcher ( 0 0 0 0 ) groupop ( pattern ) filter ( 1 ) pattern ( '`param("segment", 0)`-`param("segment", 0)+1`' ) range ( 0 rangeend ) select ( 1 2 ) boundtype ( usebbox ) size ( 1 1 1 ) t ( 0 0 0 ) dir ( 0 0 1 ) angle ( 180 ) camerapath ( "" ) affect ( 1 ) degenerate ( off ) zaf ( off ) doopen ( off ) tol ( 0.001 ) removegrp ( on ) keeppoints ( off )
chlock delete1 -*chautoscope delete1 -*opcolor -c 0.7 0.7 0.7 delete1
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -c off -C off -p off -e on -b off delete1
opcf /obj/model

# Node copy2
opadd -n copy copy2
oplocate -x 1.86789 -y -4.04159 copy2
chblockbegin
chadd -t 0 0 copy2 val1
chkey -t 0 -v 0 -m 0 -A 0 -F '$CY-1' copy2/val1
chkey -t 0 -v 0 -m 0 -a 0 copy2/val1
chblockend
opparm copy2 sourceGrp ( "" ) templateGrp ( "" ) stdswitcher ( 1 1 ) ncy ( 100 ) nml ( on ) cum ( on ) xOrd ( srt ) rOrd ( xyz ) t ( 0 0 0 ) r ( 0 0 0 ) s ( 1 1 1 ) p ( 0 0 0 ) scale ( 1 ) vlength ( on ) newg ( off ) preservegroups ( off ) copyg ( 'copyGroup$CY' ) stamp ( on ) param1 ( segment ) val1 ( val1 ) param2 ( "" ) val2 ( 0 ) param3 ( "" ) val3 ( 0 ) param4 ( "" ) val4 ( 0 ) param5 ( "" ) val5 ( 0 ) param6 ( "" ) val6 ( 0 ) param7 ( "" ) val7 ( 0 ) param8 ( "" ) val8 ( 0 ) param9 ( "" ) val9 ( 0 ) param10 ( "" ) val10 ( 0 ) param11 ( "" ) val11 ( 0 ) param12 ( "" ) val12 ( 0 ) param13 ( "" ) val13 ( 0 ) param14 ( "" ) val14 ( 0 ) param15 ( "" ) val15 ( 0 ) param16 ( "" ) val16 ( 0 ) param17 ( "" ) val17 ( 0 ) param18 ( "" ) val18 ( 0 ) param19 ( "" ) val19 ( 0 ) param20 ( "" ) val20 ( 0 ) param21 ( "" ) val21 ( 0 ) param22 ( "" ) val22 ( 0 ) param23 ( "" ) val23 ( 0 ) param24 ( "" ) val24 ( 0 ) param25 ( "" ) val25 ( 0 ) param26 ( "" ) val26 ( 0 ) param27 ( "" ) val27 ( 0 ) param28 ( "" ) val28 ( 0 ) param29 ( "" ) val29 ( 0 ) param30 ( "" ) val30 ( 0 ) param31 ( "" ) val31 ( 0 ) param32 ( "" ) val32 ( 0 ) param33 ( "" ) val33 ( 0 ) param34 ( "" ) val34 ( 0 ) param35 ( "" ) val35 ( 0 ) param36 ( "" ) val36 ( 0 ) param37 ( "" ) val37 ( 0 ) param38 ( "" ) val38 ( 0 ) param39 ( "" ) val39 ( 0 ) param40 ( "" ) val40 ( 0 ) param41 ( "" ) val41 ( 0 ) param42 ( "" ) val42 ( 0 ) param43 ( "" ) val43 ( 0 ) param44 ( "" ) val44 ( 0 ) param45 ( "" ) val45 ( 0 ) param46 ( "" ) val46 ( 0 ) param47 ( "" ) val47 ( 0 ) param48 ( "" ) val48 ( 0 ) param49 ( "" ) val49 ( 0 ) param50 ( "" ) val50 ( 0 ) doattr ( off ) setpt ( * ) setprim ( "" ) setvtx ( "" ) mulpt ( "" ) mulprim ( "" ) mulvtx ( "" ) addpt ( "" ) addprim ( "" ) addvtx ( "" ) subpt ( "" ) subprim ( "" ) subvtx ( "" )
chlock copy2 -*chautoscope copy2 -*opcolor -c 0.7 0.7 0.7 copy2
opset -d on -r on -h off -f off -y off -t off -l off -s off -u off -c off -C on -p on -e on -b off copy2
opcf /obj/model

# Node polyextrude2
opadd -n polyextrude polyextrude2
oplocate -x 1.86789 -y -2.91659 polyextrude2
chblockbegin
chadd -t 0 0 polyextrude2 ltx
chkey -t 0 -v 0 -m 0 -A 0 -F 'rand(param("segment",0))*$F/100' polyextrude2/ltx
chkey -t 0 -v 0 -m 0 -a 0 polyextrude2/ltx
chblockend
opparm polyextrude2 group ( p0-1 ) stdswitcher ( 0 0 0 0 ) lrst ( srt ) lxyz ( xyz ) lt ( ltx 0 0 ) lr ( 0 0 0 ) ls ( 1 1 ) inset ( 0 ) localsym ( symmnone ) keepshared ( off ) grst ( srt ) gxyz ( xyz ) gt ( 0 0 0 ) gr ( 0 0 0 ) gs ( 1 1 1 ) divs ( 2 ) outputfront ( on ) outputback ( off ) outputside ( on ) delzeroareasides ( off ) delsharedsides ( on ) consolidate ( all ) newg ( off ) frontgrp ( extrudeFront ) backgrp ( extrudeBack ) sidegrp ( extrudeSide )
chlock polyextrude2 -*chautoscope polyextrude2 -*opcolor -c 0.7 0.7 0.7 polyextrude2
opset -d off -r off -h off -f off -y off -t off -l off -s off -u off -c off -C off -p off -e on -b off polyextrude2

opcf /obj/model
opcf /obj/model
opwire -n add1 -0 copy1
opcf /obj/model
opwire -n copy1 -0 add2
opcf /obj/model
opwire -n add2 -0 delete1
opcf /obj/model
opwire -n polyextrude2 -0 copy2
opcf /obj/model
opwire -n delete1 -0 polyextrude2
opcf $saved_path

Link to comment
Share on other sites

Hello Keyframe,

Thank you for reply. I tried poly extrusions with groups selection and it works ok but I have to create many groups and polyextrusions for many variations. It's ok though.

For the script example you posted, I need little bit more help. I never source text file before so I dunno what to do.

I save your script to my d:\test.txt. In texport I get error can't open d:\test.txt

Is there special place I must put this file? with special extension?

I not understand I need valid geometry. Are you saying in textport I should cd to valid geometry folder?

I check help source but it no say anything where to put file.

Thank you for help

Link to comment
Share on other sites

I save your script to my d:\test.txt. In texport I get error can't open d:\test.txt

13067[/snapback]

Heya Renderpipe,

What I would do, under the windows platform, is first verify that the file does in fact exist in the location that you specified. Also ensure that it didn't pickup some funky extension that windows hides on certain systems. I've often saved files with a certain extension only to find out that windows decided to attach a different extension to it. Just in case I made a mistake. :blink:

As far as sourcing the file, you would need to create a geometry object (call it "model"), open up a textport, type "cd /obj/model/", and then in the textport, type "source foo", where foo is the full path to the file that you've created above.

Once the nodes are created, scrub the time line.

Let me know if this setup points you in the right direction.

Cheers,

G

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...