Perspective transform onto curved surfaces within quartz composer

Caelshadowhunter's picture


I'm looking for a mechanism to perspective transform video for projection onto a curved surface. A package like 1024_perspective would be perfect if it weren't for the fact that I all of the patches that I've found only have corner pin transformation options. I really need sort of... mid point pins as well (which I obviously realise entails far mor advanced transformations).

A system which maps video onto a mesh such as PB mesh might be a partial solution but I really need to be able to tweak the parameters of the warp without having to create a new mesh.

I know it might be possible to write something using the GLSL shader in Quartz Composer but I would have to teach myself OpenGl code as its not something I've met before. It's something of a long term project but so its not something I would shy away from however I would rather not have to.

Does everyone have any ideas as to how to go about this?


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

gtoledo3's picture
Re: Perspective transform onto curved surfaces within quartz ...

Well, stuff like the 1024 perspective could totally do what you're saying.

Think about this:

If you have three Quads in a strip, and tuck in the two corners on the outside, or on the inside, all of a sudden, you have an arch, and believe it or not, if you do it certain ways three can make a really convincing curve (check a patch I made in the Composition Repository, "Interaction Bezier Curve). If you did this with five Quads, it is definitely convincing in curviness.

If you were to use a crop patch, or preferably, Image Texturing Properties, you could divvy up your image and send different sections to different Quads (or 1024 perspective Quads). You could then adjust UV's however you need.

Alternatively, there is a patch around here called "Grid Warp", that's a big grid that has adjustable resolution. There are a couple setups floating that allow you to interact with it, and warp the grid, giving "curve". That's kind of plug and play, but it's also somewhat less flexible overall (I think).

Alterna-alternatively, one could use OpenCL and/or Perspective Transforms... or possibly Kineme GL Quad Structure. It's a hard call as to what would be the easiest for your scenario.

toneburst's picture
Re: Perspective transform onto curved surfaces within quartz ...

I'm fairly certain there was a discussion here some time ago about dome-projection specifically, and there were definitely some example GLSL vertex shaders produced to produce the required distortion for projecting onto the inside of a dome. Don't have time to look for them right now, but I'm sure they're here somewhere. I think cwright came up with a pretty cool example composition, though I didn't have the opportunity or the equipment to test it myself.


Caelshadowhunter's picture
Re: Perspective transform onto curved surfaces within quartz ...

The idea about spanning across separate quads sounds interesting, I'll give that a go today. Was the cwright composition to which you refereed the fisheye thing?

If it was, whilst its a really nice little concept, it's not particularly useful to me as the geometry correction is designed for a planetarium style projection setup rather than a curved screen and (as far as I can see) it has no facility to edit the distortion parameters (apart from actually editing the glsl shader code). Incidentally, if anyone is looking for a solution for planetarium geometry correction, they might find PB mesh to be slightly more workable

franz's picture
Re: Perspective transform onto curved surfaces within quartz ...

you can try _1024_GL_BezierSurface. Keep in mind this plugin is NOT perspective-correct (yet).

dust's picture
Re: Perspective transform onto curved surfaces within quartz ...

this is all theory for me at them moment but i'm about to try out mapping a sculpture. well its a bit different kind of sculpture. its a foam based sort of costume that is a story high. the guy that makes gwar, and green jello┬┤s stage costumes made this giant one for my mates tv show.

a few months ago the designer was telling me that it isn't possible to paint on to the latex that hold the foam shape. he said there is no paint that will stick to the latex for any length of time. now i have got a chance to see this foam sculpture i noticed that he used grid lines just like a uv map to construct this thing, just like you would do with a three-d computer model.

so after looking at this it dawned on me if it can not be painted because of the latex it could be projected onto. so my theory in projecting on to a three-d sculpture would to just model the shape in the computer then project that model onto the surface with a couple projectors.

i'm thinking this will be much easier than drawing and saving a bunch quad warps out as it will be all one piece or thinking two of the same model but different perspectives for projecting on different sides. i assume there might be some lens distortion or something i might have to deal with but am hoping that will not be a problem. the only thing i got to figure out is how to track this giant sculpture when there are four people inside it moving the arms and legs around. maybe kinect could help track.

so im about to do this today or at least make a test so i will tell you if it works but thinking maybe just modeling a simple nurb to be the shape of your screen and then adding a texture to that model and projecting it onto your screen seems like it would work but like i said i have never done this before.

seems to me that franz does a combination of this and his bezier plug maybe i don't know.

Caelshadowhunter's picture
Re: Perspective transform onto curved surfaces within quartz ...

_1024_GL_BezierSurface. seems to work well. Thanks.

Caelshadowhunter's picture
Re: Perspective transform onto curved surfaces within quartz ...

_1024_GL_BezierSurface. seems to work well. Thanks.

gtoledo3's picture
Re: Perspective transform onto curved surfaces within quartz ...

It may also help to look at the OpenCL Sculpt, grid example I have in the composition repository.

The default setting on it is a little heavy handed, but with fine control, it can do nuanced, high resolution U/V warp, and take advantage of the GPU.

Then, one can run that through a CI perspective transform to account for the actual position of the projector/surface, or an additional OpenCL step (I would do the final skew w/ OpenCL most likely, since it can be done in parallel with the rest of the maths).

This is the most performant route I'm aware of, though I didn't exactly lay it all out in that CL Sculpt comp... the texture needs to get reapplied at the end for most purposes (get texture/set texture), and in the comp, I just had it lock, and I would also add more warp tools for fine control of warp.

However, I was just playing with the _1024 bezier this morning, and it's pretty insanely fun and user friendly. I would recommend that if it gets the job done, because the interaction with it is dead simple.

Sometimes it helps to control z by small amounts though, because one can control what draws in front/behind, if a corner point gets pulled "in" so that it's "on top" of the main mass of the area. I believe OpenCL is more performant with large amounts of verts/uv's/normals, as well.

wd.png277.92 KB