Controlling sweepnurb scale by point density on spline?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  07 July 2013
Controlling sweepnurb scale by point density on spline?

Hi guys, would anyone know how to control the scale-spline in a SweepNurbs object, by sampling the density of a spline generated by a tracer object.

I have a torodial spline shape with greater point density where the tracer has travelled slower, and further between points where the tracer has travelled faster. My goal is to see this speed variation represented by the thickness of the sweepnurb.

Thanks in advance for any help, advice or ideas!
cheers. david
 
  07 July 2013
step through the tracers spline control points. the velocity for each point is ((n+1)-n).GetLength(). convert that velocity into your sweep nurbs splinedata (normalize it and add add it as a splineknot). example as a python tag ( the code expects the python tag hosting object to be a sweep nurbs object. the first userdata element of the sweep nurbs object has to be a link field holding the traced spline ) :

http://codepad.org/mbqo9OHx
__________________
There are holes in the sky. Where the rain gets in.
But they're ever so small. That's why the rain is thin.

Last edited by littledevil : 07 July 2013 at 07:35 AM.
 
  07 July 2013
Nice one, Ferdinand.
Thanks a lot.
 
  07 July 2013
Thank you so much! thats amazing i have very limited experience with python but this is so cool! took me a while to understand but now its up and running.

was playing with the 'n' values in the last 'for n' loop and manage to control the min and max thickness there somewhat..

sorry for the follow up questions but would it be tricky to add user data sliders for min/max thickness?

thanks again!
cheers.d
 
  07 July 2013
well it does depend what you do understand as min/max thickness. first of all the max 'thickness' of a sweep nurbs is defined by its profile spline radius. also you have to differ between a percentage and real world units based approach. technically it is perfectly possible to modify the code in such way that you can enter min = 25 cm max = 300 cm and the code then modifies an arbitrary profile spline in such way that it does match your max thickness. also working in real world units would require the code to be aware of the profile spline. you have to do that on your own or pay me for that

here is a commented version with a percentage based min value. i did move the userdata to the python tag. add the user data to the python tag in the following order 1. a link, 2. a real_percentage value.

http://codepad.org/Yt1jzwwP
__________________
There are holes in the sky. Where the rain gets in.
But they're ever so small. That's why the rain is thin.
 
  07 July 2013
Ferdinand,
Thank you so much! this is really helpful
I have experimented a bit with the code myself and for example managed to invert the effect with the rangemap function etc. however there is one issue I wanted to ask about

http://imageshack.us/photo/my-images/209/be1h.png/

there seems to be a problem with interpolation on the spline once one starts moving points around, so that the thickness becomes a bit erratic (?) or it might be me missing something..

I tried to use .MakeCubicSpline(l) instead, but not working so far. is there a way to tell the sweepnurb what spline type to use? would this solve the problem the way i think it would?

The end goal here are quite complicated and dense helix and torodial splines shapes, with deliberate irregularities, where the thickness would visualise speed change along the spline.

depending on your fee and the possibilities I might be interested in getting something more solid set up

thanks so much for your help!
David
 
  07 July 2013
hi,

it is really hard to tell from a picture what is going wrong for you. generally said the greatest weakness of the script is that it does copy the traced spline control points 1:1 into the SplineData control points. that is also why i did choose a linear interpolation as it is the only one, which does not cause problems for overlapping control points. if you want to do it clean you might have to throttle the amount of control points transferred into the SplineData.

to give you a more reliable answer some example files of what you are trying to do would be almost mandatory.

happy rendering,
ferdinand
__________________
There are holes in the sky. Where the rain gets in.
But they're ever so small. That's why the rain is thin.
 
  07 July 2013
hi Ferdinand,

sorry for slow reply. thanks yes that sounds like a good idea, to limit the amount of points transfered.
i'll pm you an example scene as soon as i can

thanks for your help!
cheers
david
 
  07 July 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:55 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.