Jump to content
The Dark Mod Forums


Active Developer
  • Content Count

  • Joined

  • Last visited

  • Days Won


stgatilov last won the day on January 5

stgatilov had the most liked content!

Community Reputation

652 Legendary

About stgatilov

  • Rank
    Lead Programmer
  • Birthday 08/26/1989

Contact Methods

  • Website URL
  • Jabber

Profile Information

  • Gender
  • Location
    Novosibirsk, Russia

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I don't see anything unexpected. Everything gets brighter, since you efficiently apply gamma conversion on the final output, which is a bit stronger than what setting r_gamma 2 in TDM gives. Of course, this is too much, so everything becomes very bright. When such gamma correction is done, colors become weaker, and can also change slightly. What did you expect? The best thing that you can achieve with SRGB is that intensities are added/blended in a more physically correct way. To achieve it, you have to mark all textures as SRGB, and all FBOs as SRGB. Then the output should be more or less the same in terms of brightness. You cannot control gamma level with SRGB in a way how tone mapping or monitor tables allow it.
  2. Attached patch for moving gamma/brightness changes to shader. I'm afraid I cannot apply it to all cases (case r_postprocess 2 is not working now as it seems). I have hardly managed to get it working without postprocessing... One side effect is that main menu is not affected by gamma/brightness changes. Not sure if it is good or bad. P.S. As for dithering, it can help only if you apply it when you draw the thing which shows color banding, e.g. when you draw sky and clouds. In the final pass, it is useless. gammashader.patch
  3. Well, I guess when I said "default FBO is gamma space", I was meaning that you must put gamma-space values there, since they are treated as such by the monitor. I did not mean that OpenGL automatically ensures that it gets gamma-space data, although I think there should be way to achieve it. I think the main explanation is that OpenGL thinks default FBO is RGB since you did not tell it otherwise and OpenGL does not do any conversions without you telling it to do them. The FBO which you are blitting from contains gamma-space values, and you told OpenGL it is SRGB (by setting image format and enabling GL_FRAMEBUFFER_SRGB), so it auto-converts its data from gamma-space to linear-space during blitting. But you did not tell OpenGL that default FBO is SRGB, so it assumes it is linear and it does not do any conversion. Looking at https://stackoverflow.com/a/46117749/556899, you have to pass some flags to WGL to ensure that default FBO is SRGB-capable, then enable GL_FRAMEBUFFER_SRGB. Did you do both of it? Same as above. You did not tell OpenGL that default FBO is gamma-space, so it assumes it is linear (while it clearly is not) and does not do any conversion.
  4. The cvars will works as usual. One thing I also want to try is to optionally add a clever dithering to make color banding unnoticeable. Not a good thing for TDM with its visual style, but perhaps some players would prefer it to obvious color banding. I'm afraid there is some sort of misunderstanding here. The "linear space" is where we can sum colors with mathematical addition and that would work like how light intensities add in the real world. It is also called RGB, but this is even more confusing, because when people hear RGB, they think it is what was always around, which is exactly opposite. The "gamma space" is also called SRGB, this is the representation which monitors expect from rendering output (omitting some minor details like different gamma value in different monitors). SRGB is what has been all around us since the beginning. Almost all image files are stored in SRGB space, they look correct when you open them in ordinary image editor since it just sends this data to monitor. Textures of a modern gamma-correct game may also be represented in linear space: in this case opening them in something stupid like paint would show them as too dark. Although they are most likely in such formats that point won't open them. The old approach of rendering is: everything is in 8-bit SRGB (gamma space). No conversion is done when opening ordinary image files, no conversion necessary after rendering is done. However, when renderer computes lighting, it adds intensities with simple addition straight in the gamma space (SRGB). It is incorrect, so lights blending and quadratic falloff look wrong. It would be correct if rendering was in linear space, but it is not. This is how Doom 3 is working, and this is how TDM normally works. The first solution to the problem is rendering everything in linear space (RGB). Then you store all textures in linear space (i.e. they look wrong when you open them in paint), you store all FBOs in linear space. At the very end of rendering, you do gamma correction as the final pass, thus converting color from linear space to gamma space in order to send it to monitor. To avoid color banding from final gamma correction, you use HDR, i.e. high-precision color formats. The second solution is to use SRGB support in OpenGL. You mark incoming textures as SRGB, and mark your FBO as SRGB. It does not magically changes anything, because in TDM they are all SRGB regardless of whether you mark them or not. But now blending and texture filtering have convert from gamma space to linear space before operation, and from linear space back to gamma space after operation. Thus, intensities are adding up properly. Moveover, when you fetch data from texture marked as SRGB in your shader, OpenGL automatically converts it from gamma space to linear space before returning it. If you write output color to SRGB buffer (and have enabled something on that FBO), then OpenGL automatically converts it from linear space into gamma space. So whatever you have in your shader is in linear space (and most likely in 32-bit float), but all data out of shader is in gamma space (and most likely 8-bit since if you use more precision than the first solution is better). So you are wrong saying that default framebuffer is linear. It always contains SRGB (gamma space) data. And our textures always contain SRGB data. The only problem is that we incorrectly deal with this SRGB data all over the renderer. And using the SRGB extension in OpenGL allows to fix that, forcing OpenGL to auto-convert to linear space and back around every operation which could add colors.
  5. Ok, how about this. We add a trivial shader, which only applies r_gamma and r_brightness to the scene. If postprocessing is off, we just run it over the whole screen. If it is on, we run it after postprocessing is over. We run it as the very final step in any case! So we can finally remove stupid monitor tables and Linux equivalents. Color banding still here, of course. Ambient tweaks and SRGB stay as experimental stuff. Speaking about color banding with SRGB. There should be no color banding if you display srgb buffer "as is". Such buffer is already in gamma space, native for the monitor. The difference from RGB is that shader automatically converts inputs from gamma space to linear space and outputs from linear back to gamma. But if you want to do any additional gamma adjustments, then you are screwed without high precision buffers.
  6. Looking at the code, used_by_inv_id spawnarg is not read anywhere. I guess that note on wiki is a king of feature request. UPDATE: I don't see inv_id either.
  7. I think it was a better idea to make @taaaki know this, maybe this is some misconfiguration on his part. Without his assistance, communication with support would be problematic anyway.
  8. Did you try to set gamma/brightness in game console? Usually you press Ctrl+Alt+Tilde to open game console. Type r_gamma 1.5 or r_brightness 2 there and hit Enter. Check if it affects the visual look.
  9. It depends on .proc file. If you use the old one, there is no "prelight" in the .proc file. As the result, it works. If you dmap it, then prelight version gets added to the .proc file. The engine sees that and chooses a different code path in one place, which results in incomplete lighting. I'll look into it.
  10. Bugs... they happen from time to time I recall how I reviewed this code and missed it. Perhaps should add a random test on this function (i.e. compare to results of generic implementation). Anyway, I have recalled where I saw a big outdoors map with huge light, I have found it in my installation. It was Noble Cave by AluminumHaste. Unfortunately, it has not portals outdoors, maybe because adding them broke shadows. Calling @AluminumHaste...
  11. Dragofer reported a problem with shadows, but it turned out to be an entirely different problem (5106). Basically, TDM 2.07 introduced a horrible bug to stencil shadows. Most likely, it only affects precomputed stencil shadows for projected/directional lights. Also, it does not affect mappers having too old CPUs. If you dmapped anything with TDM 2.07 with projected/directional lights, it might be worth to re-dmap it with TDM 2.08 when it comes out. P.S. Still, I would be happy to see some testmap with (global) parallel light broken
  12. Well, I did not achieve anything good about this problem. Only fixed popping on perfectly flat walls with rough bumpmap (by hacking shading equation). Looking here and here, I see the following solutions: Offset the front cap of the shadow volume along outer normal by some constant distance. "Front cap" is the part which matches the backfaces. Then enable lighting for backfaces (probably can be done even now with cvar). So, it should make things better, but may introduce light leaks on nearby objects. Render front faces as normal, but then additionally render backfaces where stencil value >= 2. In simple cases there is only one layer of shadow polygons in front of it, and such places will be lit by ordinary shading, which should be smooth and dark anyway. Hack shading equation, so that it makes triangle darker when angle between triangle normal and light direction is small. This is the easiest to do, but my attempts to do so made polygonization or apples even more obvious. I did not try points 1 and 2. Maybe something to consider in future. Point 2 sounds interesting.
  13. I have bumped into an old issue about glitches with directional lights: 3818. At the same time, I have recently fixed a bug in interaction culling, which happens when light source illuminates many portals areas at once. If we are lucky, that bug could be the only one It would be great to check it on some test map. But creating a testmap from scratch would be a horrible waste of time. I wonder if someone had experimented with parallel lights and vast outdoors areas and saw shadows randomly disappearing. If yes could you please share your test map?
  14. Yes, we compiled it with VC 2017. Of course, it needs proper redist package to be installed. To be honest, the only thing which surprises me is that TDM 2.07 works fine but TDM 2.07-hotfix does not. This is almost the same code built with same tools and settings. How can it be?
  • Create New...