H-uru / korman

Blender plugin for creating ages for Cyan Worlds' proprietary Plasma engine and its open source variant, CyanWorlds.com Engine.
GNU General Public License v3.0
34 stars 17 forks source link

Add Quality modifier to provide load masks #358

Open dpogue opened 1 year ago

dpogue commented 1 year ago

This allows Age builder control over what quality levels objects are rendered at. This does not (yet) automatically hook up load masks for things like wavesets or grass shader mods, but provides a general quality modifier.

Screenshot from 2023-01-28 00-09-35

Related to #356.

Hoikas commented 1 year ago

Thanks for getting started on this. The load mask stuff is used in many, many places, so it would be very nice to see the two parts of the load mask (quality and capability) split out into different parts for us to use both in terms of the UI/properties and the exporting thereof. Also, I feel like one of those boxes should have checkmarks for the hardware's shader model level instead of quality markings.

EDIT: I see that you did split that out. Maybe just move it to somewhere more easily accessible than the modifiers module? :)

dpogue commented 1 year ago

Also, I feel like one of those boxes should have checkmarks for the hardware's shader model level instead of quality markings.

So, it turns out plLoadMask doesn't actually support this. It's only "if any shaders are supported" or "if no shaders are supported". There are comments hinting that it was intended to be expanded to handle that case, but we can't (easily) do that now without breaking binary compatibility.

Rather than being a modifier, you'd rather this be always visible on every object, such as in the "Plasma object" panel?

Hoikas commented 1 year ago

Hmmm... It sure seems like plLoadMask::ComputeRepMasks() is accepting a shader capability level 😕

dpogue commented 1 year ago

Yep, but then it caps it to kMaxCaps which is 1: https://github.com/H-uru/Plasma/blob/63f457b952c51474c4359a6b4cbbae5ef2e373af/Sources/Plasma/CoreLib/plLoadMask.cpp#L167

See also: https://github.com/H-uru/Plasma/blob/63f457b952c51474c4359a6b4cbbae5ef2e373af/Sources/Plasma/CoreLib/plLoadMask.h#L65

Hoikas commented 1 year ago

I've been thinking on an off about this a bit, and I think that, considering we really don't have fine grained control over what kind of hardware is being targeted, it doesn't really make sense to expose the dichotomy of whether or not the player's GPU supports shaders or not. All GPUs released in the last 15 years support shaders, so that's not a very useful yardstick. The reason why we care about shader support or not, from what I understand, is to ensure that things like wavesets and grass shaders don't display on systems that don't support them and instead show a fallback. This is, to my mind, an implementation detail, so we should probably hide that from the artist. I'm thinking that modifiers should tell Korman that they are exporting shaders, and modifiers that export shaders should accept an "alternative object(s)" parameter, which might be exposed here on the quality modifier. In this way, we can intelligently export the with/without shader bits without troubling the artist with a distinction that means nothing to them.

Deledrius commented 1 year ago

I think that makes a lot of sense, and feels very Kormanic.

dpogue commented 1 year ago

So, in that case, we'd just want 4 checkboxes for quality levels?

As for automatically adding shader load masks, I think GrassShaderMod is the easiest where the loadmask can just go on the modifier, and leave the rest of the object as-is for display. Wavesets will be more difficult and involve picking an alternative.