Hi embers,
I got a Olga Kit for christmas!
Now I have to draw triangles instead of rectangles.
Which would be the better way:
- tweak Cinder-Warping block to render triangles?
- using a vertex shader?
Thank you
Hi embers,
I got a Olga Kit for christmas!
Now I have to draw triangles instead of rectangles.
Which would be the better way:
Thank you
That kit looks like fun for experimenting!
What I don’t understand is how would you use a vertex shader for drawing and mapping the triangles in space?
Somehow you need to calculate the homography matrix, which is the perspective transformation between two planes.
And this is what is done in the Cinder-Warping tool from @paul.houx, which adds also a bilinear warping
Alternatively you can calculate the intrinsic and extrinsic matrices (see the opencv method) , but if I remember correctly you will need also the Z-coord (so a full 3d model).
If you don’t need to perform any perspective mapping (i.e. solid color per triangle without any 3d information), then you don’t need to calculate anything, and you could just write a simple sketch and draw your shapes with the mouse on the projection window output.
I would suggest to use the cinder-warping block, and find the way to cut out your triangles to warp them independently. I think you don’t need to modify the block, unless it doesn’t support alpha channel.
If you have a good Camera you could check the structured light approach, but it’s a bit tricky the setup and you will need to adjust the output by hand with some warping tool.
I am curious to know if there are more techniques for 2d/3d mapping.
I hope this will be somehow helpful.
@dashandslash, I only need 2D drawn triangles, I would like to keep it simple.
I have a VJ gig next saturday, so I’m trying the easiest method at the moment
I made my own fork of the helpful Cinder-Warping block which I use all the time, I can use it by making rectangles and then drawSolidTriangle (with a fragment shader on the fbo) inside, but I have to handle the warps creation order to avoid overlapping.
I also tryed drawing triangles, now I have to code a structure of vertices.
If the perspective doesn’t matter, why don’t you create a the full composed structure and then map that?
You will have to make one single warping element.
right @dashandslash, thank you!
You may also want to try using triangles with a dash (pun intended) of 3D texture coordinates.
I checked the link, and I got a bit confused by this technique…
In that article he is basically calculating a perspective interpolation on the fragment shader instead of using the common linear interpolation. Somehow we need to calculate this “q” per each uv coord, and looks like the result is the same of multiplying by the Homography Matrix.
Am I wrong? what is the benefit of using this approach?
Thanks
L