Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Vrad generates extreme noise when compiling with low luxels scale #1347

Open
Unusuario2 opened this issue Jan 31, 2025 · 9 comments
Open
Labels
Type: Bug This is a problem with something that should be working one way, but isn't.

Comments

@Unusuario2
Copy link

Describe the bug

(vrad command line -StaticPropLighting -StaticPropPolys -PortalTraversalLighting -PortalTraversalAO -LargeDispSampleRadius -StaticPropLightingFinal -StaticPropBounce 16 -aoscale 0.2 -aosamples 256 -ldr -hdr -staticpropsamplescale 0.9):

Image

Note: disabling AO doesn't change anything

To Reproduce

  1. Download the map example.
  2. Compile & run the map.
  3. See the noise that should not be generated.

Issue Map

enginetest.zip

Expected Behavior

See the noise that vrad generates. (this should not happen)

Operating System

No response

@Unusuario2 Unusuario2 added the Type: Bug This is a problem with something that should be working one way, but isn't. label Jan 31, 2025
@JJL772
Copy link
Member

JJL772 commented Jan 31, 2025

What happens when you increase the sky samples with -extrasky N? (where N is some number)
-final is the same as -extrasky 16

@Unusuario2
Copy link
Author

Stills is an issue in low luxels enviroments: (having large extrasky values like 32/64 makes it worst)
-extrasky 16:

Image

-extrasky 32:
Image

@Unusuario2
Copy link
Author

Unusuario2 commented Jan 31, 2025

also seems that the lightmaps have some kind of compression which is very obvious in game, i dont know if that is the case or some weird vrad effect.

@JJL772
Copy link
Member

JJL772 commented Jan 31, 2025

lightmaps in Source are stored in RGBExp32 format, so there can be quite a lot of data loss. https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/public/mathlib/mathlib.h#L1018-L1024
The banding becomes really obvious when using flat grey/white textures. Ideally we'd be storing lightmaps as float BC6H or something, but that's easier said than done...

@Unusuario2
Copy link
Author

maybe i could try changing the RGBExp32 format to B6H in the source sdk 2013 and then you guys use it as reference what so ever. Ideally the best thing would be to add a command like -format_lightmap_RGBExp32, -format_lightmap_B6H because not all the users will notice these issues (also B6H for example is larger than RBGExp32 so that could increase the weight file.)

@SCell555
Copy link
Member

Switching from RGBE to BC6H will likely more than double the file size of lightmaps, 4 bytes per pixel to 128 bytes for 16 pixel block, and also would pad every lightmap size to be multiple of 4.

@Smaedd
Copy link

Smaedd commented Jan 31, 2025

It should compress size, BC6H is 128 bits, not bytes (16 bytes) per 4x4, so it should be 1/4 of the size

@Unusuario2
Copy link
Author

Unusuario2 commented Jan 31, 2025

The lightmaps generated by vrad are always in the same format (.vhv) besides the compresion method no? For example in the mp branch if you have lightmapped props those will be in RGBA8888 but with a custom vrad that format could be changed and everything will be fine, does this behaviour also apply to .vhv?

In source 2, valve for compressing lightmaps uses BC7 and BC6H

Image

Docs: https://learn.microsoft.com/es-es/windows/win32/direct3d11/bc6h-format
https://learn.microsoft.com/es-es/windows/win32/direct3d11/bc7-format

Also should i make a new issue about this topic?

@craftablescience
Copy link
Member

vhv files are for prop vertex lighting, they are not lightmaps

ppl files are prop lightmaps and are stored differently and separately from bsp lightmaps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug This is a problem with something that should be working one way, but isn't.
Projects
None yet
Development

No branches or pull requests

5 participants