mmerchante / instanceAlongCurve

Maya API Node for interactive instancing of shapes along curves.
MIT License
123 stars 26 forks source link

mapping a texture to attribute #5

Closed firas3d closed 8 years ago

firas3d commented 8 years ago

hi mariano,

would be great if we can connect a ramp to amplitude, currently the connection is possible but the effect is not working.

i guess the plugin need to map the u or v coordinate to curve length.

this feature will create very nice animatable effects.

all the best, firas.

mmerchante commented 8 years ago

Hey Firas!

I'm not sure I'm understanding the idea. All ramps are evaluated based on the curve length, and the amplitude works as a multiplier of that curve. The ramp curve can also be animated per key (position/value), so that should do the trick, I guess?

Also note that the ramp values can be over 1.0, so the amplitude value is just to improve usability.

Maybe you can show a small example of the effect you want to build?

Thanks! Mariano.

firas3d commented 8 years ago

Hi Mariano, am creating data visualization .. am connecting my data to instanceAlongCurveLocatorShape.positionRamp[] .. thats great and working perfect.

now, i need to play with the _multiplier _ using a texture mapped along the curve (using texture ramp for example)

if you try to connect a texture ramp to multiplier, you'll see that its not mapped along curve.

if am not very clear, then i'll send a picture :)

mmerchante commented 8 years ago

Ohh, I understand now.

The thing with trying to evaluate the texture in uv space for such a specific case is that it would make the plugin code too hardcoded.

What if you try to premultiply the data you connect to positionRamp[]? Based on the ramp key time you can know where in the curve you are (it's normalized).

If that doesn't work, I'll see if I can find a way to make the texture trick work!

firas3d commented 8 years ago

thanks, am already using the connections of positionRamp from custom attributes.

but reading values from texture has very powerful use, because we can use all types of blending and laying textures. It opens all the nodes to control the values.

Best, firas.

mmerchante commented 8 years ago

Hey Firas,

I've just pushed the feature to master (see commit). Now if you connect a texture node (such as ramp) to any amplitude, it will evaluate the texture over the UV space in a straight line, depending on each normalized position.

Right now it only works with texture nodes and amplitude, but it could be extended to other attributes. However, I'm wary of it, because it may impact negatively the compute method's performance.

A small example with a ramp connected to pos/rot/scale:

image

Hope that helps! Mariano.

mmerchante commented 8 years ago

I'm starting to see the benefit of this method. Using a fractal, for example, an advanced user has much more control over the simple random of my code.

It would be interesting to evaluate 3D textures in space, with the specific points over the curve... it requires to evaluate the curve a few more times, but it may be interesting!

image