Actual Scope View

How can I do an actual view you can have through a scope?
Example:

**[SWEP.GetViewModelPosition

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=SWEP.GetViewModelPosition)**

Use that, and position the weapon so it goes in yer face when you are in aimmode or some shit.

…Dude, I said ACTUAL VIEW THROUGH A SCOPE. Did I say ironsight positioning? I think it has to be some sort of RT but I am not sure.

Thats not the “actual” view through the scope its a screen overlay… and i’m assuming you could use **[G.DrawMaterialOverlay

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=G.DrawMaterialOverlay)**

No, goddammit, I’m talking about being able to see what’s infront of you like zoomed in, on the scope texture…

**[Player.SetFOV

http://wiki.garrysmod.com/favicon.ico](http://wiki.garrysmod.com/?title=Player.SetFOV)**

Don’t go ragebear dammit, your explanation was crappy, and from the picture I didn’t notice any zooming, only ironsight positioning.

No, look I’m asking about making a realistic scope, by that I mean like, if you use it as an ironsight (aka put it in the center of your screen) the scope texture (the glassy part of the scope) will be a render target, which is outputing what’s infront of the player.

G.DrawMaterialOverlay [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb]

Player.SetFOV [img_thumb]http://wiki.garrysmod.com/favicon.ico[/img_thumb]

Draw the material and use setfov to zoom. Next time have a better attitude when asking for help.

If anyone was actually reading his thread and not just seeing the word scope and spewing the wrong answer he wouldn’t be as upset.

OP is asking how to render the inside of the scope on the model with a zoom while not actually zooming the entire view.


You do this clientside, something along the lines of:


local mat = Material( "viewmodel/scope/texture" )
local view = { }
local function RenderScene( pos, ang )
	local rt
	
	rt = render.GetRenderTarget( )
	
	render.SetRenderTarget( mat )
	
	render.Clear( 0, 0, 0, 255 )
	
	
	view.origin = pos
	view.angles = ang
	view.x = 0
	view.y = 0
	view.w = 512
	view.h = 512
	view.fov = 50
	
	render.RenderView( view )
end

hook.Add( "RenderScene", "ZoomRender.RenderScene", RenderScene )

And it would render the scope texture with your view if I have the idea right.

Thank you, someone who actually gets it. Have a derp cookie.