Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
al-azad
May 28, 2009



What does it look like in scene view because it seems like the ceiling is being culled although even then I don’t think direct lighting would ignore the fact that a ceiling is supposed to be there.

Adbot
ADBOT LOVES YOU

Triarii
Jun 14, 2003

KillHour posted:

What rendering pipeline are you using? You can make specific lights ignore certain objects entirely, but the way to do it depends on the renderer. HDRP has light layers, for instance.

I'm using the built-in pipeline currently, but I might switch to HDRP some day.

al-azad
May 28, 2009



Maybe this will help

https://docs.unity3d.com/Manual/shadow-distance.html

KillHour
Oct 28, 2007


Triarii posted:

I'm using the built-in pipeline currently, but I might switch to HDRP some day.

https://docs.unity3d.com/ScriptReference/Light-cullingMask.html

Triarii
Jun 14, 2003


The issue is that parts of the cave are beyond the shadow distance, so it's expected that they wouldn't appear shadowed. Cranking the distance up so that never happens isn't really practical from a performance standpoint - it's already turned up from the default and performance is noticeably suffering a bit.


That approach kind of helps - I can put objects onto a culled layer if they're far enough away from the cave entrance that I don't expect sunlight to ever fall on them. There's still a pretty unsightly boundary between the lit and unlit, though (like if you're deep in the cave, looking back towards the entrance) and it limits my options to do cool things like have holes in the ceiling with sunlight shining down into the cave.

al-azad
May 28, 2009



Triarii posted:

The issue is that parts of the cave are beyond the shadow distance, so it's expected that they wouldn't appear shadowed. Cranking the distance up so that never happens isn't really practical from a performance standpoint - it's already turned up from the default and performance is noticeably suffering a bit.

Since you're in a cave it's probably both more performant and more aesthetically pleasing/realistic to turn on fog when you pass a certain distance from a cave entrance. This way you preserve the illusion of a dimly lit area while allowing for natural lighting effects like holes in the ceiling, but things darken in the distance as they would in an enclosed area with no artificial lighting.

KillHour
Oct 28, 2007


IRL, caves don't darken in the distance. They also don't have much if any ambient light, so whatever.

Triarii posted:

That approach kind of helps - I can put objects onto a culled layer if they're far enough away from the cave entrance that I don't expect sunlight to ever fall on them. There's still a pretty unsightly boundary between the lit and unlit, though (like if you're deep in the cave, looking back towards the entrance) and it limits my options to do cool things like have holes in the ceiling with sunlight shining down into the cave.

You can update the layers in realtime based on distance or a trigger if you need to.

There shouldn't be a seam or boundary though.

KillHour fucked around with this message at 23:44 on May 26, 2020

al-azad
May 28, 2009



KillHour posted:

IRL, caves don't darken in the distance. They also don't have much if any ambient light, so whatever.


You can update the layers in realtime based on distance or a trigger if you need to.

There shouldn't be a seam or boundary though.

I should specify "video game hollywood lighting" here, if you anchor the light to the player no one will care just like nobody cares every night scene in a movie is lit like a full moon on a cloudless day. If anything it's expected.

Triarii
Jun 14, 2003

Yeah I'm fine with having an unrealistic amount of ambient light, since being able to see what you're doing is more valuable in this case than having a proper spooky cave-dark atmosphere. I'll probably throw around some glowy crystals/mushrooms/moss to vaguely justify it. I'm not too keen on the fog approach, though - to block out the improperly lit areas of caves, the fog would need to be thick, which isn't a look I'm really liking. (And I'd have to figure out how to not apply that fog to the non-cave areas or you could look out the entrance and see the whole world covered in cave-fog.)

With the light culling approach, I'm not sure how I would avoid having a boundary between the lit and non-lit objects, though. At some point there's going to be a lit object directly adjacent to an unlit object, and if you're standing far enough away that they're past the shadow distance then it'll be a hard cut between the two.

I wish I could so something like use shadowmask mode but generate the shadowmask textures procedurally, but it doesn't seem like Unity wants you to do that.

Edit: Actually, I might be able to get it looking decent if I pick a cutoff point between lit and unlit that's close to where the natural shadow would tend to fall, and then swap the layer to actually be lit once you get close enough for actual shadowing to take over.

Triarii fucked around with this message at 00:35 on May 27, 2020

Hammer Bro.
Jul 7, 2007

THUNDERDOME LOSER

TooMuchAbstraction posted:

Gotta have the boss warning siren!

Not sure where the volcano boss shows up in your game, but if you've already established the WARNING siren convention, consider sneaking an additional WARMING siren when the fight heats up.

Had to fish out a notebook in the middle of the night to write that down because that's what my brain does instead of sleeping.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Hammer Bro. posted:

Not sure where the volcano boss shows up in your game, but if you've already established the WARNING siren convention, consider sneaking an additional WARMING siren when the fight heats up.

Had to fish out a notebook in the middle of the night to write that down because that's what my brain does instead of sleeping.

:pusheen:

And high-five, bedside notebook bros!

KillHour
Oct 28, 2007


Triarii posted:

Yeah I'm fine with having an unrealistic amount of ambient light, since being able to see what you're doing is more valuable in this case than having a proper spooky cave-dark atmosphere. I'll probably throw around some glowy crystals/mushrooms/moss to vaguely justify it. I'm not too keen on the fog approach, though - to block out the improperly lit areas of caves, the fog would need to be thick, which isn't a look I'm really liking. (And I'd have to figure out how to not apply that fog to the non-cave areas or you could look out the entrance and see the whole world covered in cave-fog.)

With the light culling approach, I'm not sure how I would avoid having a boundary between the lit and non-lit objects, though. At some point there's going to be a lit object directly adjacent to an unlit object, and if you're standing far enough away that they're past the shadow distance then it'll be a hard cut between the two.

I wish I could so something like use shadowmask mode but generate the shadowmask textures procedurally, but it doesn't seem like Unity wants you to do that.

Edit: Actually, I might be able to get it looking decent if I pick a cutoff point between lit and unlit that's close to where the natural shadow would tend to fall, and then swap the layer to actually be lit once you get close enough for actual shadowing to take over.

Putting a layer mask on your directional light doesn't mean other lights won't affect inside the cave - only the sun/moon will be ignored. You can still have local lights and it will look fine.

Edit: I think what you're saying is if you're far from the entrance, the parts that are still able to be lit will have a hard line with the parts that aren't if the shadows are disabled due to distance. How big are your caves and/or how far is the shadow limit, because that really shouldn't be an issue with reasonable cave sizes. If it is, you can always force the cave generation to have a turn or other occluding geometry where you can't see out of the cave from that far away. Last option is to just have the cave entrance have a faked shadow by baking it into the texture and fade that between the faked and real version when you get far enough away.

KillHour fucked around with this message at 01:12 on May 27, 2020

Triarii
Jun 14, 2003

The caves are pretty big - the entrance is about 60x30 meters and the shadow distance is at 200. Having a turn would help with seeing the entrance from too far in, but the same problems crop up when looking in from the outside. Here's what it looks like with just the outermost piece of geo set to be lit - you can see the jagged line where it meets the unlit mesh that makes up the floor.



This would probably look fine from a good distance away, so I'm trying out swapping the layer to be lit once you get close, but I can tell there's going to be some unsightly popping in/out of shadows in some situations. I was really hoping to find something at the material/shader level that lets you reverse Unity's default behavior of "objects beyond the shadow distance have full direct lighting" to "objects beyond the shadow distance have zero direct lighting," because that would handle the swap smoothly and simply.

Triarii fucked around with this message at 02:19 on May 27, 2020

KillHour
Oct 28, 2007


There isn't. You'd have to write a custom shader.

The turn would solve both problems - make the transition past the point where sun could get into the cave, but before the turn. Nobody will notice the hard seam at the distance shadows fade out at. Alternatively, you can stick a semitransparent gradient texture over the seam to hide it - you just need something to blend the shadow.

Other options include adding foliage or other objects to hide the seam to the cave entrance, writing a custom shader that fades out lighting at a certain distance and having the cave roof overhang the entrance more. A small pile of rubble over the seam would probably be enough to hide it.

Edit: instead of making the shadow semitransparent, make the lit part semitransparent. Basically like this:



The middle piece is just a lit quad with a transparency gradient with the right hand side being fully opaque and the left hand side being fully transparent. It looks like you're already using triplanar textures in world space, so getting the texture seams to line up should be simple.

KillHour fucked around with this message at 03:19 on May 27, 2020

Triarii
Jun 14, 2003

Pushing the transition past the point where the sun can reach leads to it looking like this: the sunlight ends/the shadow starts, but then the shadow distance is reached and the floor becomes bright again before hitting the unlit geo and turning back dark.



(Also this is already using a custom shader; I've just never messed with shadows in a shader before so I'm digging around trying to see how I might control that.)

KillHour
Oct 28, 2007


Triarii posted:

Pushing the transition past the point where the sun can reach leads to it looking like this: the sunlight ends/the shadow starts, but then the shadow distance is reached and the floor becomes bright again before hitting the unlit geo and turning back dark.



(Also this is already using a custom shader; I've just never messed with shadows in a shader before so I'm digging around trying to see how I might control that.)

Is that zoomed in? I feel like you have to have a really narrow FOV for that to be such a big part of the screen. What does it look like normally?

Edit: The easiest way to edit the shader would be to have a check in the depthmap and lerp between the lit and unlit values at a certain depth. I know how to do it in ShaderGraph, but I haven't dealt with manually editing the standard shader in a long time.

KillHour fucked around with this message at 03:43 on May 27, 2020

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
How hard would it be to slap a matte black mesh across the entrance that disappears when you get close enough that the shadow logic works properly?

Shemp the Stooge
Feb 23, 2001
When you are in the cave put your character inside a very large black sphere with a radius just slightly smaller than your shadow distance.

Triarii
Jun 14, 2003

I dug around long enough and figured out how to get a shader to be "shadowed" whenever it's beyond the shadow distance, so now I have a nice smooth blend from the hard seam to the actual sun's shadows as the cave comes within the shadow distance, without needing to deal with light culling at all. I had to lower the shadow distance by half to even be able to see the transition this clearly.

https://i.imgur.com/C2t9iV4.mp4

KillHour posted:

Is that zoomed in? I feel like you have to have a really narrow FOV for that to be such a big part of the screen. What does it look like normally?

Yeah that was cropped to show the issue, since you have to be kind of high up and far back to see it clearly. It's hard to say what "normal" is in this game, though, since it's a procedural world with a player building element, so players are probably going to end up looking at terrain features from all sorts of angles.

Triarii
Jun 14, 2003

Hmm, bit of a snag with that approach: it involves changing the lighting model for specific materials, which as I understand means it's incompatible with deferred rendering, which is what I've been using. Among the things players can build are lights, and I wanted to take advantage of deferred rendering's better handling of multiple lights to give players as much leeway there as possible.

Any thoughts on forward vs deferred rendering? Is letting players build lights just a terrible idea that I should cut anyway?

Kazinsal
Dec 13, 2011



Forward rendering means that every light that needs to affect an object needs a render pass for that object, so if you have eight lights affecting an object, that object needs to be rendered eight times. If you have a thousand objects, then you need eight thousand render passes. In deferred rendering, all the rendering is done first by rendering diffuse, depth, and normal buffers, and then calculating the lighting afterwards based on those three sources of information about how the objects on screen relate to each other and their position in comparison to the lighting source. This obviously reduces the amount of redrawing needed dramatically -- in one of my test scenes with nine point lights and one directional, forward rendering results in about six million triangles being rendered, and deferred results in 850k.

The downsides of using deferred rendering: Can't run on anything older than DirectX 9 / OpenGL 2 (of course, is that really a downside? poo poo's almost two decades old now.), can't render transparent objects without shader trickery and extra render passes (I believe Unity basically renders any transparent object in a deferred rendering camera using an extra forward rendering pass just for that object), and can't do MSAA (but thankfully we have cool stuff like temporal anti-aliasing these days).

Chev
Jul 19, 2010
Switchblade Switcharoo
Do note that in forward rendering you can do several lights in a single pass! Four per call is a pretty common number, and you can do a lot with just the four more significant lights for each object. Heck, with cartoony graphics you can get away with one per object (Killer7, Guilty Gear, Wind Waker all use a single light per object, possibly BOTW too). Also it may seem like there should be performance problems by repeating the light computation X times but it's still faster than deferred in most cases due to the gbuffer texture reads. You can also upgrade forward rendering to the X most significant lights per pixel, if you can index your lights into some spatial structure on the GPU. For example Just Cause 2 used a world space grid around the player, stored as a texture where each pixel would be 4 references to the most significant lights of that grid square. A more recent but much more complex example is Doom 2016's clustered forward rendering, which divides the view frustum instead of the world space. Naturally those approaches necessitate a bit of a more hands-on approach, although I don't know what optimizations Unity already has built into its forward renderer.

Chev fucked around with this message at 17:55 on May 27, 2020

KillHour
Oct 28, 2007


It depends strongly on the rendering pipeline you use. I'd stop doing implementation until you decide on a pipeline. For a mostly procedural game, I'd recommend looking at URP, which is a forward based renderer.

Triarii
Jun 14, 2003

KillHour posted:

It depends strongly on the rendering pipeline you use. I'd stop doing implementation until you decide on a pipeline. For a mostly procedural game, I'd recommend looking at URP, which is a forward based renderer.

I imagine URP is the right choice overall (I doubt we're going to want to put in the art time to get the most out of HDRP's features) but looking at the list of things that URP doesn't support bums me out. Like, no auto exposure, ambient occlusion, or lens flares? I'm using all of those things :(

KillHour
Oct 28, 2007


Honestly, unless your game's entire aesthetic relies on a very specific post processing effect, they're probably one of the least important considerations.

KillHour fucked around with this message at 00:38 on May 28, 2020

Triarii
Jun 14, 2003

Most of that stuff is just eye candy, but the auto exposure is actually pretty functional. Since I can't hand-tune the lighting of each part of the world, it does a nice job keeping every area at a decent functional level of brightness, including the potentially dark indoor areas that the player can build, while still allowing for some nice contrast between lit and shadowed areas.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
I finally reached an important milestone with my embedded scripting interpreter project:
code:
import GlobalState, DayPhase
from UnityEngine import Debug

from game import prompt

dayNight = GlobalState.Instance.DayNightTracker

if dayNight.Phase == DayPhase.Day:
    prompt_text = "Take a nap until night time?"
elif dayNight.Phase == DayPhase.Night:
    prompt_text = "Go to bed until morning?"
else:
    raise Exception("BedScript didn't recognize this day/night phase and couldn't change it: " + dayNight.Phase);

# This is the dragon I slayed right here. This motherfucker:
selected_idx = prompt(prompt_text, ["No", "Yes"])

if selected_idx == 1:
    if dayNight.Phase == DayPhase.Day:
        dayNight.Phase = DayPhase.Night
    elif dayNight.Phase == DayPhase.Night:
        dayNight.Phase = DayPhase.Day
The prompt() call suspends the script until the dialog subsystem gets a response from the user to the prompt in the game. It then comes back with the unpacked numeric index of the selection so that the script can continue and finish with the valid result. It all runs in one thread using async-await. I have other scripts running simultaneously that are getting scheduled and rescheduled as necessary. Feels good, man.

Also included is module importing and being able to call .NET methods natively with data type conversion.

al-azad
May 28, 2009



I try my best to stay on the bleeding edge of new technology.



I was looking at Unreal Engine 5 and idk I don't think hardware is quite at where I need it to be.

asmasm
Nov 26, 2013
I have been prepping promo materials for this wrench update that is finally close to moving off of the beta branch. For one of the promos I manually laid out an entire car assembly of parts, the result is pretty cool looking.

It also occurs to me that I have been full time on wrench for about 3 years and the majority of those production hours are all on screen here:

16k wide wall paper for all the details (22mb warning):
http://wrenchgame.com/somanyparts16.jpg

asmasm fucked around with this message at 21:16 on May 28, 2020

Fur20
Nov 14, 2007

すご▞い!
君は働か░い
フ▙▓ズなんだね!

al-azad posted:

I try my best to stay on the bleeding edge of new technology.



I was looking at Unreal Engine 5 and idk I don't think hardware is quite at where I need it to be.

just lean into the 15fps and tell people it's "PS1 chic"

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

asmasm posted:

It also occurs to me that I have been full time on wrench for about 3 years and the majority of those production hours are all on screen here:

16k wide wall paper for all the details (22mb warning):
http://wrenchgame.com/somanyparts16.jpg

If you had to guess, how much of those three years would you say was spent on art assets (including stuff like materials/shaders and other presentation) vs. programming vs. business-y stuff?

Also, dang, three years, congrats!

asmasm
Nov 26, 2013
I completely stopped programming after my partner Jim joined which was right at the end of year one. Probably the first year was 50% art work, and 50% everything you mentioned. For the remaining 2 years I spent about 80-90% of my time on art and the rest on business stuff and community management. There is more art in the game when you include environments, UI, tools, props, and even more parts. That screenshot is probably 65% of my art production time?

asmasm fucked around with this message at 22:13 on May 28, 2020

Fur20
Nov 14, 2007

すご▞い!
君は働か░い
フ▙▓ズなんだね!
i dunno how i missed that but jesus that is a lot of high detail assets. i love the texturing on the tires

King of False Promises
Jul 31, 2000



asmasm posted:

I have been prepping promo materials for this wrench update that is finally close to moving off of the beta branch. For one of the promos I manually laid out an entire car assembly of parts, the result is pretty cool looking.

It also occurs to me that I have been full time on wrench for about 3 years and the majority of those production hours are all on screen here:

16k wide wall paper for all the details (22mb warning):
http://wrenchgame.com/somanyparts16.jpg

Just want to say I picked up a Rift a few weeks back and have been having a lot of fun with Wrench. Putting car parts together has been very soothing.

asmasm
Nov 26, 2013

King of False Promises posted:

Just want to say I picked up a Rift a few weeks back and have been having a lot of fun with Wrench. Putting car parts together has been very soothing.

Cool. If you aren't already, get onto the beta branch. It's much better than what is on the release branch.

al-azad
May 28, 2009



Thinking about buying half-life Alyx just to get access to the tasty new hammer editor. Should go on sale next month, yeah?

xzzy
Mar 5, 2009

al-azad posted:

Thinking about buying half-life Alyx just to get access to the tasty new hammer editor. Should go on sale next month, yeah?

It's always cracked me up that each Valve game comes with its own version of Hammer that gets its own series of bugfixes but quality of life changes from the main branch are never merged in.

In some ways I get it, they don't want to introduce incompatibilities but there have been a couple times where major new things have been added and old games never get it.

al-azad
May 28, 2009



xzzy posted:

It's always cracked me up that each Valve game comes with its own version of Hammer that gets its own series of bugfixes but quality of life changes from the main branch are never merged in.

In some ways I get it, they don't want to introduce incompatibilities but there have been a couple times where major new things have been added and old games never get it.

Yeah, I honestly spent an embarrassing amount of time researching Hammer because Alyx has been making waves in the level design field but its features are exclusive to that specific game and then I realized all the SDK's are more or less exclusive.

It's dumb but Source 2 or Hammer 2 or whatever the gently caress it's called looks like the be all end all in CSG map making.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
I spent today mashing submarines into the game.



They're just ships that sail at -30 meters, really slowly, and you need sonar to see them on instruments, instead of radar.

The way I see it, the purpose of submarines is to add additional targets that need to be attacked via specialized weaponry (depth charges, anti-sub mortars, ASROCs, etc.). So they stay submerged all the time. In fact I didn't even bother to make a model for them -- it's just a box. That does create a problem though, in that the player needs to be able to track roughly where subs are in order to be able to attack them. So far they have the following feedback options:
  • When a sub has locked weapons on them, the game plays a ping sound effect every 5 seconds (regardless of how far away the sub is).
  • Subs appear in the short-range radar (bottom left) if they're within the player's sonar range.
  • Again if the sub is within sonar range, and the player's active weapon group includes anti-sub weapons, then they're able to lock onto the sub (using normal lock-on rules, meaning they have to be looking roughly at the sub's location).

Notably, this does not include any visual indicator in the main game view that a sub is present, unless you get the lock-on indicator. And that won't happen unless you keep a sub weapon equipped as a matter of course. At some level this is realistic of course -- the entire point of subs is that you can't see them. I think I'm OK with there being threats that you need to keep a close eye on your instruments to detect. But my alarm bells are ringing that this is a bad idea. At minimum I feel like easy difficulty ought to have highly visible submarines. So what kind of visual indicator should I use here? It needs to be something that a) only shows up if the sub is in sonar range, b) is easy to distinguish from other indicators and terrain/ships and so on, and c) ideally isn't too hard to implement.

Some kind of HUD icon, like the weapon reticles, would meet those criteria, but it'd be hard to indicate depth with that, I think.

Adbot
ADBOT LOVES YOU

KillHour
Oct 28, 2007


Behold, the one true answer to height indicators.



I think you should have at least some way to force a sub to surface that's maybe harder than using a specialized weapon but doesn't result in "I spent the last 20 minutes on this level and realized I'm screwed because there's a submarine I literally cannot kill because I chose the wrong loadout." Because that's annoying game design.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply