You, sir, are a genius...

Thank you. It all makes sense now. Much much appreciated.

Sincerely,

Patrick

On Aug 16, 2010, at 2:36 AM, Achim Breidenbach wrote:

> Hi Patrick,
> 
> the rendering "Sprite"-Patch within the GLSL-Patch needs to draw the quad in 
> the correct dimensions. Those dimensions we only can get within the "Render 
> in Image"-Patch with the "Image Dimensions"-Patch because the 
> coordinate-system within a "Render In Image"-patch is different to the real 
> worlds coordinate system.
> 
> See the attached composition, which now shows all black because of your 
> diff-patch ;-)
> 
> <gaussian4.qtz>
> 
> Best,
> 
> Achim Breidenbach
> Boinx Software
> 
> On 16.08.2010, at 11:23, Patrick Sheffield wrote:
> 
>> Ahhhhhh.... now I'm getting it... so close, but for some reason, the image 
>> is still being stretched - i.e. the aspect ratio is changing - see attached 
>> - I put a difference blend patch to show what's happening:
>> 
>> Patrick
>> 
>> <gaussian3.qtz>
>> 
>> On Aug 16, 2010, at 1:34 AM, Achim Breidenbach wrote:
>> 
>>> Hi,
>>> 
>>> there are some differences from texture2D to texture2DRect: in texture2D 
>>> the xy-corrdinates can varying from 0.0 to 1.0, however in the 
>>> texture2DRect you have to use pixel units.
>>> 
>>> please find attached your composition with my suggestions.
>>> 
>>> <gaussian2.qtz>
>>> 
>>> best,
>>> 
>>> Achim Breidenbach
>>> Boinx Software
>>> 
>>> On 16.08.2010, at 10:17, Patrick Sheffield wrote:
>>> 
>>>> Hmmmmm....
>>>> 
>>>> Well, I'm not sure how to do the solution you present in (1)... do I 
>>>> multiply the gl_TexCoord[0].xy by my coordinates to correct? And when I 
>>>> changed the sampler2D to sampler2DRect (and the textureSize2DRect, and the 
>>>> texture2DRect...), I then got a uniform reddish gray image in my viewer.
>>>> 
>>>> Thanks for your continued help, I feel I am quite close...
>>>> 
>>>> Patrick
>>>> 
>>>> On Aug 16, 2010, at 12:48 AM, Achim Breidenbach wrote:
>>>> 
>>>>> Hi Patrick,
>>>>> 
>>>>> I just improved the composition from Miroslaw in pretty much the same way 
>>>>> as your solution for the "gaussian" version of the filter looks like. 
>>>>> Maybe you can fiddle in there your code and get rid of all your questions 
>>>>> ;-)
>>>>> 
>>>>> 1) It is, because you don't respect the gl_TextureMatrix of the the src 
>>>>> texture. Textures can be flip, but the matrix always put them back 
>>>>> correctly. You have to use the gl_TexCoord[0].xy in the fragment shader 
>>>>> to get correct xy-coordinates, they are transformed in the Vertex Shader 
>>>>> by the texture matrix.
>>>>> 
>>>>> 2) the "default" implementation of the GLSL shader puts in a "uniform 
>>>>> sampler2D texture;" which is misleading! This means, that the input for 
>>>>> the texture has to be a square. so QC is converting your input image to a 
>>>>> square texture and feeds this into the GLSL-shader (and manipulates the 
>>>>> texture-matrix that way, that the image-aspect ratio is still correct!). 
>>>>> Your code ready the native texture size with textureSize2D(src, 0) which 
>>>>> is 512x512 I guess in your case. Replace all "sample2D" with 
>>>>> "sample2DRect" to get your original texture in the correct size.
>>>>> 
>>>>> 3) You have to use a "Render in Image"-Patch to render the GLSL-Shader 
>>>>> into a new texture to use it in following patches.
>>>>> 
>>>>> Best,
>>>>> 
>>>>> Achim
>>>>> 
>>>>> <compound-gaussian 1.qtz>
>>>>> 
>>>>> On 16.08.2010, at 09:27, Patrick Sheffield wrote:
>>>>> 
>>>>>> Thank you, Miroslaw - that works, I'd never played with an OpenCL 
>>>>>> patch...
>>>>>> 
>>>>>> Toward that end, I've been trying out some GLSL routines, but I have a 
>>>>>> few questions for anyone out there:
>>>>>> 
>>>>>> <gaussian1.qtz>
>>>>>> 
>>>>>> First, why does this composition flip the image?
>>>>>> Why does it mess with the aspect ratio?
>>>>>> And how would I feed the output of a GLSL patch to do further processing?
>>>>>> 
>>>>>> I realize a Gaussian blur needn't be done in a GLSL patch - could be 
>>>>>> handled in a CI kernel, etc... but I have other GLSL routines I'd like 
>>>>>> to use.
>>>>>> 
>>>>>> Thanks for any insight you might have,
>>>>>> 
>>>>>> Patrick
>>>>>> 
>>>>>> On Aug 15, 2010, at 5:31 AM, Miroslaw Rusin wrote:
>>>>>> 
>>>>>>> thanks for the info. so it's something more like this then...
>>>>>>> 
>>>>>>> <compound-3.qtz>
>>>>>>> 
>>>>>>> 
>>>>>>> it's slow - O(x*y*r²), where:
>>>>>>> x - image with
>>>>>>> y - image height
>>>>>>> r - radius
>>>>>>> 
>>>>>>> can be O(x*y) with sum table
>>>>>>> 
>>>>>>> M
>>>>>>> 
>>>>>> 
>>>>>> _______________________________________________
>>>>>> Do not post admin requests to the list. They will be ignored.
>>>>>> Quartzcomposer-dev mailing list      ([email protected])
>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>> http://lists.apple.com/mailman/options/quartzcomposer-dev/achim%40boinx.com
>>>>>> 
>>>>>> This email sent to [email protected]
>>>>> 
>>>> 
>>> 
>> 
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to