Improved reflections (less taxing. Better looking.)

Moderator: GZDoom Developers

Post Reply
User avatar
cortlong50
Posts: 753
Joined: Mon Jun 24, 2013 7:12 pm
Location: UT-WA

Improved reflections (less taxing. Better looking.)

Post by cortlong50 »

Okay. Hear me out.

So I’ve been playing Turok 2 remastered (its amazing. That goes without saying.) and one of the simplest, yet most effective effects that were added to the game were screen-space reflections. It adds just the perfect amount of depth to the world and livens up otherwise really dull and ugly textures (N64 wasn’t the best looking console, and Turok 2 is arguably the best one on that console...and the textures are pretty beat.)

NOW. I know reflections are already a thing. But every single time I try to implement them it’s just a taxing mess. They look pretty decent but I know they could be better.

Well on Turok the reflection fades after an object is a certain z-height up. I’d say the doom equivalent is like 8-12 units. Very small. It’s only objects that are close to the plane.

Second there is a very simple blur on the reflection that is used on the reflection and I think the doom equivalent would just be lowering the resolution based on how far away it is from the plane. That might look a little messy but it would be better and less taxing than what we have now, or someone could always write a shaded that blurs it based on distance. If I know how I’d be on it.

Third what we seem to have now is a complete recreation of the world above based on perspective that is mirrored underneath the sector. No critique on anything because it works...but let’s be real...that is an INSANELY inefficient. At the very least why doesn’t it render the “under-world” or “mirror” at half resolution kinda like TCAMTEX does? So that it’s using literally half as many resources. And then take it a step further and make it so you set not only the reflective ness of a surface but also the level at which that reflectiveness stops reflecting.

So let’s say you have a room that’s 256 units tall...you set the “dither” at 80 so anything that is beyond that 80 doesn’t get reflected at all. And anything within that reflection is rendered at 1/2 to 1/3 resolution. This illeviating the huge burden that is reflections and to me getting a better looking, more realistic reflection. I think it would look better and save a lot of GPUs from kicking into over drive.

If you’d like screenshot examples I’d be glad to supply them. They’re super simple and the performance hit is next to none. They did a really good job optimizing this game.


Sorry that was long.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Improved reflections (less taxing. Better looking.)

Post by Graf Zahl »

none of this will make the processing any simpler. The main reason for performance issues is not the rendering (modern graphics hardware is fast enough to do this 10x over easily) but the fact that all the mirrored geometry has to be processed again (BSP traversal, render data generation and passing it to the hardware)

Rendering at half resolution can only be done by drawing to an offscreen buffer and then back to the main screen, which will end up even more costly and fading out stuff after a few pixels will require a costly shader effect that again won't save any CPU side processing effort which is the main factor here.
User avatar
cortlong50
Posts: 753
Joined: Mon Jun 24, 2013 7:12 pm
Location: UT-WA

Re: Improved reflections (less taxing. Better looking.)

Post by cortlong50 »

Okay so can you explain to me what is happening when the engine tries to simulate reflections?
As far as I can tell by noclipping and looking at it it’s essentially just creating a layer underneath the layer (in the dumbest explanation possible) that literally mirrors the upper layer kinda like a 3D floor that is showing the exact same thing underneath right? Again, that’s the dumbest way I can explain it without it being too long. Kind of like the way a portal into the next room works but on the floor/ceiling? Which I assume is insanely complicated. But again. Simplified for the sake of the forum.

Could the system that works for TCAMTEX work for reflections? Is that done by being drawn to a buffer?

The fading out would definitely be costly because it would probably end up using a blur shaded or filter but I think if we could find a way to implement a more efficient reflection that cut the amount of elements reflected in half, or cut the resolution down efficiently somehow then I think making it look better could be accomplished later.

Sorry, again I don’t know exactly what goes into it but in theory (ha) I think there could be a better way that could really save some frames and look better.
User avatar
cortlong50
Posts: 753
Joined: Mon Jun 24, 2013 7:12 pm
Location: UT-WA

Re: Improved reflections (less taxing. Better looking.)

Post by cortlong50 »

Also just tried reading up on BSP...and holy shit man.

(I wrote a huge log comment. Hopefully it gets approved soon.)

I would like to fully understand the pipeline so that I can see if and where we can half the resolution, or send it half of the information or height information. Something along those lines. Because if the BSP could only be sent the information of a sector up to a certain z height (again. Let’s say 126) then it wouldn’t even need to pass along the rest of the sector information to the renderer. It would only pass along what it has.

Hell. Maybe even obscure the rest of the unrendered sector with a fog or something simple that older games did.

Again it’s hard for me to say without knowing what the pipeline is for rendering reflections but I will say my mind is having fun imagining haha.

I would imagine if anything was goin to change though it would take a complete from the ground up do-over and not just something added to the current system.
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”