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

Black spots on lightmap possible causes? #109

Open
TomArrow opened this issue Jun 20, 2022 · 20 comments
Open

Black spots on lightmap possible causes? #109

TomArrow opened this issue Jun 20, 2022 · 20 comments

Comments

@TomArrow
Copy link

Hey,

I was wondering if you had any idea what could cause issues like these:
shot0698
shot0694
shot0697

In the editor it looks fine:
editor

It's a very big map if that matters.

Cheers

@TomArrow
Copy link
Author

TomArrow commented Jun 20, 2022

P.S. Compile settings I used, if relevant.

-bsp -meta -verboseentities -flares -v 
-vis -saveprt -v 
 -light -fast -dirty -style  -super 2 -filter -patchshadows -nocollapse -nolightmapsearch -debugsamplesize  

Game is Jedi Knight 2

@ghost
Copy link

ghost commented Jun 20, 2022

Looks like it could be a bad shader. Make sure all surfaces to be lightmapped have map $lightmap tcgen lightmap in them. Maybe also try without all the extra compile switches if you haven't already.

@TomArrow
Copy link
Author

Thanks!

Would a different surface in another place of the map that doesn't have "map $lightmap tcgen lightmap" be able to cause this issue if it didn't affect this surface? Most of the textures here have no shader written for them, they are just ordinary textures, which I presume the game will automatically interpret as to be lightmapped.

What could be an example of a bad shader? And would a bad shader in a different part of the map be able to cause this issue here?

@ghost
Copy link

ghost commented Jun 21, 2022

If you haven't written your own shaders for those surfaces then they should have their lightmaps applied properly. I'm not smart enough to debug such a thing without access to the map. Maybe garux can tell you, but either way I'm doubtful this is a bug from q3map2 or radiant. You'd have better chances asking this in a mapping discord.

@Garux
Copy link
Owner

Garux commented Jun 21, 2022

Removing features to see what is causing the problem is a good plan. No way to find out with this set of data, too many unknown variables.
What looks suspicious is -style, because jk engine has styles support, while switch enables q3map2 styles hack, which is using tcgen lightmap, not supported by jk engine.

@TomArrow
Copy link
Author

Okay I tried new lightpasses, one without -fast, one without -style and one with just "-fast" and nothing else. Same result pretty much.

I didn't post the map earlier because it was huge and I figured nobody would want to sit through that kind of time (hours) to do the vis & light passes. It also needed models and shaders etc.

However I succeeded in cutting out that part of the map with the issue and now it's much more manageable so here you go:
cut out bespin.zip

Zip file contains both the .map, .prt, .srf, .bsp as well as the .bat compile script for convenience.

@TomArrow
Copy link
Author

I might have narrowed it down a little bit. I moved the whole map from my last post more towards the center and above the 0 point on the Y (height) axis and now the error at the old place is gone but it seems to have reappeared in somewhat less extreme fashion in some other areas.

Same kind of zip file as in last post, but with the modified map:
raise.zip

Surely this must be some kind of bug correct?

@TomArrow
Copy link
Author

Not sure if this could be in any way helpful but I tried compiling with GtkRadiant's q3map2 and the result has the same error, looks a little different however:
shot0715

Maybe that can give some kind of clue. Maybe not.

@Garux
Copy link
Owner

Garux commented Jun 22, 2022

i'd try something really simple like

-bsp -meta -v 
-vis -v 
 -light -fast -v

-nocollapse or -nolightmapsearch was noticed as causing strange bugs

@TomArrow
Copy link
Author

i'd try something really simple like

-bsp -meta -v 
-vis -v 
 -light -fast -v

-nocollapse or -nolightmapsearch was noticed as causing strange bugs

Just tried with exactly those settings. Exact same thing happens.

@Garux
Copy link
Owner

Garux commented Jun 22, 2022

You've got pretty robust bug there 😉

@TomArrow
Copy link
Author

Is this something you will look into fixing? I understand if you don't have the time, but just asking so I can decide whether it's worth waiting with finishing up my map project. It's certainly very irritating looking.

@Garux
Copy link
Owner

Garux commented Jun 26, 2022

I'm going to look into this, but later, atm 24/7 in different project.
It looks like wrong lm uvs are used for some reason, which isn't good. OTOH i've never seen this problem in Q3 mapping. Shall i install JK2 to debug it?
The dead simple example to reproduce this would help much.

@TomArrow
Copy link
Author

Sounds good. I don't know if its JK2 specific. I think the only thing it depends on jk2 for is the textures and maybe a few shaders. I don't have Q3 installed myself but I suppose you could attempt to compile it with Q3 (after replacing some shaders/textures?) and see if the error is reproduced.

The easy example for reproducing is linked in the above comment by me: #109 (comment)

Should include the .map file and all the other stuff. The post after it also contains the .map file and the other stuff for where I just tried to move everything in the map and it changed stuff somewhat.

I also just quickly tried to clean up the map a bit more to make it compile faster (vis is still slow though) and now the error looks different, but is still there. So: Moving around the map changes the look of the error and deleting other parts of the map can change the look of the error as well even though the affected part itself is not changed.

shot0994

Here's the zip with this newest version, but if you want to reproduce the same error I had in the same form I'd say go with the earlier version.
bespin_cutout_small.zip

Let me know if you need anything else, and thanks!

@Garux
Copy link
Owner

Garux commented Jul 9, 2022

Reproduced this in Q3 with just one texture:
shot1038
but there is no problem, if i omit -vis
Vis data is used for lighting acceleration; also vis is picky to geometry, leading to precision errors, that is why geometry coordinates make effect.
Basically bunch of tiny/angled structural brushes in this map is what makes the issue very probable.
If i blindly detail brushes like this, issue gets gone too
image
So compiler-side fix would be either about refactoring vis precision (which easily may lead to related issues) or trying to figure out why lm uvs are reused wrongly, as mjt says (but this is probably right behavior and there ought to be visibility issues, causing this).

@TomArrow
Copy link
Author

Hmm so what's the bottomline best way to solve this? Since you say avoiding -vis improves the problem, is there a way to do a lightpass that ignores vis data? Since vis data is still important ingame to have decent fps, but I'd be willing to sacrifice some compile performance for my final compile.

@Garux
Copy link
Owner

Garux commented Jul 26, 2022

Just use detail brushes properly.

@TomArrow
Copy link
Author

TomArrow commented Jul 26, 2022

Can you give me an example of the brushes causing this issue? Tiny and angled doesn't ring a bell.

Edit: Also, maybe I'm misunderstanding but you said "there ought to be visibility issues". Does that imply this is not a bug? But surely this behavior is not intended?

@ensiform
Copy link

Steps, trim, the extra floor balconies in open air outside for example.

@Garux
Copy link
Owner

Garux commented Jul 26, 2022

Vis portals structure must be as simple, as possible. This solves calculation time problem too. After all this tech was developed with corridor levels in mind.
I suspect there are actual calculation errors, leading to erroneously occluding things ingame, also exposed as lighting bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants