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

Jack jack at rybn.org
Sat Aug 4 13:12:17 CEST 2018


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 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: 1000 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20180804/62d7f809/attachment.bin>
-------------- next part --------------
#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;
}
-------------- next part --------------
varying vec4 vertColor;

void main() {
  gl_FragColor = vertColor;
}


More information about the Pd-list mailing list