jval Posted June 21, 2013 kb1 said:jval: So what exactly (mathmatically) is "3d perspective"? How does it differ from standard software rendering? DelphiDoom's fake 3d is a compination of zaxisshift, aspect ratio changing depending on the look up/look down angle, panning and stretching of horizontal lines depending on the line Y position and finally a trapezoid to rectangle stretch. Stroggos said:Ken Silverman did actually describe the format in the readme file of another project of his called Slab6. So you can just use what he describes there without the need to tear apart the BUILD engine and use that license. That was the guideline I've used to make the KVX loader, but DelphiDoom reads only the first mip of the KVX file and convert the data to an internal structure. Then it generates mip levels at loadtime. 0 Quote Share this post Link to post
kb1 Posted June 21, 2013 jval said:DelphiDoom's fake 3d is a compination of zaxisshift, aspect ratio changing depending on the look up/look down angle, panning and stretching of horizontal lines depending on the line Y position and finally a trapezoid to rectangle stretch. So, if I understand you correctly, you are doing the following transformations: Assuming you're looking upward: * Increase the view point along the up-down axis (I'll call it Y), like Heretic does. * Adjust FOV on a per-scanline basis (higher FOV near the top of the screen, which makes the top of walls closer to the horizontal center (X) of the screen). * Apply a scale factor for flats (think ceilings) when rendering them from top to bottom, effectively reducing the amount that they are visually stretched. If that's what's happening, that's quite impressive, and has the benefit that it doesn't slow down the render much at all. Nice! I imagine that it's also limited to a certain view angle - does it start to look bad past 45 degrees? 0 Quote Share this post Link to post
jval Posted June 22, 2013 kb1 said:* Increase the view point along the up-down axis (I'll call it Y), like Heretic does. Yes, the zaxistshift is from Heretic/Hexen. kb1 said:* Adjust FOV on a per-scanline basis (higher FOV near the top of the screen, which makes the top of walls closer to the horizontal center (X) of the screen). Not excactly, I adjust FOV depending on look up/down angle (bigger angle, bigger FOV) for all the rendering context and also adjust floorclip or ceilingclip to avoid overdraw. kb1 said:* Apply a scale factor for flats (think ceilings) when rendering them from top to bottom, effectively reducing the amount that they are visually stretched. If you look the 3rd picture of the first post the horizontal scanlines are stretched to fit "windowwidth" and also the Y positions of each scanline are altered in a way that if you are looking up the small Y values are getting smaller and the bigger Y values are closer to their original position. kb1 said:If that's what's happening, that's quite impressive, and has the benefit that it doesn't slow down the render much at all. Nice! I imagine that it's also limited to a certain view angle - does it start to look bad past 45 degrees? A transformation lookup table is created for each of look up/look down angles to avoid doing all the above calculations in each frame. When "viewwidth" changes the lookup tables are recalced. The procedure does not slow down the renderer because the extra time needed fot the calculations is gained by the modified floorclip/celingclip (less drawing) and by using multithreading. Look up is limited to 45 degress and look down to 37 degress. 0 Quote Share this post Link to post
entryway Posted June 22, 2013 Maes said:in fact, in Heretic shifting view means recomputing the yslope table every time I knew z-shiftting mlook should not be hard for implementing, but never thought that full implementation is about 10 lines of code. I added mlook to software mode to prboom-plus this night. Sky stretching code was taken from ZDoom. 0 Quote Share this post Link to post
Memfis Posted June 22, 2013 ZDoom also has a useful button that enables mouselook while you're holding it. Normally I play without ML but if I really need it in some situation, I can enable it for a moment by pressing and holding right mouse button. Would be nice to see this in prboom+ as well! 0 Quote Share this post Link to post
jval Posted June 22, 2013 entryway said:I knew z-shiftting mlook should not be hard for implementing, but never thought that full implementation is about 10 lines of code. I added mlook to software mode to prboom-plus this night. Sky stretching code was taken from the ZDoom. Indeed, it took me by suprise when I first checked with Heretic/Hexen source code. 0 Quote Share this post Link to post
Maes Posted June 22, 2013 entryway said:I knew z-shiftting mlook should not be hard for implementing, but never thought that full implementation is about 10 lines of code. I added mlook to software mode to prboom-plus this night. Sky stretching code was taken from the ZDoom. I have added it to Mocha Doom from v1.5 and onwards (though it's undocumented, and uses PgUp/PgDown/Home/End). Yeah, it really is an easy hack, and it only cross-cuts other code in very few places, where the lookdir variable is used. The only potentially demo-breaking part is when the lookdir is used to bias/aid player autoaim. 0 Quote Share this post Link to post
Da Werecat Posted June 22, 2013 Memfis said:ZDoom also has a useful button that enables mouselook while you're holding it. Normally I play without ML but if I really need it in some situation, I can enable it for a moment by pressing and holding right mouse button. Would be nice to see this in prboom+ as well! GLBoom+ already has a button to toggle mlook. It also toggles the sky rendering method. 0 Quote Share this post Link to post
kb1 Posted June 25, 2013 entryway said:I knew z-shiftting mlook should not be hard for implementing, but never thought that full implementation is about 10 lines of code. I added mlook to software mode to prboom-plus this night. Sky stretching code was taken from ZDoom. Yep, it may look a little crappy, but, you're right: for 10 lines of code, it's hard to justify not adding it. Now, it gets a bit more tricky to do some other things, like weapon aiming. You *could* leave it original, but, with orignal code, you can see the monster, but not be able to hit it, with extreme mlook angles. Of course, that happens without mlook sometimes as well :) Another issue is the non-vertically-wrapping sky. I seriously wish someone with artistic abilities would make a set of super-tall skies that look original. :) Please! (or did I miss them?) I know there are some slightly-larger ones out there (240 pixels tall vs. 200, but that's not enough.) Of course, the port must have 'tall wall' support. One last thing: Killough's renderer optimizations and mlook don't quite jive - I remember having to modify some Killough clipping code to prevent sprites from disappearing. Like if you're at the top of the stairs in E1M1, I had shotgunners disappearing below me intermittently, when they should have been visible. I don't have the code in front of me now, so I can't tell you what I did to fix it - but, just test it - maybe it's not a problem for you anyway. But, if you fix it wrong, Doom wants to render sprites that are way above or below the screen boundaries, and it's caught much later in the pipeline, so to speak, right before rendering, which slows things down a bit (per row clipping vs. per-sprite). 0 Quote Share this post Link to post
entryway Posted June 25, 2013 kb1 said:One last thing: Killough's renderer optimizations and mlook don't quite jive - I remember having to modify some Killough clipping code to prevent sprites from disappearing. Like if you're at the top of the stairs in E1M1, I had shotgunners disappearing below me intermittently, when they should have been visible. I don't have the code in front of me now, so I can't tell you what I did to fix it - but, just test it - maybe it's not a problem for you anyway. It would be nice to fix it, but without rewriting too much of code. If you already know how to do it, send me a patch, please. 0 Quote Share this post Link to post
Gez Posted June 25, 2013 kb1 said:Another issue is the non-vertically-wrapping sky. I seriously wish someone with artistic abilities would make a set of super-tall skies that look original. :) Please! (or did I miss them?) I know there are some slightly-larger ones out there (240 pixels tall vs. 200, but that's not enough.) Of course, the port must have 'tall wall' support. For ZDoom (and so apparently PrBoom+ now) the sky needs to be 544-pixel tall to a void tiling entirely. Though most of that (344 pixels) will be below the horizon line; so 200 should be enough when you don't have sky floors. 0 Quote Share this post Link to post
kb1 Posted June 25, 2013 entryway said:It would be nice to fix it, but without rewriting too much of code. If you already know how to do it, send me a patch, please. Does your source actually exhibit the problem? Here's my fix, which is not so great, I just pre-clip using a taller window, and expect the sprite to be culled later: In R_ProjectSprite:// killough 4/9/98: clip things which are out of view due to height // [kb] add +1 so sprites are shown even with the extended freelook if (thing->z > viewz + FixedDiv(viewheight << (FRACBITS + 1), xscale) || gzt < viewz - FixedDiv((viewheight << (FRACBITS + 1)) - viewheight, xscale)) return; It could be greatly improved by devoting some thought to the matter, but, whatever is done must be faster than the clipping that occurs later, or you haven't saved any time. The above code DOES work, though, even with an extreme mlook (screen.height * 3), in that sprites never disappear unexpectedly, and far-out-of-range sprites do still get rejected, so it's seems like a good compromise between simplicity and speed. If you think of a better algorithm, please let me know. 0 Quote Share this post Link to post
entryway Posted June 26, 2013 kb1 said:In R_ProjectSprite: Thanks. http://pastebin.com/0QfimPHn 0 Quote Share this post Link to post
SoDOOManiac Posted May 7 On 5/4/2013 at 12:36 PM, jval said: Y-shearing Last days I'm rewriting the module trying to bring it closer to the real thing Hello, could you please point me to where that code is in GitHub repository? 0 Quote Share this post Link to post
jval Posted May 7 36 minutes ago, SoDOOManiac said: Hello, could you please point me to where that code is in GitHub repository?  Here it is: https://github.com/jval1972/DelphiDoom/blob/master/Base/r_fake3d.pas  All the hard work is done in R_ComputeFake3DTables() function. This function (pre)calculates everything that is needed to execute the transform for each possible value of lookdir (up/down). The information is saved in memory, to avoid unnecessary calculations. The R_Execute3DTransform() executes the transformation of the screen buffer, by using the information that the R_ComputeFake3DTables() function has calculated. 2 Quote Share this post Link to post
SoDOOManiac Posted May 7 27 minutes ago, jval said: Here it is: Thanks a ton! May I use your math in So Doom, my fork of Crispy Doom? 1 Quote Share this post Link to post
jval Posted May 12 On 5/7/2024 at 12:36 PM, SoDOOManiac said: Thanks a ton! May I use your math in So Doom, my fork of Crispy Doom? Sure, as long as your code license is GPL compatible. 2 Quote Share this post Link to post
Redneckerz Posted May 12 4 hours ago, jval said: Sure, as long as your code license is GPL compatible. Just a heads up that this kind of stuff is awesome to see. Sharing code is one of the reasons this community is what it is and we should always relish this. So thank you, Jval :) 1 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.