How to combine a Torus SOP with a moviefilein TOP and make the torus draggable/movable

Hello,

there is a torus SOP which is linked to a Geometry COMP. This Geometry COMP is connected to a render TOP which is then connected to an out TOP.
There is also one image in a moviefilein TOP which is connected to a null TOP. This is the background image.

How to combine the null TOP containing the background image and the out TOP containing the torus with each other so that the torus is draggable in the composition?

I combined these two operators with a composite TOP with the operation OVER and the tried with a mousein CHOP, select CHOP, panel CHOP, chopexecute DAT to move the torus, but it didn’t work.

What I would like to create is that the torus is placed on the right side of the screen and can be dragged with the mouse to the centre and then another image is displayed with transparency (from invisible to visible) or size (from zero to full size).

So I have the following questions:

  1. How can the null TOP containing the background image and the out TOP containing the torus be combined with each other where the torus is positioned on the right side of the screen/on the background image?
  2. How can the torus be made draggable/movable with the mouse?
  3. How can the torus be moved to the centre of the screen so that another image is displayed (using transparency or size)?

Move torus with mouse over background.toe (9.9 KB)

Well I hope this is not for a class, but when I think of moving things around it is often best to think of 3D geometry and move it around in x,y,z either with a transform or in a geo. So if you solve for moving your torus first with mouse, you can put it in its own geo1 (see attached). Then I would put your background in a separate geo2. You can switch the image feeding this geo with a constant material and control the switch with your mouse position. Finally just render both geos. I am not quite clear on your third question, but you can figure that out.

Hope this helps. If you get stuck the Learn section here is really good to try out:

https://learn.derivative.ca/courses/100-fundamentals/lessons/102-tops-working-with-images/

Hello @gordharris,

Thank you. Your explanation and tutorial helps a lot.
It is not a class work. I just want to try out new things like moving, combining and interacting with different operators.

Could I also ask you another question: Now, we have that when we move with the mouse to x=1.5 then image 1 switch to image 2.
If I have three images of which one of them is the background image, how can it be made that when the mouse reaches x=1.5, image 1 is displayed over the background image and when the mouse moves on to 2.5 the other image 2 is displayed but not image 1 ? Where and how can the range be specified ?

I tried it with a Composite TOP, but it didn’t work. I don’t know where and how the range for the individual images and the mouse movement should be defined.

Is it also possible to restrict not only the tx channels but also the tx channels of the mouse?

@anarts sorry for delay - deep into debugging my new piece last couple days. In Touch Designer there are usually several ways to accomplish the same thing. I would suggest a Switch TOP with an index that you scale with a Math CHOP to range and offset your mouse coordinate. Changing the index from 0 to 1 to 2 etc will route or switch any TOP images or movies etc you want. Watch this tutorial: Routing Your Content – TouchDesigner Curriculum

If you are not familiar with the Math CHOP yet it is a real workhorse and your best friend in calibrating various sensors and input devices etc. In electronics we call what his does gain (for multiply) and offset (for add or subtract). Check out a lesson here: CHOP Math – TouchDesigner Curriculum

I highly recommend the whole beginners learning set on Courses – TouchDesigner Curriculum so if you have not done those yet it will answer most of your questions. Another thing I do when stuck is just google something like “youtube - how to switch images with mouse movement” or whatever the best way to phrase your question is. In any given project, I usually have to consult the web many times. Another super resource is to look at the Op Snippets for any operator you don’t know well yet - to see how it works. top menu Help/Operator Snippets. Invaluably learning resource and you can cut and past the example that is closest to what you want to do then tweak it to suit your purposes.

Good luck and enjoy experimenting with TouchDesigner - my all time favourite program!

Hope this helps.

Hello @gordharris,

no worries. I appreciate it that you still found time to reply. I followed your recommendation and explanation and it worked out. Thank you!

Great! Have fun and show us what you make! ;=)

Hello @gordharris,

may I ask you something.
I am trying to adapt this scene to 2D instead of 3D by using TOPs instead of SOPs. I am struggling a little bit with making a smaller image move/float across the screen with a noise CHOP. I think it has to do sth with the range but I am not sure. Could you help me with how I need to adapt the range in the math CHOP or do something else so that the image floats across the entire screen ? And to make the smaller image float within the boundaries of the whole screen ?
The background image is 1280x720 in width and height, while the smaller image is 200x100 in width and height.
The noise CHOP has the channels tx and ty and they are connected with the x and y positions of the smaller image container with this code:
op(‘null3’)[‘tx’]*1280
op(‘null3’)[‘ty’]*720

And in the noise the x and y have this code: absTime.seconds*0.25

greyFloat.toe (3.8 KB)

Hi @anarts.

Glad you are making progress. For 2D stuff I suggest you play around with the Transform TOP which is super useful for moving, scaling, rotating images etc. Then apply your noise to the Transform parameters as you please. The layout of container is more for setting up the window, not moving images around. See attached. Hope this helps. Adjust math CHOP range as need-be. Hope this helps. Experiment with Transform - great fun!

greyFloat_revA.toe (6.2 KB)

Hello @gordharris,

Thank you for your reply. It makes things clearer, especially when to use layout parameters and the transform parameters. The trail CHOP is also useful because it gives helpful data, especially in combination with the info CHOP.

I tried to adjust the range in the math CHOP, but the smaller image is still confined to its boundaries and moves only in its boundaries.

How can the range be changed so that it moves across the entire screen ?

@amarts Anna have you watched the 100 series Learn Tutorials yet on Derivative yet?

This one explains Match CHOP pretty well: CHOP Math – TouchDesigner Curriculum

The key to ranging things correctly is to understand that almost any signal can be transformed in two basic ways - expand or shrink its range (such as screen coordinates) by changing its GAIN which is like amplification (increase amplitude) or attenuation (decrease amplitude). You can do that in a math CHOP most easily by multiplying the signal - on Multi-Add page change the Multiply parameter to greater than 1 to increase it or less than 1 to decrease it.

The other way to transform any signal is to OFFSET it (change its limits, or how high and how low it goes). That is most easily done on the Range Page of the Math CHOP.

But I think your problem was that you did not have container2 set to your container1 movie resolution of 1280 x 720. See greyFloat_revB where I fixed this. I hope this helps. I highly recommend the learn tutorials - watch them then try to do it yourself on second viewing. Hope this helps.

greyFloat_revB.toe (6.5 KB)u