CGTalk > Software > Maxon Cinema 4D
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 07-01-2013, 12:22 PM   #1
dflamholc
New Member
portfolio
David Flamholc
VFX Supervisor, 3D Generalist
Caravan Film
London, United Kingdom
 
Join Date: Apr 2010
Posts: 17
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
 
Old 07-02-2013, 07:31 AM   #2
littledevil
Meh
 
littledevil's Avatar
portfolio
Ferdinand
Germany
 
Join Date: Aug 2002
Posts: 616
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-02-2013 at 07:35 AM.
 
Old 07-02-2013, 11:20 AM   #3
douwe
Know-it-All
 
douwe's Avatar
portfolio
douwe
Brussels, Belgium
 
Join Date: May 2010
Posts: 472
Nice one, Ferdinand.
Thanks a lot.
__________________
-----------> douwe on vimeo
 
Old 07-02-2013, 11:45 AM   #4
dflamholc
New Member
portfolio
David Flamholc
VFX Supervisor, 3D Generalist
Caravan Film
London, United Kingdom
 
Join Date: Apr 2010
Posts: 17
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
 
Old 07-02-2013, 01:50 PM   #5
littledevil
Meh
 
littledevil's Avatar
portfolio
Ferdinand
Germany
 
Join Date: Aug 2002
Posts: 616
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.
 
Old 07-03-2013, 10:34 AM   #6
dflamholc
New Member
portfolio
David Flamholc
VFX Supervisor, 3D Generalist
Caravan Film
London, United Kingdom
 
Join Date: Apr 2010
Posts: 17
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
 
Old 07-03-2013, 02:27 PM   #7
littledevil
Meh
 
littledevil's Avatar
portfolio
Ferdinand
Germany
 
Join Date: Aug 2002
Posts: 616
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.
 
Old 07-04-2013, 02:18 PM   #8
dflamholc
New Member
portfolio
David Flamholc
VFX Supervisor, 3D Generalist
Caravan Film
London, United Kingdom
 
Join Date: Apr 2010
Posts: 17
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
 
Old 07-04-2013, 02:18 PM   #9
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,480
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 01:38 PM.


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