The wonders of lighting Created 6 years ago2018-08-04 08:20:08 UTC by torekk torekk

Created 6 years ago2018-08-04 08:20:08 UTC by torekk torekk

Posted 6 years ago2018-08-04 08:20:08 UTC Post #340402
I'm currently trying out different lighting setups and been playing with light_surfaces and stumbled upon a problem.
User posted image
I'd like those bars to produce some decent shadows behind, but no matter what I do I can't get them to block light?
User posted image
Things I've tried so far:
  • turning the bars into a func_wall/func_detail
  • setting it's light mode to opaque/opaque+embedded fix
  • moving it to world(not even this did work, so I guess it isn't the brush it self)
  • copying the bars(so it's a brush over a brush) and applying a NULL texture, but that only results in no bars getting rendered at all
Then I tried playing with the brightness of the light_surface, with no success. It's set to 20000.
I've also tried the grid map size setting of the light_surface, but that didn't seem to change anything besides the compile time.

I'm compiling with RAD set to -extra, -bounce 8 and -blur 1.0.

I remember while randomly trying different things that I managed to get the bars to produce some blurry shadows, but I can't remember what it was.

There's also supposed to be a glass window between the bars, but I took it out to see if that's causing the lighting issue, but apparently it isn't.

It's stuff like this that puts me off of mapping, things that theoretically should work as expected, but don't and you don't know why and googling for a solution is helpless, atleast if I try terms like "light_surface opaque" "goldsrc shadow casting" "goldsrc block light", there's tons of results if I e.g. switch goldsrc to hammer, but then it's all about Source SDK, I know how I'd achieve the effect there. Either increasing the lightmap grid, or using the tooltexture blocklight.

Or am I just asking too much from GoldSrc, as in the engine isn't capable of producing said shadows? I saw this screenshot the other day: https://i.imgur.com/tw0JaUp.jpg

I think the effect is done by a { texture set to solid rendermode and then have it's lightmode set to opaque. Theoretically I could rebuild the bars in 2D this way, but I'd prefer the brush based 3D way.

Edit: I guess I could try placing hint/skip brushes behind the bars, atleast that's worth testing.

Edit2: Either I did it wrong, or it did not work: https://i.imgur.com/J2CikSH.png
torekk torekkProcrastinator of the Year
Posted 6 years ago2018-08-04 10:02:50 UTC Post #340405
As I said I already tried turning the bars into func_walls with the light flag set to opaque, it doesn't work. I'm using the default compilers that come with J.A.C.K., which I was told are VHLT.

I'm mainly just wondering what I did to get those blurry shadows(sadly I got no screenshot and wasn't able to reproduce it yet), because right now the bars seem to not block any kind of light. Not even when they're solid world geometry, which is really weird to me. Makes no sense, they should block light.

But I guess I could also use the texture thing, where you upscale the textures and then downscale in hammer. However I'd like to stay away from that kind of stuff until I'm almost done with the map, as it's kinda impractical to re-do it for every texture that I want it to apply.
torekk torekkProcrastinator of the Year
Posted 6 years ago2018-08-04 10:29:41 UTC Post #340406
Decrease the texture scale of the floor to 0.250. It will produce more wpolys, but the lightmaps will appear hi-res, because they're essentially being downscaled as well.
The bars are blocking light, but the lightmap is too low-res to actually display that shadow. :P
User posted image
This was done with a texture scale of 0.160.
However, keep in mind that I could've gone as low as 0.050, but the AllocBlock/lightmap limit would've been hit. A map can have a maximum of 64 lightmaps in GoldSrc. In SC, that limit was raised to 512, but nobody's sure how far that can go (in some cases beyond 512).
Admer456 Admer456If it ain't broken, don't fox it!
Posted 6 years ago2018-08-04 11:04:09 UTC Post #340408
Now I'm thinking J.A.C.K. either doesn't use VHLT, or I'm doing something totally wrong, because I tried reducing the texture scaling from the floor to 0.160 and what I get is this:
User posted image
I've tried making the bars func_wall with light flag set to opaque at compile try #1 and just leaving them as world geometry on compile try #2, both lead to that result.

Seems like GoldSrc doesn't likes me.

Edit: Tried decreasing the texture scaling for the wall as well, that just leads to those weird small stripes to appear on the wall as well. It seems now the bars block light, but not in the way they're supposed to.

Also, shouldn't the coffee mug get rounded by smooth 85? I guess I'll download VHLT/UMHLT and set that up in J.A.C.K. to see if that's the cause, I think it may be a problem there.

Edit 2: So I downloaded VHLT from here, set it up in J.A.C.K. using the "_x64" executables, but the result is the same.
torekk torekkProcrastinator of the Year
Posted 6 years ago2018-08-04 11:58:08 UTC Post #340412
I am listening and do know that I could just "fake" those shadows. But I don't like the effect and the area is supposed to be entered by the player, so it would look weird.

What I'm wondering however is why does the desk produce a nice shadow, but the bars which are even closer to the light source don't cast any shadows or if they do it looks totally weird. I even tried putting 3 light entities directly in front of the bars, but the result looks just the same as with my last screenshot.

However in a test map with several different sized bars and just a single light entity, all of the bars produce shadows, even with default texture scaling and the same compiling options? Is there a leak or something in my map that I missed? Compile log.
User posted image
The difference here is that I use a "light" entity, while in the other map I use a light_surface. But as I said, I tried already placing 3 light entities in front of the bars, with the RGB value kinda matching the texture of the lamps(made a screenshot and checked the values for the brightest color by eye) and brightness set to 200, but it seems they don't work.
User posted image
User posted image
Kinda funny that the shelves and desk are casting shadows, but the bars, even being illuminated directly, don't.

As the title says, the wonders of lighting. I'm basically loosing my head over this, just makes no sense to me.
torekk torekkProcrastinator of the Year
Posted 6 years ago2018-08-04 14:28:28 UTC Post #340414
My guess is that the bars are too thin and too far away from the wall to cast any visible shadow.
Posted 6 years ago2018-08-04 16:35:39 UTC Post #340416
If it helps, here's how it looks in J.A.C.K.:
User posted image
And even with the -dscale 0.125 parameter set to RAD I just get this result:
User posted image
The bars were world geometry the whole time.

Guess I'll either scrap the idea or put it on hold for now, as I don't understand it.

Edit: Tried setting up Sven Coop's SDK to see if that would help, but it seems I'm even too dumb for that. I just get "access denied" error the whole time when I compile, propably because I'm using more than one windows user account. Even tried running Hammer with admin rights which doesn't work.

And that ladies and gentleman, is the number one reason why I hate computers in general. I just want to use them for work, not sitting there fixing stuff that shouldn't need fixing at all, but I guess one can only dream.
torekk torekkProcrastinator of the Year
Posted 6 years ago2018-08-04 17:12:23 UTC Post #340417
I think the problem you are having is due to the fact that the light is coming from more than one "point". Try using only a single point light entity without the light surface (or turn down the light surface so it appears lit up but doesn't cast much light) and see if that changes your effect. I think what is happening is the shadows are being cast but then they are being lit up by light coming in from other angles. In your other example (empty room with random bars coming from the ceiling) I assume there is only one point light so there are no other lights at other angles to drown out the shadows.
Posted 6 years ago2018-08-04 17:33:09 UTC Post #340419
All hope is lost.

I removed the light_surfaces from the area and so there was just the 3 light entities in front of the bars:
User posted image
But sadly, not even that works?
User posted image
I give up on this lighting magic, guess it's just not worth it for a small effect that propably not even most players will notice.

Edit: Turns out the brightness was too low with 200, with 500 I get the bars to cast shadows, but the result isn't that pleasant so I guess I'll just scrap this effect or use SourceSkyBoxer's method with the BLACK func_illusionarys.
torekk torekkProcrastinator of the Year
Posted 6 years ago2018-08-04 18:52:21 UTC Post #340420
Try using a single point light entity like I mentioned instead of 3.
Posted 6 years ago2018-08-04 21:00:15 UTC Post #340422
Have you tried using a light_spot instead of a regular light entity or light_surface? They can be a bit tricky to look right in GoldSource, but it would probably work better in the situation you're describing.
Dr. Orange Dr. OrangeSource good.
Posted 6 years ago2018-08-04 22:19:14 UTC Post #340423
I tried using a light_spot and a single light entity, this gave me the best result, but it's still far from nice looking and so I came to the conclusion that I'll just leave this be, as it requires more tweaking/fixing than it's worth it.

And yes, I could use translucent brushes for fake shadows, but I don't like that effect because as I explained earlier the player can enter the area and so would be able to notice it quite easily.

I mainly just wondered why the desk and shelves do produce shadows, even without tweaking anything, while the bars don't, but apparently that's just how lighting works and after all it's a game, no need for that realistic lighting, even though it'd been a nice effect.

Edit: This is with a single light entity:
User posted image
And with a light_spot:
User posted image
As you can see, the spacing is huge, but when I move the light closer to the bars they get too bright.
torekk torekkProcrastinator of the Year
Posted 6 years ago2018-08-04 23:53:38 UTC Post #340424
May you upload the .jmf? I would like to check if everything is correct so that you can solve your problem fast and easy.
Alberto309 Alberto309weapon_spaghetti
Posted 6 years ago2018-08-05 01:02:38 UTC Post #340425
This is the version with the single light entity: https://drive.google.com/open?id=1eLcZRNXePdA3aUDMTg_hVJYW6UEsZaCT

The bars look different than in the screenshots before because I thought it could be the texture that's causing the problems.
torekk torekkProcrastinator of the Year
Posted 6 years ago2018-08-05 01:31:49 UTC Post #340426
Here's with my compiling settings:
User posted image
Moving the light entity below the lamp (where it should be I presume?):
User posted image
From outside:
User posted image
I just did a couple things to make it easier:
  • I made the window as a single brush (having one for each hole is just a waste and it changes nothing visually) and changed its Render FX to 100 as it looked too dark in my opinion but feel free to revert it back to your liking of course;
  • I tied to a func_detail all the surrounding structure (metal bars and the metal borders);
  • I changed the floor's texture scaling to 0.250 as 0.160 was definitely too much.
Here's the "corrected" .jmf.

My compiling parameters:

CSG: -high -nowadtextures -cliptype simple -estimate -threads 4 -texdata 16000
BSP: -high -estimate -threads 4 -texdata 16000 -noinsidefill
VIS: -high -full -estimate -threads 4 -texdata 16000
RAD/Light: -high -extra -estimate -bounce 12 -threads 3 -smooth 200 -smooth2 200 -texdata 16000 -blur 0.5 -gamma 0.5

"-bounce 12" might be a bit too much for that map in particular. It was for another map of mine; so change it to whatever you like (I'd suggest "-bounce 3").
Alberto309 Alberto309weapon_spaghetti
Posted 6 years ago2018-08-05 01:46:29 UTC Post #340427
First, thanks for the effort, much appreciate it.

I made the window several brushes some time inbetween testing, it was a single brush to begin with.

Same for the func_detail thing, I do know that you should turn these things into func_details, it was just for testing purposes that I moved them to world geometry.

I've been "mapping" since 2008, with Source SDK, GTKRadiant and Doom Builder so I kinda know the "techniques" that are used.

And yeah, the light_spot makes more sense beneath the hanging light, however I planned on using texlights for the lights and then basically just use the light entity to get that "extra" lighting. Atleast that's how it's done in Source SDK at times, if you take a look at the HL2 map files. I'm still amazed if I check a map in Hammer to see that they've been using like 2 or 3 light_spots in certain scenes, all colored differently with different angles.

However as it seems I have to stick to light/light_spot entities for the effect to work, because when I add a light_surface for e.g. the lamp above the door, the effect gets ruined again. Not worth it in my opinion, but I guess there's a reason why people plan out maps on paper instead of "building on the go", as that usually leads to such problems. Knowing engine limitations could also help, but oh welp, so much to read and I'm still not sure if I ever going to release a map, no reason in learning stuff if you don't put it to use, right?
torekk torekkProcrastinator of the Year
Posted 6 years ago2018-08-05 01:51:33 UTC Post #340428
-dscale does not scale the lightmap resolution, SourceSkyBoxer, it scales the direct lighting brightness, using -dscale 0.1 will just make your map super dark.

The problem here is a combination of a low lightmap scale (unavoidable) and texlights, which emit several point lights each.

A way of fixing it would to be to use a single spotlight, or point light, apart from that, there's not much you can do.

edit: whoops, bit late.
Posted 6 years ago2018-08-05 03:53:08 UTC Post #340430
I'm thinking, maybe you only used "Opaque" for the func_wall. You could've used "Opaque + Concave Fix", but func_detail is a better option anyway.

As for surface lights, of course they're going to not work with this kind of setup because it's going to be too blurry. I usually avoid texlights when I want cool shadows. :P (they also seem pretty dim compared to regular point light entities)

Either way, on an unrelated note, put a CLIP brush for the entire window so that you don't waste any clipnodes. :P
any mappers have made "faked shadow mapping". Like Trempler, Admer,
I actually never did in GoldSrc. Only GZDoom. :D
Admer456 Admer456If it ain't broken, don't fox it!
Posted 6 years ago2018-08-30 18:34:34 UTC Post #340745
So I found this the other day: https://twhl.info/wiki/page/Tutorial:_Realistic_Shadows

Basically BEVEL from zhlt.wad is what I was looking for?

Going to try it out, maybe it helps someone else as well.

Edit: Well BEVEL does work like a blocklight texture, but that alone isn't enough for realistic shadows, still need to scale up the textures first.
torekk torekkProcrastinator of the Year
You must be logged in to post a response.