Author Topic: Graphics clarification: Unity and DirectX  (Read 9732 times)

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Graphics clarification: Unity and DirectX
« Reply #15 on: February 13, 2017, 07:05:14 pm »
It will be informative at the very least. :)
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Cyborg

  • Master Member Mark III
  • *****
  • Posts: 1,957
Re: Graphics clarification: Unity and DirectX
« Reply #16 on: February 13, 2017, 09:12:17 pm »
So does Vulkan lock people out or something? From what I'm reading of what you said, it sounds like there will just have to come a point where some expansion will create a fork, if the demographics show it's reasonable.

It reminds me of that tumultuous time between 32 bit and 64-bit gaming, before everything really switched over. At some point, you just have to make the move.

The business question is, will you attract more players with a better quality product than having technology friendly to older machines?

But that is far down the road, I suppose. Who knows, maybe your modding community will help push that issue for you with what comes out.
Kahuna strategy guide:
http://www.arcengames.com/forums/index.php/topic,13369.0.html

Suggestions, bugs? Don't be lazy, give back:
http://www.arcengames.com/mantisbt/

Planetcracker. Believe it.

The stigma of hunger. http://wayw.re/Vi12BK

Offline Aklyon

  • Core Member
  • *****
  • Posts: 2,089
Re: Graphics clarification: Unity and DirectX
« Reply #17 on: February 13, 2017, 09:28:20 pm »
It sounds like at somepoint, things that support dx9 but not vulkan/metal/dx11 are going to be rather old, hardware-wise.

Offline eRe4s3r

  • Core Member Mark II
  • *****
  • Posts: 2,825
Re: Graphics clarification: Unity and DirectX
« Reply #18 on: February 13, 2017, 11:38:24 pm »
I'm not sure what you mean by sprite system -- do you mean particle system?  We're using the full shuriken system, so you can do whatever you like in there.

Actually, technically even that is incorrect: we're spawning an object (with whatever sub-objects) at certain times, and then it does whatever you want and disappears after a while.  So if you had another particle system you wanted to use in there (popcorn fx, whatever), theoretically you could do that.  It's pretty darn flexible.

As far as shuriken itself goes, it has all of those various parameters and more.  A lot of those things can be adjusted by curves, etc.  It's just the built-in unity particle system, and it's extremely powerful.  I take no credit for it.  Yes you can add in lights and similar, although I don't recommend it.  Distortion effects are very possible through the particle system (I think you're confusing my use of the water shader in unity for vertex animation with a generalized screen-space distortion effect in particles, which are two very different things).  The distortion effects in unity tend to look awesome, but bear in mind that if you've got a ton of ships exploding at once, you're going to absolutely overload the GPU very fast, even on a high-end rig.  I don't think it will wind up being worth it in most cases.

Oh I really meant sprite systems ;) You have particle effects with attached shaders for effects (Shuriken), and then you have sprite based effects which are placed in a scene without emitter (debris in a debris field, tiny rocks, smoke and dust, other things you might wanna have floating in space and not spawned mid-game, but rather be part of the scene, ice-particles in rings, etc) which together form a neat (and well instanced!) scenery around a scenery object which is a mesh and which might have other particle based details. Since you don't wanna have models rotating in your scene that are only 1px or 2px large in "close" zoom, you use a sprite-sheet with pre-rendered rotations to "fake" it, this works for tiny objects, and can even be "lit" correctly thanks to the magics of normal maps ;p The reason you use this is very simple, you can instance them since they have very low-res, by the millions. It is how many games do debris fields, asteroid field "dust" and stuff like that (they use meshes too). So I guess you are not doing any of those "fancy" in-scene things, like nebula fields, ice rings (with ship and effect reflections) within the play-field? Could we mod that if we wanted? I wouldn't even know how to do that without sprites to be honest. ^^ I guess you can do the same thing with very advanced shaders... but that is also beyond me ;p

Dedicated Vulkan support is my preferred path, yes.  There is no instancing at all in DX9; that didn't come until IIRC DX10.  But unity doesn't directly support DX10, it just goes DX9, DX11, and then kinda-sorta DX12 (it's experimental).  Vulkan is in beta 5.6, and once that's out of beta (probably 1-2 months from now), that will be our preferred path.  Only exception is folks on OSX, which would have to use OpenGL 4.1 or Metal.  For folks on older GPUs that don't support Vulkan, the DX9 support (and by extension really talking about SM3 and so forth on the OpenGL side, too) would be the solution.  I don't want to leave folks absolutely behind on those card generations.

The current supported card generations: https://en.wikipedia.org/wiki/Vulkan_(API)#Compatibility

Fermi got left behind, despite originally being intended to have support.  Having a minimum of a Kepler-based card is not a dealbreaker by any stretch, since that's basically 5 years old now.

Intel chipset support on linux goes all the way back to ivy bridge (so that's equivalent timeframe), but on windows you have to go all the way up to a beta driver set for skylake (ow -- that's 2015).

Radeon has the same general timeframe (2012) on windows, but anything older than R9 is experimental on linux, which is a bummer to say the least.  That still gets those folks back to 2014 on linux, but that's not absolutely the best, really.

In terms of looking to the future: vulkan is absolutely it, in my opinion.  As the game evolves over the years hopefully, vulkan's baseline card support is going to be further and further in the rearview mirror.  But the legacy DX9 and OpenGL 4.1 support may always be a bit of a thorn in our side for basic support, simply because we don't want someone to be able to play the game one day, and then next release suddenly their computer isn't good enough.  It would be a lot cleaner on our end to just dump support for the legacy pipelines when 2019 or something rolls around, but I don't think that would go over well.

We may wind up HAVING to do that at some point as we upgrade to newer unity versions that change the system requirements around.  In that case we'd have a legacy build of the game for those affected who don't want to upgrade to within-5-or-6-years-old hardware.  Hopefully those wind up being a vanishingly small group of affected people, and hopefully unity doesn't put us in that position anytime soon.  But if history is anything to go by, that would eventually happen; the game either will be stuck on an older unity version and thus limit the majority of players from the latest in performance and goodies, or else we upgrade and the minimum system requirements inch upwards a bit, making some folks mad.

We'll just have to see how that is at the time, really, and what the overall desires of the fanbase are.  If things are running great enough, then maybe we just stick with whatever version of unity doesn't cause a min system specs shift.

Vulkan would be fine by me (have a Kepler gpu ,p) but mainly because DX9 isn't gonna allow many interesting things, as you said, DX9 has no real instancing, you have to code your own hacks for that, Vulkan is absolutely amazing in this regard, and can allow you to do things you didn't think possible within your performance constraints. So my main reason to ask this was because I was hoping for more "effect depth" even if that's just something modders can push forward, because I think a space-game first and foremost gotta look amazing, if I like just watching combat unfold, then I will probably also like playing it a lot. ^^

I'm not 100% sure I understood all of that, but it was interesting to read anyway, Chris.

One of the reasons Homeworld 2 remastered looks as amazing as it does is that the nebula BG directly lights the scene (GI = Global Illumination) although it is fake, it is very well made fake ^^
Proud member of the Initiative for Bigger Weapons EV. - Bringer of Additive Blended Doom - Vote for Lore, get free cookie

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Graphics clarification: Unity and DirectX
« Reply #19 on: February 14, 2017, 09:30:17 am »
So does Vulkan lock people out or something? From what I'm reading of what you said, it sounds like there will just have to come a point where some expansion will create a fork, if the demographics show it's reasonable.

It reminds me of that tumultuous time between 32 bit and 64-bit gaming, before everything really switched over. At some point, you just have to make the move.

The business question is, will you attract more players with a better quality product than having technology friendly to older machines?

But that is far down the road, I suppose. Who knows, maybe your modding community will help push that issue for you with what comes out.

Vulkan doesn't block anyone per-se, but older hardware doesn't support the basics of it.  Below OpenGL or DirectX, there's a thing called the "shader model" that graphics cards support.  When graphics hardware says it supports "directx 11," it really means that it supports a certain underlying shader model (well, and presumably that it has directx 11 drivers, but that's software).

OpenGL and DirectX are both a layer up from the drivers, and the drivers are simply a method for interacting with the underlying shader pipelines in specific ways.  Vulkan is basically "new OpenGL" (which they thought about calling something along those lines, but didn't because reasons), and it's a lot like DirectX11 in terms of the raw feature support (tessellation, etc)... except it's unlike anything else on the scene right now.  I can't really say "the market," because it's not something that's sold.  It's like HTML5, in that it is kind of a standard that a lot of industry titans got together and designed to solve their problems.

One of the problems that is largest has typically been that there's a lot of load on the CPU as it spends time preparing to push stuff into the GPU pipeline, and there's also a lot of missed chances where the GPU is actually doing very little because it's waiting for the next instructions that have not come yet because the CPU was waiting to hear back the GPU was done before it puts the next thing on the bus... etc etc etc.

So Vulkan comes in and basically says "we're going to multithread the heck out of this," and also "we're going to keep that pipeline full, so your GPU isn't ever just sitting around waiting for instructions."  Those are huge improvements, because not only does it free up the CPU some, it's actually a haha-bad-science-you-only-use-10%-of-your-brain type of unlocking of the GPU's potential.  Depending on the moment, we only are using 40% of our GPUs (I guess?) with DX and OpenGL at the moment.  It sounds ludicrous, but that's the nature of a bottleneck or a race condition; if nobody ever tapped their brakes and drove with machine-like efficiency, we could get twice as many cars through every city with no traffic jams.  Or something like that.  That's probably an exaggeration.

But anyway, Vulkan is aimed at breaking down the traffic jams in much the same way.  So it makes older hardware "seem better," and in general able to do more when it comes to a variety of things.  If you were already struggling with something like pixel fill rate, then you weren't bottlenecked in the first place: that's an example of the highway simply being too small for the number of cars, and no matter how efficiently the cars drive you still can't get any more in there.

So it's not some sort of magic bullet that solves every problem.  But it does solve a lot of the problems that are most problem, and overall your GPUs will run a lot more thoroughly (and possibly hotter?  hmm) doing whatever it is they can do.

THAT said, it's also a cross-platform way of handling a lot of the DX11 style features, some of which were spotty in OpenGL before.  Things like tessellation were hard to do consistently between the two platforms, and unity doesn't even support tessellation in openGL.

More relevantly for Arcen, it also makes available GPU instancing, which is the ability to send one mesh+material and say "draw this n times at this list of n coordinates."  As you can imagine, this is a lot more efficient on the bus between the CPU and the GPU, and it also allows the internal GPU drivers to reuse some work to my understanding.  That last bit is more of a black box, but anyhow.  It basically lets you do something like draw 40k asteroids in the time it might have taken to draw... I dunno, maybe 100 before.  It really depends on your hardware, again, and what the limiting factor is.  There's no one way to quantify it, which is why you don't see generalized quantifications out there on the internet.  If fill rate is your issue and your GPU only has so many cores and so on, then maybe those 40K asteroids don't actually render so insanely much faster.  Faster, sure, but not as much more as it could have been.  If your card is more modern, though, then the pipeline was almost certainly your limiting factor, and as time goes on that was only going to become more and more of an issue.

SO.

Does Vulkan lock people out?  Not really.  But what do we DO with all that power?

1. We use it, and rely on its performance gains in order to make the game acceptably playable framerate-wise as well as looking great.
-- Result: people not using Vulkan get terrible performance by comparison, possibly making it feel unplayable without a huge amount of stuff turned off.  Also it's more work for us to figure out how much stuff to turn off to let them play in this stripped-down fashion.

2. We use it, but just to give people insane bonuses to speed over the "baseline" speed that is more rooted in DX9.  So anyone who can use it has performance that just fliiiiies, but people who can't use it still get an acceptably platable framerate.
-- Overall this is my intended approach with this particular game, at this time.

However, either an upgrade in a future version of unity, or some change that we decide upon ourselves, might suddenly make #1 a lot more attractive or even "required in order to move forward in a modern way."  We're talking years from now, most likely.  So the question then becomes what happens to people with 2012 or 2013 cards in 2019.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Graphics clarification: Unity and DirectX
« Reply #20 on: February 14, 2017, 09:48:17 am »
Oh I really meant sprite systems ;) You have particle effects with attached shaders for effects (Shuriken), and then you have sprite based effects which are placed in a scene without emitter (debris in a debris field, tiny rocks, smoke and dust, other things you might wanna have floating in space and not spawned mid-game, but rather be part of the scene, ice-particles in rings, etc) which together form a neat (and well instanced!) scenery around a scenery object which is a mesh and which might have other particle based details. Since you don't wanna have models rotating in your scene that are only 1px or 2px large in "close" zoom, you use a sprite-sheet with pre-rendered rotations to "fake" it, this works for tiny objects, and can even be "lit" correctly thanks to the magics of normal maps ;p The reason you use this is very simple, you can instance them since they have very low-res, by the millions. It is how many games do debris fields, asteroid field "dust" and stuff like that (they use meshes too). So I guess you are not doing any of those "fancy" in-scene things, like nebula fields, ice rings (with ship and effect reflections) within the play-field? Could we mod that if we wanted? I wouldn't even know how to do that without sprites to be honest. ^^ I guess you can do the same thing with very advanced shaders... but that is also beyond me ;p

Oh, you're talking about an Imposters system.  We're not doing that, no.  Once you get to the point of just a few pixels, sending vertex information that is in the opaque pipeline is waaaay more efficient than sprites that are going to have some alpha on them.  The visual result is pretty much identical, too.

There are imposters systems around for unity, in a third party sense, but they aren't something that work very efficiently for moving objects.  The need to rotate their transforms to face the camera constantly is expensive on the CPU, when there are a ton of them.  That's one of several reasons that the vertex approach I mentioned above is more efficient.  The other reasons include no need to send texture data to render, and being able to write more concretely to the depth buffer in one pass rather than having all the usual transparency things going on (even if you're doing something like additive or multiplicative blending).  We also have too many ships in general for that to be a feasible approach in terms of manpower, in my opinion, and I don't think it would yield much of an impressive result.

One thing to remember about Homeworld compared to AI War 2 is that Homeworld has to do like 1/1000th the work, quite literally.  There just isn't the same volume of ships, not even close.  So they can put extra time into specific ships and making things a bit fancier in ways we simply can't on modern hardware.  That might change in a few years, same as things have changed so that now we're able to do this in 3D at all whereas in 2009 this was frankly flat-out impossible to do a game like this except in 2D.  Even in 2014 arguably it was impossible given the state of drivers and engines at the time.

Vulkan would be fine by me (have a Kepler gpu ,p) but mainly because DX9 isn't gonna allow many interesting things, as you said, DX9 has no real instancing, you have to code your own hacks for that, Vulkan is absolutely amazing in this regard, and can allow you to do things you didn't think possible within your performance constraints. So my main reason to ask this was because I was hoping for more "effect depth" even if that's just something modders can push forward, because I think a space-game first and foremost gotta look amazing, if I like just watching combat unfold, then I will probably also like playing it a lot. ^^

Really instancing is the only thing missing in DX9 that I care about, compared to the general performance improvements.  All the other niceties for a game like this can be done with a lot of tricks, as you noted.  Unity itself has a thing called dynamic batching, which is not as performant as instancing, but which does give us something along those lines in DX9.  It's CPU-bound and eats up some time on a secondary thread, but between that and LODs I've gotten around most of the constraints that otherwise would just be handled with instancing and mipmaps alone.  It made things a lot more complicated for me, but the work is already done, thankfully.  It creates a roughly 300 vertex limit per mesh, though, which is why the LOD system is so incredibly important.

In terms of the visual effects... I guess we'll just see.  There are distinct limits to what I can realistically do, and we don't have anyone dedicated to making that truly AAA.  It's not something that's feasible in our budget regarding staff, and I don't think most of our target audience's computers can run it right now.  But that said, over time I imagine that can grow substantially -- and if modders like yourself add to things, then we can always integrate those into the main game with your permission, if you like.

I'm trying to strike the best possible balance between wow and performance, so it's not a gorgeous slideshow for the bulk of players or something. ;)

One of the reasons Homeworld 2 remastered looks as amazing as it does is that the nebula BG directly lights the scene (GI = Global Illumination) although it is fake, it is very well made fake ^^

Did they really!  That's kind of fascinating.  That's mainly just skybox GI, rather than GI that is contributed-to by other lights and AO of nearby colors, and things like light bounces, etc.  "Just" skybox GI can of course look really amazing.  I will have to think about this.  If we're talking reflections, unity has the ability to handle cubemaps or skybox reflections really directly in a great way.

But skybox-based GI that is that heavily blended... I will have to think about that, and do some research.  I'm probably overlooking something simple and it's easy to do, but it's not something I've thought about before.  I bet that would look really fantastic.

I'm a little worried I'd have to shift to PBR instead of blinn-phong in my shaders, and I'm not sure what the compound performance impact would be on people's GPUs.  But I can easily make shader variants that it switches between based on shader keywords or some other factor.  Just swapping out materials based on settings is even feasible given the way our ships are defined.

Thanks for mentioning that -- that's a really good thought and could really make things look extra awesome!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Cyborg

  • Master Member Mark III
  • *****
  • Posts: 1,957
Re: Graphics clarification: Unity and DirectX
« Reply #21 on: February 14, 2017, 08:59:10 pm »
I would make the same point as eRe4s3r. I think that whatever you can do to sell these giant space battles and the AI war itself would serve you well. Either way, I think it's still going to look great.

What should we start downloading and learning to get going with modding this game? I would like to get the materials downloaded and start looking around.
Kahuna strategy guide:
http://www.arcengames.com/forums/index.php/topic,13369.0.html

Suggestions, bugs? Don't be lazy, give back:
http://www.arcengames.com/mantisbt/

Planetcracker. Believe it.

The stigma of hunger. http://wayw.re/Vi12BK

Offline eRe4s3r

  • Core Member Mark II
  • *****
  • Posts: 2,825
Re: Graphics clarification: Unity and DirectX
« Reply #22 on: February 15, 2017, 07:39:02 am »
One of the reasons Homeworld 2 remastered looks as amazing as it does is that the nebula BG directly lights the scene (GI = Global Illumination) although it is fake, it is very well made fake ^^

Did they really!  That's kind of fascinating.  That's mainly just skybox GI, rather than GI that is contributed-to by other lights and AO of nearby colors, and things like light bounces, etc.  "Just" skybox GI can of course look really amazing.  I will have to think about this.  If we're talking reflections, unity has the ability to handle cubemaps or skybox reflections really directly in a great way.

But skybox-based GI that is that heavily blended... I will have to think about that, and do some research.  I'm probably overlooking something simple and it's easy to do, but it's not something I've thought about before.  I bet that would look really fantastic.

I'm a little worried I'd have to shift to PBR instead of blinn-phong in my shaders, and I'm not sure what the compound performance impact would be on people's GPUs.  But I can easily make shader variants that it switches between based on shader keywords or some other factor.  Just swapping out materials based on settings is even feasible given the way our ships are defined.

Thanks for mentioning that -- that's a really good thought and could really make things look extra awesome!

As much as I would be hyped to see HW2 graphics here, I just wanna make sure you don't waste precious time on things that might or might not work, or improve image wow-factor by 9000 ^^. Fact is I really don't know how they do that in HW2, it being super-custom OpenGL makes understanding anything that goes on nearly impossible for me, and map creation was always extremely iffy, we never got official tools to look how they really did it.... but what they did definitely did was hand-craft and tweak each map and bg to fit. So maybe it's just a really well made illusion. It is a very pretty illusion though ;p Not every visual effect is gonna be a good fit ^^

So basically, either it's fake GI or it's me falling for a pretty illusion involving ambient light sources ;P But it's not gonna be possible to ever beat HW2 artistically, the amount of work they put into textures and detailing, and also light attached to meshes is truly staggering, and to this day it is something I have never achieved. Just be sure you have "bombastic" effects somewhere, because those are the things that make good screenshots... but don't put them above gameplay ;)
Proud member of the Initiative for Bigger Weapons EV. - Bringer of Additive Blended Doom - Vote for Lore, get free cookie

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Graphics clarification: Unity and DirectX
« Reply #23 on: February 16, 2017, 03:50:18 pm »
Cheers guys. :)

In terms of the GI in Homeworld 2, I actually spent a little while today making it so that I'm faking something along those lines (without dulling shadows at all) in AI War 2.  It definitely has a big effect on mood from planet to planet, which I'm very excited about.  The exact method I used I almost don't want to say, because it's stupid-simple and literally zero cost on the GPU or CPU.  Works surprisingly well with particularly my custom shaders, though, since you get a lot of nice lighting interactions with colors morphing in cool ways.

I'm definitely not out to try to beat Homeworld 2 at its own game, particularly when it comes to the fidelity of individual ships.  They have far fewer ships than we do, among many other advantages (budget, etc).  They definitely provide a great high-water-mark, though.

Regarding modding tools, it depends on what you have in mind as to what you'd need.  The modding for visuals and sound I'll be putting together a package on some public service for.  Google Code or GitHub, probably.  You'll then need to download that package, have the right version of unity (which is almost definitely going to change between now and the start of even alpha, knock on wood -- unless 5.6 is slower to come out than I expected).  And Visual Studio 2015 doesn't hurt, although it's not required.

If you're wanting to edit things like the ships themselves, that's just all xml, and you don't need anything but a text editor and a copy of the game.  I really like Notepad++.  If you want to make a new ship but just reuse existing graphics, you can still do that just purely in xml.  If you want to do something like make new map types, you'd need Visual Studio 2015 (or just code by hand in a text editor, up to you), and the code package I noted above, but you would not need any copy of unity at all.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline Tridus

  • Master Member
  • *****
  • Posts: 1,305
  • I'm going to do what I do best: lecture her!
Re: Graphics clarification: Unity and DirectX
« Reply #24 on: February 16, 2017, 05:37:59 pm »
And by Visual Studio 15, he means Visual Studio 17. ;) For modding purposes, you should be able to use the free Community Edition if you happen to need to go that way.

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Graphics clarification: Unity and DirectX
« Reply #25 on: February 16, 2017, 05:53:45 pm »
I use 2015, community edition.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Graphics clarification: Unity and DirectX
« Reply #26 on: February 17, 2017, 09:39:08 am »
I went ahead and split this discussion so that the modding bits are easier to find as a separate conversation.  Here's that link: https://forums.arcengames.com/ai-war-ii/modding-format-questions-and-process-questions/

Thanks!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!