Sniper Scope....

Started by
4 comments, last by Aiursrage2k 18 years, 3 months ago
I'm building an fps game engine for a college project and have implemented a zoom-able sniper weapon, however, as I am new to all this, I am having difficulty in finding information on how to implement a mask for a sniper scope effect. I think i should be using a stencil buffer but am unsure? If anybody knows the location of a good tutorial for this topic it would be greatly appreciated, any other info would also be helpful... I'm pretty stuck... Thanks in advance
Advertisement
Well the easiest thing is to simply make an alpha mask texture and draw it over the entire screen. You can combine that with scissoring to gain some efficiency rendering wise, so you don't draw things not visible because of the scope.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
I hate to be a complete idiot but hey... I've gotta learn somehow...

could you maybe show in a little more detail what you mean?
so alpha is a channel in a pixel. you have R(red) G(green) B(blue) A(alpha). Alpha is the amount of transparency for that pixel. So you make a bitmap that is a fullscreen texture. You have the "clear" part of the image all have an alpha value that means transparent (typically 0). There are various free paint programs out there with which you can create the texture.

Then you can either blit the texture to the screen after your render pass, or just place a quad up at the front of the screen textured with that scope texture, or go to ortho mode to draw, etc.

-me
Also, remember that for your zooming, you can simply modify your perspective matrix. If using D3DXMatrixPerspectiveFOVLH , just increase or decrease the fovY parameter.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
One way you could do it.

Create a rendertarget, draw your scene to the render target. Create a screen aligned quad (fullscreen) and apply the render texture to the quad. You could then use a pixel/vertex shader to do do a scope.
Insufficent Information: we need more infromationhttp://staff.samods.org/aiursrage2k/

This topic is closed to new replies.

Advertisement