Sign in to follow this  

Sniper Scope....

This topic is 4354 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4354 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this