Jump to content
The Dark Mod Forums
Sign in to follow this  
lowenz

Conformal perspective as an option in TDM?

Recommended Posts

TDM really suffers from linear perspective deformation (see the moon in the sky when turning :P ), even lowering the FOV.

 

The_Dark_Modx64_2018_07_04_15_25_10_562.image hosting site

 

Isn't worthing some efforts to implement this shader as an engine part with the possibility for the player to choose between the classic - linear - perspective a more "shape-preserving" variant?

 

https://reshade.me/forum/shader-presentation/3916-distortion-correction-conformal-perspective

 

->

 

https://github.com/crosire/reshade-shaders/blob/master/Shaders/PerfectPerspective.fx

Edited by lowenz
  • Like 1

Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites

Do I understand correctly that this thing works like:

1. You render full frame as usual.

2. You do a full-screen post-processing, which stretches some curvilinear part of the frame output onto the screen.

...?

 

The main problem, I guess, is that we must not distort GUI, weapons, tools, lightgem, text messages, etc.

Share this post


Link to post
Share on other sites

It's why I ask if it is possible to avoid the postprocessing shader solution and move the perspective correction to the engine rendering level way before.....no more "correction" at all.


Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites
The_Dark_Modx64_2018-07-04_18-47-20.jpg


The_Dark_Modx64_2018-07-04_18-47-23.jpg

Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites

Oh, thank you very much for that .fx, lowenz, I'll be adding that to my ReShade config. FoV distortion has been the biggest pet peeve for me in 3D games, it seems it's not a priority, nay, even a consideration, for most developers at all.

 

For another example of working curvilinear perspective in a game engine closer to ours, there is this mod: http://strlen.com/gfxengine/fisheyequake/

 

@nbohr Me, I've toyed with fovRatio plenty. It's not really perfect, if anything it just distorts the picture more.


My FMs: The King of Diamonds (2016)



| Visit my Mapbook thread sometimes! | Read my tutorial on Image-Based Lighting Workflows for TDM! |

Share this post


Link to post
Share on other sites

The distortion bugs me too, so I'd be interested in a fix if it won't mess up anything else.

Share this post


Link to post
Share on other sites

Is this even fixable in software?

If the FoV is not matching the distance of the player from the screen, the projection mismatch is perceived as distortion. Changing distance from or size of the monitor would fix it as would changing the rendered FoV to the real FoV that the screen occupies from the players position in physical space.

Share this post


Link to post
Share on other sites

Out of curiosity, have you tried adjusting r_fovRatio to compensate?

Compensate which scenario?


Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites

I believe our Bloom post-process happens before the GUI overlay so this could be hooked into that block if so.

But it's always in a postprocessing pass, in a form of correction of the native linear perspective.

My proposal would be to implement the curvilinear perspective as a WHOLE alternative to the linear one, not just correct it.

Edited by lowenz

Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites

But it's always in a postprocessing pass, in a form of correction of the native linear perspective.

My proposal would be to implement the curvilinear perspective as a WHOLE alternative to the linear one, not just correct it.

It is not possible, due to how OpenGL works.

There is perspective 4x4 matrices, perspective division (clip -> ndc coords), all this is baked into rendering pipeline.

You cannot magically change all this for some nonlinear math, except if you wish to drop OpenGL and implement your own rendering engine directly on CUDA or OpenCL.

With this curvilinear perspective even 3D triangles are no longer triangles on-screen (if I'm not mistaken), so GPU cannot rasterize them as it usually does.

 

The only possibility is to render something in traditional perspective, then bind the obtained picture as texture and perform full-screen post-processing to get bended view.

So you either render player's view as usual and then stretch it, or you render cubemap (much slower) and then apply post-processing to it.

 

If there is a clear place where this postprocessing could be applied, then I guess it won't need much changes in renderer.

If it is so, someone can try to implement it even now (for 2.07) under cvar.

Share this post


Link to post
Share on other sites

It is not possible, due to how OpenGL works.

There is perspective 4x4 matrices, perspective division (clip -> ndc coords), all this is baked into rendering pipeline.

You cannot magically change all this for some nonlinear math, except if you wish to drop OpenGL and implement your own rendering engine directly on CUDA or OpenCL.

With this curvilinear perspective even 3D triangles are no longer triangles on-screen (if I'm not mistaken), so GPU cannot rasterize them as it usually does.

 

The only possibility is to render something in traditional perspective, then bind the obtained picture as texture and perform full-screen post-processing to get bended view.

So you either render player's view as usual and then stretch it, or you render cubemap (much slower) and then apply post-processing to it.

 

If there is a clear place where this postprocessing could be applied, then I guess it won't need much changes in renderer.

If it is so, someone can try to implement it even now (for 2.07) under cvar.

Bloom stage, as proposed before, is good but as a postprocessing option it could blur the image in a non-uniform (much more blur in the center of the image) way AND generate some clipping problem at the borders of the scene :/

Edited by lowenz

Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites

Goddamnit. This isn't something I even noticed before you mentioned it... now I can't seem to ignore it. :(

 

The weird thing is that it seems to be pretty obvious in TDM now that I pay attention to it, but most other games don't seem to have this issue. Either that or I'm just noticing a more "fish-eyed" lens in TDM for some reason.

Large (>80/90) HORIZONTAL FoV causes the issue, in every engine using linear perspective.

Using 16:9 resolutions you must set an higher FoV than good old 4:3 ones, so the issue is always there and sometimes very noticeble.....

 

It's why back in the days devs started using norrow horizontal fov angles (65) - see Crysis 2/3 and so getting a "tunnel vision" :( - but the problem lies in the linear perspective itself.

Edited by lowenz

Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites

:( - but the problem lies in the linear perspective itself.

No. If you change perspective, you get non-straight lines. They are much more annoying than non-perfect circles.

The real problem here is, that the distance between player and monitor does not match the rendered FoV for most people, because the screens are only occupying a small part of the humand FoV (except when playing on really big screens or with really low distance between screen and player).

Getting a bigger screen (or a VR headset) could fix it. Lowering the distance between player and screen could fix it too. Changing the projection will only make things worse.

Share this post


Link to post
Share on other sites

No. If you change perspective, you get non-straight lines. They are much more annoying than non-perfect circles.

I know (see the shader!), but you can tweak the parameters value to avoid a heavy curvature!


Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites

Yes!


Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites

Ah, the correction strategy in Q2XP is the same shader I posted :P


Task is not so much to see what no one has yet seen but to think what nobody has yet thought about that which everybody see. - E.S.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...