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

Jack jack at rybn.org
Sun Aug 5 15:27:30 CEST 2018


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 at lists.iem.at mailing list
> UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mesh_deformation.pd
Type: application/x-extension-pd
Size: 1431 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180805/62291f19/attachment.bin>
-------------- next part --------------
uniform sampler2D tex0;

varying vec4 vertColor;

void main() {
  vec4 image = texture2D(tex0, gl_TexCoord[0].st);
  gl_FragColor = image * vertColor;
}
-------------- next part --------------
#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;
}


More information about the Pd-list mailing list