Can you elaborate a bit? I've done GLSL fragment code, but never touched the vertex code...
Thank you, Patrick On Jan 19, 2011, at 3:04 PM, Patrick Sheffield wrote: > Sorry, I meant to change the Subject: line... > > Here's an example, I just tossed an image into the image input. And I'm not > entirely sure I got my coordinates and interpolations correct, but it's sort > of like this. > > Thank you for your help... > > Patrick > > <triangles1.zip> > > On Jan 19, 2011, at 1:12 PM, Achim Breidenbach wrote: > >> Hi Patrick, >> >> you can use a "GLSL Grid"- patch to generate the a vertices grid. In the >> vertex code you can read in the pixel color from your image and put them >> into a varying vec4 variable. that gets interpolated by hardware for each >> pixel calculated by the fragment shader. Do you have an example composition >> where we can see what the result should look like? >> >> best, >> >> Achim Breidenbach >> Boinx Software >> >> On 19.01.2011, at 21:14, Patrick Sheffield wrote: >> >>> >>> Is there a way in Quartz Composer to draw a (right) triangle of size X that >>> is Gouraud or Smooth shaded between the 3 specified corner values. >>> Actually, I will want to draw an entire "sheet" of them, but I'll start >>> with just one. >>> >>> I can do so with a CI Kernel program, but it involves a silly amount of >>> math interpolating the coloration between the vertices, especially when I >>> am sure this can be done in hardware... >>> >>> As an FYI, here's the CI Kernel code - feeding it an image with the RGB >>> values pre-plugged at size intervals. It's not efficient to be doing 4 >>> texture reads for each pixel, then interpolating to determine the color... >>> >>> Any thoughts? thanks, >>> >>> Patrick >>> >>> kernel vec4 triangle(sampler image, float size) >>> { >>> vec2 uv = samplerCoord(image); >>> vec2 auv = floor(uv/size) * size; >>> vec2 duv = auv + size; >>> vec2 buv = vec2(duv.x,auv.y); >>> vec2 cuv = vec2(auv.x,duv.y); >>> >>> vec2 s = mod(uv, size); >>> >>> vec3 a = sample(image, auv).rgb; >>> vec3 b = sample(image, buv).rgb; >>> vec3 c = sample(image, cuv).rgb; >>> vec3 d = sample(image, duv).rgb; >>> >>> vec3 pix = (s.x + s.y) < size ? >>> mix(mix(a, b, s.x/(size-s.y)), c, s.y/size) >>> : >>> mix(b, mix(c, d, (s.x-(size-s.y))/(size-(size-s.y))), s.y/size); >>> >>> return vec4(pix,1.0); >>> >>> } >>> >>> _______________________________________________ >>> Do not post admin requests to the list. They will be ignored. >>> Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) >>> Help/Unsubscribe/Update your Subscription: >>> http://lists.apple.com/mailman/options/quartzcomposer-dev/achim%40boinx.com >>> >>> This email sent to ac...@boinx.com >> > > _______________________________________________ > Do not post admin requests to the list. They will be ignored. > Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/quartzcomposer-dev/psheffield%40earthlink.net > > This email sent to psheffi...@earthlink.net _______________________________________________ Do not post admin requests to the list. They will be ignored. Quartzcomposer-dev mailing list (Quartzcomposer-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com