Re: [PD] Gem - how to get a concave/convex plane

2018-08-05 Thread oliver

Jack wrote:

Hello,

See the new version attached to use a texture.



thanks a bunch, jack ! you're a hero !
(still trying to figure out the shader language magic ...)

that's fantastic ! now (with cyrill's method and yours) i got two 
working solutions for my problem :-)


hugs & kisses !

oliver

___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Gem - how to get a concave/convex plane

2018-08-05 Thread Jack
Hello,

See the new version attached to use a texture.
++

Jack



Le 05/08/2018 à 01:28, oliver a écrit :
> cyrille henry wrote:
>> hello,
>>
>> you can try [curve3d]
> 
> cyrille, jack: thanks a lot for your kind help.
> 
> i tried both your suggestions with some success , but i'm not quite
> there yet.
> 
> 
> 
> i attached an example patch providing both methods and problems.
> 
> 
> basically [curve3d] works well, with a minor issue that can be worked
> around. though i don't understand why it's there.
> 
> the issue is that the applied texture is rotated by 90°. i tried several
> things to correct it ([pix_flip], [pix_coordinate]) but they all messed
> up the texture.
> 
> 
> 
> the vertex-shader approach of jack produces the shape i was looking for,
> but unfortunately doesn't allow texture mapping. or at least i wasn't
> able to figure out how to do it.
> 
> thanks for any further thoughts ...
> 
> best
> 
> oliver
> 
> 
> ___
> Pd-list@lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> 
> https://lists.puredata.info/listinfo/pd-list
> 



mesh_deformation.pd
Description: application/extension-pd
uniform sampler2D tex0;

varying vec4 vertColor;

void main() {
  vec4 image = texture2D(tex0, gl_TexCoord[0].st);
  gl_FragColor = image * vertColor;
}#define PI 3.1415926535897932384626433832795

uniform float deformation;

varying vec4 vertColor;

void main() {
  vertColor = gl_Color;
  gl_TexCoord[0] = gl_MultiTexCoord0;
  vec4 pos_vertex = gl_Vertex;
  float add_y = cos(pos_vertex.x * PI * 0.5) * deformation * pos_vertex.y;
  pos_vertex.y += add_y;
  gl_Position = gl_ModelViewProjectionMatrix * pos_vertex;
}___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Gem - how to get a concave/convex plane

2018-08-05 Thread Oliver



>> basically [curve3d] works well, with a minor issue that can be worked
>around. though i don't understand why it's there.
>Certainlly because I made a mistake with S T coordinate when I code
>this object, and you  are the 1st one to notice it.
>I don't know if it's a bug that should be corrected, or a bug that is
>there for so long that it should stay for compatibility.
>anyway, the workaround is easy.
>

Indeed, and yes i too think compatibility is important. 
A suggestion for a possible Future release: maybe you could add something like 
a "flip_texture" or "tex_coordinate" function to [curve3d]. (would be a great 
Feature anyway ;-))

Best

Oliver

___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Gem - how to get a concave/convex plane

2018-08-05 Thread cyrille henry



Le 05/08/2018 à 01:28, oliver a écrit :

cyrille henry wrote:

hello,

you can try [curve3d]


cyrille, jack: thanks a lot for your kind help.

i tried both your suggestions with some success , but i'm not quite there yet.



i attached an example patch providing both methods and problems.


basically [curve3d] works well, with a minor issue that can be worked around. 
though i don't understand why it's there.

Certainlly because I made a mistake with S T coordinate when I code this 
object, and you  are the 1st one to notice it.
I don't know if it's a bug that should be corrected, or a bug that is there for 
so long that it should stay for compatibility.
anyway, the workaround is easy.

best
c



the issue is that the applied texture is rotated by 90°. i tried several things 
to correct it ([pix_flip], [pix_coordinate]) but they all messed up the texture.



the vertex-shader approach of jack produces the shape i was looking for, but 
unfortunately doesn't allow texture mapping. or at least i wasn't able to 
figure out how to do it.

thanks for any further thoughts ...

best

oliver


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list



___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Gem - how to get a concave/convex plane

2018-08-04 Thread oliver

cyrille henry wrote:

hello,

you can try [curve3d]


cyrille, jack: thanks a lot for your kind help.

i tried both your suggestions with some success , but i'm not quite 
there yet.




i attached an example patch providing both methods and problems.


basically [curve3d] works well, with a minor issue that can be worked 
around. though i don't understand why it's there.


the issue is that the applied texture is rotated by 90°. i tried several 
things to correct it ([pix_flip], [pix_coordinate]) but they all messed 
up the texture.




the vertex-shader approach of jack produces the shape i was looking for, 
but unfortunately doesn't allow texture mapping. or at least i wasn't 
able to figure out how to do it.


thanks for any further thoughts ...

best

oliver
#N canvas 516 50 834 744 10;
#X declare -lib Gem -path Gem;
#X obj 8 11 cnv 15 100 60 empty empty empty 20 12 0 14 -228856 -66577
0;
#N canvas 24 469 455 304 gemwin 0;
#X obj 132 182 gemwin;
#X obj 67 89 outlet;
#X obj 67 10 inlet;
#X obj 67 41 route create;
#X msg 67 70 set destroy;
#X msg 142 68 set create;
#X msg 198 112 destroy;
#X msg 132 112 create \, 1;
#X obj 294 56 gemhead;
#X obj 294 80 world_light;
#X obj 207 134 loadbang;
#X obj 292 20 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X msg 207 155 lighting 1;
#X obj 173 25 loadbang;
#X connect 2 0 3 0;
#X connect 3 0 4 0;
#X connect 3 0 7 0;
#X connect 3 1 5 0;
#X connect 3 1 6 0;
#X connect 4 0 1 0;
#X connect 5 0 1 0;
#X connect 6 0 0 0;
#X connect 7 0 0 0;
#X connect 8 0 9 0;
#X connect 10 0 12 0;
#X connect 11 0 8 0;
#X connect 12 0 0 0;
#X connect 13 0 5 0;
#X restore 24 48 pd gemwin;
#X msg 24 29 destroy;
#X text 20 8 Create window:;
#X obj 126 10 loadbang;
#X msg 126 31 open Gem/examples/data/temp2.JPG, f 33;
#X obj 126 52 s img;
#X obj 8 87 cnv 15 400 330 empty empty CYRILLE'S_METHOD: 120 12 0 16
-204786 -66577 0;
#X obj 144 383 curve3d 3 3;
#X obj 144 252 pix_texture;
#X obj 154 359 r curve3d_1;
#X obj 144 228 pix_image;
#X obj 158 203 r img;
#X obj 144 285 translateXYZ 0 2.5 0, f 13;
#X obj 22 179 gemhead 100;
#X obj 22 228 pix_image;
#X obj 36 203 r img;
#X obj 22 285 translateXYZ -2.5 2.5 0, f 13;
#X obj 22 383 square 1;
#X obj 22 252 pix_texture;
#X obj 144 179 gemhead 90;
#X obj 283 383 curve3d 3 3;
#X obj 283 252 pix_texture;
#X obj 283 228 pix_image;
#X obj 297 203 r img;
#X obj 293 359 r curve3d_2;
#X obj 283 179 gemhead 80;
#X obj 283 285 translateXYZ 2.5 2.5 0, f 13;
#X obj 283 329 rotateXYZ 0 0 90;
#X text 31 127 Original Image on Square:, f 9;
#X text 125 126 Image on desired shape \, but it's rotated 90° CW.
Why ?, f 21;
#X text 281 115 Workaround: Modified Shape and finally rotated by 90°
, f 15;
#X obj 216 104 cnv 4 100 4 empty empty empty 170 12 0 16 -204786 -66577
0;
#X obj 8 418 cnv 15 400 300 empty empty empty 170 12 0 16 -159655 -66577
0;
#X msg 21 536 set 0 2 1 1 0;
#X msg 21 620 set 2 0 -1 -1 0;
#X msg 21 654 set 2 2 1 -1 0;
#X msg 21 577 set 1 1 0 0 0;
#X msg 21 560 set 1 0 -1 0 0;
#X msg 21 594 set 1 2 1 0 0;
#X msg 21 502 set 0 0 -1 1 0;
#X msg 21 637 set 2 1 0 -0.5 0;
#X msg 21 519 set 0 1 0 0.5 0;
#X obj 21 433 loadbang;
#X text 70 450 this is the shape i want:, f 13;
#X obj 21 680 s curve3d_1;
#X text 237 434 SHAPE 2:;
#X text 80 433 SHAPE 1:;
#X text 221 451 this is how i have to modify Shape 1 because of the
90° rotation., f 23;
#X obj 409 87 cnv 15 400 630 empty empty JACK'S_METHOD: 120 12 0 16
-220544 -66577 0;
#X obj 560 105 cnv 4 100 4 empty empty empty 120 12 0 16 -220544 -66577
0;
#X obj 647 13 declare -lib Gem -path Gem;
#X obj 438 222 glsl_vertex;
#X obj 438 277 glsl_fragment;
#X obj 438 418 glsl_program;
#X msg 501 349 link \$1 \$2;
#X obj 513 300 t b f;
#X obj 501 326 pack;
#X obj 525 173 loadbang;
#X msg 525 205 open vertex.vert;
#X msg 525 260 open vertex.frag;
#X msg 528 401 deformation \$1;
#X obj 531 382 hsl 70 15 -0.5 0.5 0 0 empty empty empty -2 -8 0 10
-262144 -1 -1 0 1;
#X obj 438 460 mesh_square 50 50;
#X obj 438 184 gemhead 70;
#X obj 660 222 glsl_vertex;
#X obj 660 277 glsl_fragment;
#X obj 660 418 glsl_program;
#X obj 660 576 mesh_square 50 50;
#X obj 660 184 gemhead 60;
#X msg 723 348 link \$1 \$2;
#X obj 735 299 t b f;
#X obj 723 325 pack;
#X obj 660 539 translateXYZ 0 -2.5 0, f 13;
#X obj 660 514 pix_texture;
#X obj 660 490 pix_image;
#X obj 674 465 r img;
#X text 425 118 works perfectly well on it's own:, f 17;
#X text 648 116 but a texture can not be applied upon the mesh_square
..., f 19;
#X msg 21 455 bang;
#X msg 179 536 set 0 2 1 1 0;
#X msg 179 620 set 2 0 -1 -1 0;
#X msg 179 654 set 2 2 1 -1 0;
#X msg 179 577 set 1 1 0 0 0;
#X msg 179 502 set 0 0 -1 1 0;
#X obj 179 433 loadbang;
#X msg 179 455 bang;
#X obj 179 680 s curve3d_2;
#X msg 179 519 set 0 1 0 1 0;
#X msg 179 637 set 2 1 0 -1 0;
#X msg 179 560 set 1 0 -0.5 0 0;
#X msg 179 594 set 1 2 0.5 0 0;
#X text 438 627 Do the shader files need to be adapted to allow for
texture mapping 

Re: [PD] Gem - how to get a concave/convex plane

2018-08-04 Thread cyrille henry

hello,

you can try [curve3d]
cheers
c


Le 04/08/2018 à 11:20, oliver a écrit :

Jack wrote:

For me, the simplest way to achieve this, is to use a mesh square with
shaders. Take a look at exemples in Gem and shaders and how to move
vertices in model view.


Hi, Jack ! thanks a lot for your suggestion.

Unfortunately my my shader/glsl skills are very limited and so is the 
documentation of [mesh_square] or [glsl_vertex]...

[mesh_square]-help just says:
"This object is usefull when working with vertex_shader."

do you (or anybody here) know any example patches that demonstrate the approach 
to creating an arbitrary plane with [mesh_square] ?

(the GLSL example patches don't really seem to be pointing that out.)

i also tried the geometry help patch from GEM examples, but this gives me an 
error:

[glsl_geometry]: compile Info_log:
[glsl_geometry]: ERROR: 0:17: 'gl_VerticesIn' : undeclared identifier



best

oliver



++

Jack


Le 03/08/2018 à 17:02, oliver a écrit :

Hi, dear list !

I am looking for a Geo, that looks like a distorted plane, in particular
a "concave" or "convex" plane as shown in this .jpg:

https://wolke.klingt.org/index.php/s/QO7Vb5UDNn42CG9

can anybody hint me to a way that this can be done in Gem ?

the "convex" version seems easier, it's more or less a scaled cylinder,
but i can't ssem to achieve the "concave" version with this Geo.

Best

Oliver





___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list






___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Gem - how to get a concave/convex plane

2018-08-04 Thread Jack
Hello Oliver,

Le 04/08/2018 à 11:20, oliver a écrit :
> Jack wrote:
>> For me, the simplest way to achieve this, is to use a mesh square with
>> shaders. Take a look at exemples in Gem and shaders and how to move
>> vertices in model view.
> 
> Hi, Jack ! thanks a lot for your suggestion.
> 
> Unfortunately my my shader/glsl skills are very limited and so is the
> documentation of [mesh_square] or [glsl_vertex]...
> 
> [mesh_square]-help just says:
> "This object is usefull when working with vertex_shader."
> 
> do you (or anybody here) know any example patches that demonstrate the
> approach to creating an arbitrary plane with [mesh_square] ?

Yes, there is an exemple in Gem :
10.glsl/09.vertex_texture_fetching
In this exemple, the Z position of each vertex of a mesh_square depends
on the color of the texture.

> 
> (the GLSL example patches don't really seem to be pointing that out.)

See above.

> 
> i also tried the geometry help patch from GEM examples, but this gives
> me an error:
> 
> [glsl_geometry]: compile Info_log:
> [glsl_geometry]: ERROR: 0:17: 'gl_VerticesIn' : undeclared identifier

Using geometry is possible here with [gemVertexbuffer] but it is more
complicated.
Attached is an exemple (not perfect) with a vertex shader and a fragment
shader with [mesh_square].
++

Jack


> 
> 
> 
> best
> 
> oliver
> 
> 
>> ++
>>
>> Jack
>>
>>
>> Le 03/08/2018 à 17:02, oliver a écrit :
>>> Hi, dear list !
>>>
>>> I am looking for a Geo, that looks like a distorted plane, in particular
>>> a "concave" or "convex" plane as shown in this .jpg:
>>>
>>> https://wolke.klingt.org/index.php/s/QO7Vb5UDNn42CG9
>>>
>>> can anybody hint me to a way that this can be done in Gem ?
>>>
>>> the "convex" version seems easier, it's more or less a scaled cylinder,
>>> but i can't ssem to achieve the "concave" version with this Geo.
>>>
>>> Best
>>>
>>> Oliver
>>>
>>>
>>
>>
>> ___
>> Pd-list@lists.iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> https://lists.puredata.info/listinfo/pd-list
>>
> 
> 



mesh_deformation.pd
Description: application/extension-pd
#define PI 3.1415926535897932384626433832795

uniform float deformation;

varying vec4 vertColor;

void main() {
  vertColor = gl_Color;
  vec4 pos_vertex = gl_Vertex;
  float sign = sign(pos_vertex.y);
  float add_y = cos(pos_vertex.x * PI * 0.5) * deformation;
  pos_vertex.y += add_y * sign;
  gl_Position = gl_ModelViewProjectionMatrix * pos_vertex;
}varying vec4 vertColor;

void main() {
  gl_FragColor = vertColor;
}___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Gem - how to get a concave/convex plane

2018-08-04 Thread oliver

Jack wrote:

For me, the simplest way to achieve this, is to use a mesh square with
shaders. Take a look at exemples in Gem and shaders and how to move
vertices in model view.


Hi, Jack ! thanks a lot for your suggestion.

Unfortunately my my shader/glsl skills are very limited and so is the 
documentation of [mesh_square] or [glsl_vertex]...


[mesh_square]-help just says:
"This object is usefull when working with vertex_shader."

do you (or anybody here) know any example patches that demonstrate the 
approach to creating an arbitrary plane with [mesh_square] ?


(the GLSL example patches don't really seem to be pointing that out.)

i also tried the geometry help patch from GEM examples, but this gives 
me an error:


[glsl_geometry]: compile Info_log:
[glsl_geometry]: ERROR: 0:17: 'gl_VerticesIn' : undeclared identifier



best

oliver



++

Jack


Le 03/08/2018 à 17:02, oliver a écrit :

Hi, dear list !

I am looking for a Geo, that looks like a distorted plane, in particular
a "concave" or "convex" plane as shown in this .jpg:

https://wolke.klingt.org/index.php/s/QO7Vb5UDNn42CG9

can anybody hint me to a way that this can be done in Gem ?

the "convex" version seems easier, it's more or less a scaled cylinder,
but i can't ssem to achieve the "concave" version with this Geo.

Best

Oliver





___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list




--

/// http://pendler.klingt.org //
\\\ http://oliver.klingt.org  \\


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


Re: [PD] Gem - how to get a concave/convex plane

2018-08-03 Thread Jack
For me, the simplest way to achieve this, is to use a mesh square with
shaders. Take a look at exemples in Gem and shaders and how to move
vertices in model view.
++

Jack


Le 03/08/2018 à 17:02, oliver a écrit :
> Hi, dear list !
> 
> I am looking for a Geo, that looks like a distorted plane, in particular
> a "concave" or "convex" plane as shown in this .jpg:
> 
> https://wolke.klingt.org/index.php/s/QO7Vb5UDNn42CG9
> 
> can anybody hint me to a way that this can be done in Gem ?
> 
> the "convex" version seems easier, it's more or less a scaled cylinder,
> but i can't ssem to achieve the "concave" version with this Geo.
> 
> Best
> 
> Oliver
> 
> 


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list


[PD] Gem - how to get a concave/convex plane

2018-08-03 Thread oliver

Hi, dear list !

I am looking for a Geo, that looks like a distorted plane, in particular 
a "concave" or "convex" plane as shown in this .jpg:


https://wolke.klingt.org/index.php/s/QO7Vb5UDNn42CG9

can anybody hint me to a way that this can be done in Gem ?

the "convex" version seems easier, it's more or less a scaled cylinder, 
but i can't ssem to achieve the "concave" version with this Geo.


Best

Oliver


--

/// http://pendler.klingt.org //
\\\ http://oliver.klingt.org  \\


___
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list