Page 1 of 1

"3d" scopes and double rendering(?)

PostPosted: Mon May 20, 2019 5:27 pm
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?


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

PostPosted: Mon May 20, 2019 10:37 pm
by phantombeta
There's not really a name for this technique - it's just a camera texture rendered to the HUD.
For setting the camera texture target, you use ACS' SetCameraToTexture or ZScript's TexMan.SetCameraToTexture. For drawing it to the screen, there's ACS' HUDMessage, and ZScript's several screen drawing functions.

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

PostPosted: Tue May 21, 2019 12:16 am
by Matt
What PB said.

Welcome back to the ZDoom forums!

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

PostPosted: Tue May 21, 2019 1:12 am
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.

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

PostPosted: Tue May 21, 2019 7:45 pm
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.

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

PostPosted: Wed May 22, 2019 10:46 am
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.

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

PostPosted: Wed May 22, 2019 11:52 am
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.