Facepunch / sbox-issues

177 stars 12 forks source link

The First Cubemap Entity That is Placed in a Map Will Always Show Up When Transitioning into a Different Cubemap. #369

Closed justyn0 closed 2 years ago

justyn0 commented 3 years ago

Describe the bug The first combined light probe or env_cubemap you placed in a map will show up when you or an object is transitioning into a different cubemap.

To Reproduce This bug affects every single map, but I made a map to showcase this bug. maps.zip

Videos The first combined light probe I placed is in this red room. In the video, It shows the cubemap from the red room always shows up when transitioning into different light probes.

https://youtu.be/IjfXkNA3FTo

Additional context

I think this bug was introduced into the game around the time when the new player pawn was added. Also, I think the engine is forgetting the last cubemap you or an object was in. This currently effects non-static entities Players, physics props, dynamic props, decals, etc.

piqey commented 3 years ago

I have been unable to get any cubemaps to cast upon specular surfaces at all. The Cubemap Reflections mode under Tools Visualizations in the editor displays every surface as being completely black; when I select any cubemap it does not project the cyan and white checkerboard it is meant to show to indicate its projections on nearby surfaces. I also noticed that lighting previews for cubemaps baked in-editor are saved to the maps directory of the last alphabetically sorted addon folder instead of the addon that contains the map I'm baking. Hesitant to open a new issue as cubemaps do seem to have a good number of problems at the moment.

I made a small map for testing cubemaps. Something I noticed now that I did not notice before is that the checkerboard I mentioned previously does actually render in the editor's All Lighting preview (albeit only on certain materials). I tried baking the preview lighting for this map and the cubemap's editor model had the reflections but nothing else did. I also tried using the Cubemap Reflections tools visualization again but it was completely black.

justyn0 commented 3 years ago

Another bug that is worth mentioning. Is also broken for me. image

justyn0 commented 3 years ago

Looks like this bug also affects world geometry. For Example, A mesh is not touching any combined light probes, so the mesh will use the first placed combined light probe's cubemap.

justyn0 commented 3 years ago

If you have your combined light probe perfectly fit with your room dimensions. The parallax would not work for the floor, walls, and ceiling.

sbox-dev_EYyJNRcem6

https://user-images.githubusercontent.com/17112771/128645848-9bca6582-745d-4606-91fe-82d8139a53f6.mp4

To get around this problem. You have to extend the light probe box way out.

sbox-dev_V0NGSzkLE2

https://user-images.githubusercontent.com/17112771/128645860-b88b1688-6358-4971-86a6-9343ebb7da17.mp4

This is not really efficient since it mess up the parallax and could assign other meshes with the wrong light probe since this box is big.

cubemapbug2.zip

justyn0 commented 3 years ago

This bug also messes up baked specular from light probes as seen in these screenshots.

s&box image

Alyx image

justyn0 commented 3 years ago

Bumping this because this issue is still present and it effects every map

PixelQubed commented 3 years ago

Yes, I agree. This is an important and quite frankly annoying bug that does need fixing fairly soon. It's causing all sorts of weird effects.

samzanemesis commented 3 years ago

Fixed, will be pushed when we do a full shader compile

Custom shaders should take advantage of it already

justyn0 commented 3 years ago

Alright, let me know when all of the shaders gets recompiled so I can test out this bug.

justyn0 commented 3 years ago

This bug is not quite fixed. When a object go outside of a lightprobe. That object will uses all of the cubemaps in the map. Which it gives horrible lighting and it's very noticeable.

Also, when 2 lightprobes are near each other It doesn't the blend the cubemap, but if you put a lightprobe inside of a lightprobe then it will blend the cubemaps when objects go through those lightprobes.

https://user-images.githubusercontent.com/17112771/137914685-b49eac93-7ce8-4914-b0bd-539db322cbc8.mp4

Compiled map and sources. cubemapbug.zip

QuackCola commented 3 years ago

I'm getting some very strange flickering artifacts on textures with the probes which wasn't an issue the day before the shader recompile.

https://streamable.com/s1u8cb

Compiled map and source cubemapbug2.zip

KayaDLX commented 3 years ago

I'm getting some very strange flickering artifacts on textures with the probes which wasn't an issue the day before the shader recompile.

https://streamable.com/s1u8cb

Compiled map and source cubemapbug2.zip

Can confirm this happening to me as well since a few days.

Lucinyu commented 3 years ago

I confirm the above by QuackCocaine, it also happens to me on my keysiv gamemode/map.

GPU: 1070 GTX 8GB I can't seem to reproduce it every single time but it's pretty frequent.

justyn0 commented 2 years ago

Technically this specific bug has been fixed so I'm closing this, but there many other cubemap bugs.

https://github.com/Facepunch/sbox-issues/issues/1484 https://github.com/Facepunch/sbox-issues/issues/1482 https://github.com/Facepunch/sbox-issues/issues/489 https://github.com/Facepunch/sbox-issues/issues/1476