RobertBeckebans / RBDOOM-3-BFG

Doom 3 BFG Edition source port with updated DX12 / Vulkan renderer and modern game engine features
https://www.moddb.com/mods/rbdoom-3-bfg
GNU General Public License v3.0
1.4k stars 251 forks source link

light fallOff texture projection is broken #50

Closed motorsep closed 10 years ago

motorsep commented 11 years ago

http://i.imgur.com/ZYljRpv.jpg

See vertical lines on the far wall? That's fallOff image. Works fine in idTech 4 but in BFG just always causes issues. Lines are absent when image is not used in the light material (_noFallOff ?).

Any clue where the issue lies?

BielBdeLuna commented 11 years ago

In idtech4 it doesn't happen? I've seen lines like this due the fog falloff image, I guess this is the same issue

motorsep commented 11 years ago

No, never had such thing happening in idTech 4, not even with fog.

BielBdeLuna commented 11 years ago

if you do the trick via scripting of binding a light with a fog shader with it's own falloff texture, or if you add a directional light with a falloff texture, you should see this, maybe you can force it by pulling up the gamma?

this is specially true if you draw the falloff texture, instead of using a gradient.

BielBdeLuna commented 11 years ago

if you do the trick of binding a light with a fog shader with it's own falloff texture, or if you add a directional light with a falloff texture, you should see this, maybe you can force it by pulling up the gamma?

2013/6/10 motorsep notifications@github.com

No, never had such thing happening in idTech 4, not even with fog.

— Reply to this email directly or view it on GitHubhttps://github.com/RobertBeckebans/RBDOOM-3-BFG/issues/50#issuecomment-19209295 .

motorsep commented 11 years ago

What do you mean by "using gradient"? Fall off is a gradient image (at least based on what Doom 3 has in its lights/ folder and in materials). That issue on screenshot happens with gradient fall off image.

BielBdeLuna commented 11 years ago

indeed, but when you draw the falloff image by hand you get a much more noticeable effect than doing it via an automatic gradient.

motorsep commented 11 years ago

o.O how do you make lights use automatic gradient?

BielBdeLuna commented 11 years ago

no, no, no, I meant that you create the falloff texture by automatic means, like linear gradients in Gimp instead of creating it by hand (like you would do in fog textures in order to have diversity in the fog effect falloff)

motorsep commented 11 years ago

oh, I see. That's how my fallOff images are made for lights - in GIMP using gradient tool.

offtopic: I didn't know fog can have fall off image - never worked when I tried same thing I do for lights.

BielBdeLuna commented 11 years ago

I think this is the same behavior you can see when using the flashlight (it's light uses a falloff texture, that's the reason it's light decays with the distance) if you light up a slick wall without any detail, you start to see banding as you approach the wall, it is actually the different stages of the fall off texture being rendered as you approach the wall, the only way I think you could stop having this effect would be to increase the bit depth of the falloff texture, so you would have more "stages".

But I think a better solution should be devised, as it is right now, the falloff image for light is a line of pixels displaying a gradient, maybe this can be an in-engine feature created at map start? or at engine start? maybe like some other in-engine textures like the white texture? and maybe even have it as long as the actual length of the light that needs it?

motorsep commented 11 years ago

So fall off image should be a GLSL shader instead of image?

The problem is, I think (after messing with it a bit more), that the lines are there even if fallOff isn't specified at all. What happens is that light image perimeter pixels (not fallOff image, but the normal light image) are taken and "stretch" by Z axis. But even using 2px black/ white padding doesn't fix it.