[Template] Orthographic Projection Use Cases

Sprites, textures, sounds, code, and other resources belong here. Share and share-alike!
Forum rules
Before posting your Resource, please make sure you can answer YES to any of the following questions:
  • Is the resource ENTIRELY my own work?
  • If no to the previous one, do I have permission from the original author?
  • If no to the previous one, did I put a reasonable amount of work into the resource myself, such that the changes are noticeably different from the source that I could take credit for them?
If you answered no to all three, maybe you should consider taking your stuff somewhere other than the Resources forum.

Consult the Resource/Request Posting Guidelines for more information.

Please don't put requests here! They have their own forum --> here. Thank you!
User avatar
dileepvr
Posts: 10
Joined: Fri Feb 02, 2024 9:18 am
Graphics Processor: nVidia with Vulkan support

[Template] Orthographic Projection Use Cases

Post by dileepvr »

(For hardware renderers only) Orthographic projection has been in the engine for a few months now and hasn't caused any bugs or instabilities yet. So I guess it is ready for general usage.

TL;DR video:


Table of contents:
  • Abstract
  • (Coming soon when I get to it) RTS template
Abstract:

All actors (when used as cameras) have had a ViewPos field that could be used to displace the viewpoint from the center. This was separate from the ViewAngles field, and is meant for simulating recoil, screen shakes, tank controls (view direction independent from movement direction), and simulating lag/inertia in mech/vehicle chassis. ViewPosition also provides for a simple way to implement third-person cameras. Internally, the engine would always ensure that the viewpoint wouldn't go out of bounds of the level by displacing it inwards from walls, floors, and ceilings. Now, a couple of flags can be set using SetViewPos that enables (a) orthographic projection, and (b) out-of-bounds viewpoints. These are separate, independent abilities, but are intended to be used together in most cases.

Orthographic projection removes vanishing points from the viewpoint. Meaning all perspective is gone. Things don't change size depending on their distance from the camera, and the only way to tell which is closer is through geometric overlap.
Caveats:
  1. Pitch cannot be zero. Either look up or look down. Otherwise, flats won't get rendered (sloped flats need a fix that I am PR-ing right now)
  • No line portal rendering. The portals work. But rendering is disabled. This might be enabled in the future after I figure out some clipping problems (it looks mostly good).
  • No sector portal rendering. The portals work. But rendering is disabled. This one might not happen, because of a fundamental quirk of how it is implemented (it looks bad).
  • No reflections in flats. This one might not happen. It reveals a trick used by the engine. You can fake reflections using shaders though.
  • Rooms behind rooms will be visible. This can be controlled by setting the console variable r_radarclipper to true. This setting gets stored in the gzdoom.ini file separately for every IWAD, so remember to reset it if just testing. Sectors marked as secret will be dark until entered if the cvar is false.
Out-of-Bounds viewpoint does what it says. You can look at the map from the outside in just like in UDB. Backface clipping automatically occurs for the walls.
Caveats:
  1. No sky rendering. I really couldn't figure out how the engine makes this work.
  • The cvar r_dithertransparency now kicks in. false by default, but setting stored in gzdoom.ini separately for every IWAD. This adds a dithering transparency to every piece of level geometry (walls, flats) that obscures the actor stored in the camera actor's tracer field, as well as up to 20 (hardcoded) alive monsters within that actor's line of sight.
Simple map with moving camera and camera texture:



Download Link.

This map uses a built-in orthographic camera added by MajorCooke (Use the latest UDB) as an aiming camera set to a camera texture on a wall. There is a second, moving camera that is used for the intro that has orthographic projection and out-of-bounds flags set manually at level load using zscript. You can use this to analyze the effect of the cvar r_radarclipper on the visibility of the rooms in the camera texture. One of the room's sectors is marked secret. Two of the rooms are connected to the central room using line portals.

Credits:
  • MajorCooke for the orthographic camera actor and basic idea for the map.
  • I don't remember where I took the scrolling scanline texture and monitor-border textures from!
Beat 'Em Up (sidescroller) template (PWAD):

Gameplay Video:
Spoiler:
Download Link.

A two-level (really only one level has combat) PWAD for use with Doom2 IWAD. Already some interesting suggestions for improvements have been made, which I'll look into. I used some fatalities from Brutal Doom, and implemented parallax scrolling in multilayered backgrounds using shaders. The primary fist has a slower, alt-fire kick. Mouse does nothing, so remap fire and alt-fire to keyboard keys for best play experience. Fez is now possible in this engine.

Other notable sidescroller projects (that didn't use ortho cameras or out-of-bounds viewpoints):
  • The Forestale by Yorzh (Alekv) Aleksey (Steam link)
Credits (see file in PWAD for details):
  • Textures and sprites from Lesiakower, tokdmvlad, Scalliano, Das_M, Sergeant Mark IV, Tormentor667, skillsaw, Robert Babor (Fusion), and Devon West
  • Doomguy sprites by Mark Quinn, Xenaero, Grimm, Xim, Anthony Cole, CaptainToenail, Toke, MickeYoofers, and me
  • Monster Stagger sprites and Glorykill shader by JM (source: Glorykill addon v30e for Project Brutality)
Isometric Shooter template (IWAD):

Image

Download Link.

Wiki explanation.

Very simple standalone IWAD template based off of the Nash's old Standalone Template. Very minimalist assets. The two cvars r_radarclipper and r_dithertransparency can be set via menu options. Keyboard has two control schemes: Relative to actor (tank controls) or relative to camera/viewpoint. Strafing is always relative to camera/viewpoint (meaning keys get remapped depending on where you face).

Credits (see file in project for full details):
  1. Nash Muhandes
  • Whoever made the exploded barrel sprite for Origin's Crusader games
Isometric Mouse-control template (IWAD):

Download Link.

Same as above, but with mouse controls. Right-click to interact. Hold shift and left-click to force-shoot from current position, and hold alt and left-click to force-move towards cursor even if a shootable target is under the cursor.

Credits:
  • Same as previous section
RTS Template:

When it's done. Where did the year go?!
User avatar
Nomakh
Posts: 103
Joined: Mon Jun 25, 2018 12:27 pm

Re: [Template] Orthographic Projection Use Cases

Post by Nomakh »

Words cannot express how much I am excited to find this treasure! Though I still can't understand something - which links leads to exactly "universal isometric mod" that can be included with other mods and wads? Honestly, I got one from one of your comments on YT, but well...

Also - can we have a bit of manual here? For example - I'm still fiddling with controls and camera to get proper comfortable angle. Especially have a lot of questions with "diablo-style control". Is this suitable only for melee characters like in Hexen\Heretic?

And another thing - I recommend you to take a look at the game named "Alien Shooter". This is isometric shooter. And controls there are pretty comfortable. Would like to see something like this in your project.

Really good job here! And sorry for possible mistakes I've made here - cause English isn't my first language and it is early morning there...)
User avatar
dileepvr
Posts: 10
Joined: Fri Feb 02, 2024 9:18 am
Graphics Processor: nVidia with Vulkan support

Re: [Template] Orthographic Projection Use Cases

Post by dileepvr »

Thanks! The universal one is still WIP. I'll probably change the name before announcing it here ;p

Diablo-style was simple attempting "mouse" control. I am still experimenting with it, and I don't think that it is appropriate for general maps yet. You can bind special keys that you can hold down to "stand and fire" or "force move" for that mode. Even in regular mode, you can change the mode so the movement directions are relative to camera instead of relative to player. Some people prefer that. Heretic is a lot of fun to play this way, actually.
User avatar
Nomakh
Posts: 103
Joined: Mon Jun 25, 2018 12:27 pm

Re: [Template] Orthographic Projection Use Cases

Post by Nomakh »

dileepvr wrote: Tue Feb 18, 2025 12:22 pm Thanks! The universal one is still WIP. I'll probably change the name before announcing it here ;p

Diablo-style was simple attempting "mouse" control. I am still experimenting with it, and I don't think that it is appropriate for general maps yet. You can bind special keys that you can hold down to "stand and fire" or "force move" for that mode. Even in regular mode, you can change the mode so the movement directions are relative to camera instead of relative to player. Some people prefer that. Heretic is a lot of fun to play this way, actually.
Ah, got it. Thank you for answer. Keep it up, you are doing good.

By the way - not sure if I am allowed to post it here, but... I made a video, showcasing usage of your mod with a bit crazy mod combo... I got that version from one of your comments under the "main video" that was shown on top of this topic.

Return to “Resources”