using VIEW_3D in PlugNScript

Official support for: bluecataudio.com
Post Reply New Topic
RELATED
PRODUCTS

Post

Hi,

I would like some guidance in using VIEW_3D in skins for PlugNScript, to create 3D widgets.

Is this possible ?

I have created a VIEW_3D, with a single COLOR_SURFACE_3D object. I can see the 3D color surface, and move it with the mouse, but I am completely unable to link the 3D movement to any parameter.

In the example I would like to link movement to dsp.inputXXX

The code is as so ....

<FORMULA_SURFACE formula="cos(2*pi*x)*sin(2*pi*y)*sqrt(1-x^2-y^2)" id="my_formula"
x_min="-1" x_max="1" x_default="0" y_min="-1" y_max="1" y_default="0" z_min="-1" z_max="1" z_default="0"
x_offset=".5" y_offset=".5" z_offset=".5"/>
<VIEW_3D id ="u1" visible="true" width="200" height="200" image="wav_switch.bmp"
transform.tx="dsp.input8"
transform.ty="dsp.input9"
transform.tz="dsp.input10"

cursor="system::hand" >




<COLOR_SURFACE_3D surface_id ="my_formula" x_positions_count="50" y_positions_count="50"
x_param_id="dsp.input8" y_param_id="dsp.input9" z_param_id="dsp.input10"
x_offset="0" y_offset="0" z_offset="0"

x_position="dsp.input8"
y_position="dsp.input9"
z_position="dsp.input10"
>
</COLOR_SURFACE_3D>
</VIEW_3D>

I move the 3d surface around, and/or move knobs which are connect to dsp.inputXXX and nothing happens.


Can you provide some advice - thanks

Digby

Post

Hi,

You cannot directly reference parameters in the transform.tx, ty etc. attributes. In fact the transform.tx, ty and tz fields are themselves parameters that are exposed to the engine.

So what you can do is create link between these parameters and your own (the dsp.inputxx parameters) using PARAM_LINK objects. If the link should be bidirectional, you can use a PARAM_CONNECTION object:
<PARAM_CONNECTION id1="transform.tx" id2="dsp.inputXXX"/>

You also need to make sure you adjust the ranges properly or use a mapping function so that ranges match.

Post

Dear Blue Cat Audio,

Thankyou very much for our reply, it helped.
For my example the PARAM_CONNECTION should like like this
<PARAM_CONNECTION id1="u1.transform.tx" id2="dsp.inputXXX"/>

A few more questions about VIEW_3D if you don't mind ....

1) Are there any examples or tutorials with VIEW_3D?

2)
Can you please confirm that the only objects that can be placed into a VIEW_3D are

COLOR_SURFACE_3D ... and
GRID_3D?

3)
Can any of the 2D objects be placed in a VIEW_3D such as an image, and if so, can it be moved around ?

4)
By default using the mouse on the VIEW_3D rotates the (colour_surface_3d) object. ctrl+alt + mouse translates it.
Can this behaviour be reversed ? so that mouse translates, ctrl+alt + mouse rotates it ?

Kind regards

Digby

Post

Hi Blue Cat,

Still trying to find out more information about VIEW_3D and 3D objects.

Can you please confirm that the only objects that can be placed into a VIEW_3D are

COLOR_SURFACE_3D ... and
GRID_3D?

kind regards

Digby

Post

Hi,

Sorry for the late reply.

3D objects are indeed currently limited to surfaces and grid objects as it has mostly been used to visualize 3D surfaces in our products. The controls for the 3D View cannot be customized at this point either.

We are however working on a new version that lets you write your own OpenGL scripts, so maybe it will help. Can you maybe tell us what you are exactly trying to do so that we can see if what we are preparing would help?

Post

We would like to position one object (or possibly multiple objects, independently) in 3D space. (i.e. left/right, up/down, forward/backwards)

The existing VIEW_3D object gets us 75-80% there.


We would like to represent the positioned object ideally as a sphere, or possibly a cube or an image (like a thumb image).

We would like to see an X-Y-Z axis in the corner


Many thanks

Digby

Post

A sphere is definitely possible using two surfaces for the upper and lower part. But the cube and image are currently not supported. But the full scripted OpenGL view would definitely work for this.

Post

Dear Blue Cat,

Thank you for your reply.
A sphere is definitely possible using two surfaces for the upper and lower part
You can indeed get a sphere like shape using 2 surfaces, but it has a square collar around it, sort of like a square rings of saturn.

Screenshot :

Image

The code to achieve this is

Code: Select all

<FORMULA_SURFACE formula="sqrt( 1 - x*x - y*y)" id="my_formula"
      x_min="-1" x_max="1" x_default="0" y_min="-1" y_max="1" y_default="0" z_min="-1" z_max="1" z_default="0"
      x_offset=".5" y_offset=".5" z_offset=".5"/>
  <FORMULA_SURFACE formula="-sqrt( 1 - x*x - y*y)" id="my_formula2"
     x_min="-1" x_max="1" x_default="0" y_min="-1" y_max="1" y_default="0" z_min="-1" z_max="1" z_default="0"
     x_offset=".5" y_offset=".5" z_offset=".5"/>

 <VIEW_3D id ="u1" visible="true" width="500" height="500" image="wav_switch.bmp"
                     transform.tx="0"
                     transform.ty="0"
                     transform.tz="-5"
                     layout_type="stack"
                 
                      cursor="system::hand" >


        <COLOR_SURFACE_3D id="mycs3d" surface_id ="my_formula" x_positions_count="50" y_positions_count="50"
                          x_param_id="x_axis" y_param_id="y_axis" z_param_id="z_axis"
                          x_offset="0" y_offset="0" z_offset="1000"
                             
                          x_position="-0.5"
                          y_position="0"
                          z_position="0"
                           x_color="#ffff00"
                          opacity="20%"
      >
       </COLOR_SURFACE_3D>
        <COLOR_SURFACE_3D id="mycs3d" surface_id ="my_formula2" x_positions_count="50" y_positions_count="50"
                          x_param_id="x_axis" y_param_id="y_axis" z_param_id="z_axis"
                          x_offset="0" y_offset="0" z_offset="1000"
                             
                          x_position="-0.5"
                          y_position="0"
                          z_position="0"
                           x_color="#ff0000"
                          opacity="20%"
      >
        </COLOR_SURFACE_3D>
Is there a way to get rid of the collar ?

Whats the ETA on the full scripted OpenGL ?

Many thanks


Digby

Post

That's indeed right... since you are drawing the curves on [1;1], the base area is a square... If you don't need a true sphere maybe you can try limiting to [-.7;.7] and see how it looks. There is currently no ETA for the OpenGL scripting release, but if you cantact us by email we can maybe see how to share a beta with you.

Post Reply

Return to “Blue Cat Audio”