[PD] Oculus Rift shader in pd/Gem

Cyrille Henry ch at chnry.net
Thu Oct 31 17:13:25 CET 2013


hello Michael,

translate did not work because the shader did not use the transformation matrix (that translate, scale etc are modifying). the shader use texture corrdinate as vertex position.
see this line in the vert shader :
	gl_Position = gl_Vertex;
usually you have somthing like :
	gl_Position = ftransform();

cheers
c

Le 31/10/2013 16:31, Michael Mihocic a écrit :
> Hy Cyrille,
>
> based on your example I could implement the Rift shadering and I can render the left and right eye seperatly. Thank you once again!
>
> But the two shadered images (left and right) are behind each other and I cannot use "translateXYZ" (x-axis translation) to move them to their sides!? Do you have any idea?? The attached example (rift_example.pd) includes more comments and is probably a better explanation...
>
> Br, Michael
>
>
>
> -------- Original-Nachricht --------
> Betreff:     [GEM-dev] Fwd: Re: Oculus Rift distortion/support
> Datum:     Sun, 27 Oct 2013 18:51:33 +0100
> Von:     Michael Mihocic <michael.mihocic at oeaw.ac.at>
> An:     <gem-dev at iem.at>
>
>
> Hy Cyrille,
>
> thank you again for your quick reply!!
> Good idea, I also replied to the Gem list! (I'm not registered at the pd list...)
> (Sorry, if someone might be annoyed about my attachments...)
>
> Attached you can find my progress so far but I have to mention that my scripts are still "under construction" - and not only the parameters far from optimized.... ;-)
>
> My example consists of:
> - rift_list.pd        -> is the pd patch to be started, follow the instructions on top of the file
> - riftshader.pd is used for the distortion parameters, when using the shaders:
> - r4.frag/r4.vert are the shader files
> - test.jpg is just any test file which will be distorted
>
> I'm not using gemframebuffers in my patch. Currently I am simply loading 2 times the same image and processing the barrel distortions on each half of the image, left and right.
> But as I described below, our actual world does not consist of one image but of many objects (spheres, cubes, lines,...) within a big sphere, and the user can rotate his head inside the sphere. ((tracking will not be done with Oculus Rift tracker))
> -> theoretically, my perfect solution would be to apply the distortion to "the entire stereo gemwin" somehow!? ;-)
>
> Following the idea of your patch and introducing gemframebuffers, do you think I can realize it that way:
> - every object needs to be rendered twice instead of once, and in a framebuffer, sent to the abstraction "gemhead_rift"
> - the barrel distortion is applied in the abstraction "gemhead_rift", the parameters depending on left or right
> - instead of using "stereo", I create a wider window and add X-axis-translation
>
> Do you think it should work that way?
>
> Br, Michael



More information about the Pd-list mailing list