"3d" scopes and double rendering(?)

Discuss anything ZDoom-related that doesn't fall into one of the other categories.
Post Reply
DukeWooze
Posts: 90
Joined: Fri Mar 01, 2013 4:11 am

"3d" scopes and double rendering(?)

Post by DukeWooze »

So I was looking on the forums and I saw that hideous destructor was still being updated and what not. Now the last time I played it was years ago so I decided to check it out again. Boy was I surprised when I saw all the new features. The one thing that blew me away was the "3d" scope effect where it zooms in a part of the screen. I'm a little out of date when it comes to modding. I don't really know all the features of ZDoom or how to implement them. But I was just wondering how the hell was this achieved? And what is the proper term for this technique?

User avatar
phantombeta
Posts: 2084
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: "3d" scopes and double rendering(?)

Post by phantombeta »

There's not really a name for this technique - it's just a [wiki=ANIMDEFS#Camera_textures]camera texture[/wiki] rendered to the HUD.
For setting the camera texture target, you use ACS' [wiki=SetCameraToTexture]SetCameraToTexture[/wiki] or ZScript's TexMan.SetCameraToTexture. For drawing it to the screen, there's ACS' HUDMessage, and ZScript's several screen drawing functions.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: "3d" scopes and double rendering(?)

Post by Matt »

What PB said.

Welcome back to the ZDoom forums!
DukeWooze
Posts: 90
Joined: Fri Mar 01, 2013 4:11 am

Re: "3d" scopes and double rendering(?)

Post by DukeWooze »

Thanks guys. I'll try this out in the next mod I'll make. I thought it was going to be much more complicated than this.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: "3d" scopes and double rendering(?)

Post by Matt »

The biggest complication is trying to get lite amps to work with them... the only solution I've found is to make the liteamps use a shader that affects the entire screen.

After that, it's trying to make sure everything stays the right size relative to each other and to factor in the player's fov or hud (or weaponbob?) settings as necessary.
DukeWooze
Posts: 90
Joined: Fri Mar 01, 2013 4:11 am

Re: "3d" scopes and double rendering(?)

Post by DukeWooze »

Yeah I was thinking about that. Is there a way to get the weapon offset from ACS? Or even modify it? I noticed that that mod also has weapon inertia too. I wouldn't mind trying that out sometime.
User avatar
Matt
Posts: 9696
Joined: Sun Jan 04, 2004 5:37 pm
Preferred Pronouns: They/Them
Operating System Version (Optional): Debian Bullseye
Location: Gotham City SAR, Wyld-Lands of the Lotus People, Dominionist PetroConfederacy of Saudi Canadia
Contact:

Re: "3d" scopes and double rendering(?)

Post by Matt »

I just ended up setting all weapon offsets in an entirely redone-from-scratch bobbing system. :V

The only way you can really do it with the canonical bobbing (even in ZS let alone ACS) is to re-create the formula that the bobbing uses and test it to make sure your hudmessage never desyncs from the weaponbob.
D2JK
Posts: 543
Joined: Sat Aug 30, 2014 8:21 am

Re: "3d" scopes and double rendering(?)

Post by D2JK »

I had been thinking of adding this effect on a scoped weapon since learning about it here, but on a second thought, might not be worth the trouble considering weapon offsets/bobbing/whatnot.

It would be an entirely different matter, though, if you could replace a sprite used in weapon's overlay with the view from a 'camera' (cropped or scaled down, of course), as it's trivial to make overlays stay synced with weapon movement.
User avatar
22alpha22
Posts: 303
Joined: Fri Feb 21, 2014 5:04 pm
Graphics Processor: nVidia with Vulkan support
Location: Montana, USA

Re: "3d" scopes and double rendering(?)

Post by 22alpha22 »

Have you tried rendering your camera texture with SBARINFO or ZScript? I used SBARINFO for my scopes, however they don't need to bob so maybe ZScript would be better if they needed to follow the weapon's bob.

DukeWooze
Posts: 90
Joined: Fri Mar 01, 2013 4:11 am

Re: "3d" scopes and double rendering(?)

Post by DukeWooze »

To be honest I haven't even given it a try. I was trying to make some kind of a mod over the summer but nothing really stuck. But seeing this last post makes me interested in trying it. By the way, are there any good tutorials on zscript?
Post Reply

Return to “General”