- Home /
How can I attach a vertex shader to the camera?
I am trying to write a shader that should modify the position of all the vertices rendered by the camera.
Answer by Berenger · Feb 09, 2012 at 01:21 AM
I don't think that's possible. As far as I know, the object camera don't execute every shaders for every mesh. Instead, it gives the matrices to every shaders.
Maybe you want a post effect, some kind of distord ? Or render to texture, apply it on a plane in front of an other camera then modify the vertices of that plane ?
I am trying to do head tracking using kinect. So i want to move all the vertices based on the head position.
Isn't it simpler with bones ? $$anonymous$$inect control the bones, skinning control the mesh. I've never used $$anonymous$$inect, don't really know what people do in that case :/
The camera doesn't have any vertices, only actual models you can see in the scene have verts.
Camera stuff can usually be solved with things like transform.Lookat(eyesPlus);
where eyesPlus is a Transform child of the headBone, maybe 20 meters in front of it.
yes. its simpler to control the avatar/character using bones. I am trying an effect where if you move your head towards right, you could see the right side of the object. So i want to move all the other vertices that is rendered by the camera based on the head position.
$$anonymous$$hhh, try with everything having a common parent, so you can rotate the entire scene ? Just rotate it around the head Y axis.