Download

Collimator effect using vertex shader?

Hi. Here is the effect using camera vector:

Here is the similar effect on other optics:

Here is a base code:
pic.jpg

As you can see it allways pointing in the direction where scope is faced, you can say that it is projecting the reticle to the point which you will hit.

The question is: is it possible to do the same effect using vertex shader (if i made reticle with polygons)? Any ideas how I can shift the vertices the same way as camera vector doing this in pixel shader?

I don’t wan’t to use any textures.
Thanks.

Here is the code that worked in my case.
pic.jpg

Im not sure what is nature of this constant vector (0.153; 4,32; 0), I investigate this later.

But it is what it is. You can use this code to make collimator with 3d mesh object.

UPD: Ah yeah! It is the local position of the scope center.
Here is the screenshot from 3ds max:
pic.jpg