Optimise Texture and Models Memory... which switch?

There’s no forum category for performance and optimisation, so in here… sorry if wrong spot.

From a recent blog post:

  • Toggle off the Read/Write Enabled option: When enabled, this option creates a copy in both CPU- and GPU-addressable memory, doubling the texture’s memory footprint. In most cases, keep this disabled. If you are generating textures at runtime, enforce this via Texture2D.Apply, passing in makeNoLongerReadable set to true.

and:

  • Disable Read/Write: Enabling this option duplicates the mesh in memory, which keeps one copy of the mesh in system memory and another in GPU memory. In most cases, you should disable it (in Unity 2019.2 and earlier, this option is checked by default).

In both cases, I’m lost as to what these mean.

The double negatives have me not entirely sure which is which and what does what, let alone why.

Can someone explain, please, in the plainest and simplest English possible, what these two switches do, and which state sees them NOT making copies.

It is already explained in english, though.
“Enabling this option duplicates the mesh”
“When enabled, this option creates a copy”

When those options are ENABLED, then model/texture will be created twice. Once in the video memoery, and once in the system memory.

When read/write is enabled, it keeps a copy of the mesh in main memory so that your scripts are able to work with mesh verts etc.

It only consumes more memory, nothing else.

1 Like

But not in the plainest and simplest english.

You’ve not made it any clearer.

Is enabling the option disabling it, or is disabling it enabling it?

But which is which?

Switched on, they’re enabled switches, but disabling the feature, which does what?

So according to the Unity 2020 documentation, the precise wording in the checkbox is “Read/Write Enabled”

Therefor if you check the box, read/write will be enabled. If you leave the box unchecked, then read/write is disabled- the mesh will be read-only.

Read/Write is disabled by default, since at has that extra memory cost, and most people won’t need it.

1 Like

Cheers!

That’s a little clearer.

Why would someone need read/write enabled? And why does having it on mean a second copy is required?

There are no double negatives. The bolded text is telling you the step you perform to optimize and the regular text is the explanation for what happens if you don’t do it.

1 Like

It’s a textbook case of a double negative.

As is your comment one of tautology.

No. It is not a double negative because it is not the same sentence. It’s two separate sentences.

https://en.wikipedia.org/wiki/Double_negative

One sentence:

Unpack it for me, if you could, please.

I’m pretty sure that’s a double negative, but you might be right. My mind can’t determine if this means that the switch being enabled is duplicating the mesh in memory or if enabling the switch disables duplicating the mesh in memory by disabling read/write, which has been enabled.

Can you write it more clearly, bereft of any possible confusion?

I’m sorry but there’s a limit to how much I’m gonna dumb this down. Get some googling done - you have just entered lazy territory and I’m not buying.

If you have a problem with the docs, there is a feedback form on that page. Clearly, you don’t have a problem reading or writing, so this isn’t for your amusement.

Two sentences.

Disable Read/Write

and

Enabling this option duplicates the mesh in memory, which keeps one copy of the mesh in system memory and another in GPU memory.

https://en.wikipedia.org/wiki/Colon_(punctuation)

Formal English lessons are what’s likely missing here. I’m guessing it’s a second language for them.

That would be for situations where you need to change the mesh at run-time, like change the coordinates of the vertices or add more faces. Like if you wanted to make a game with sculpting or terrain-forming or something.

Hippocoder already explained why it takes more memory, essentially. There needs to be copy of the mesh moved to the gpu to render. Normally it’s copied to the gpu and you don’t need it in memory anymore. You can’t edit it when it’s in the gpu, though, so the only way to update the mesh is keep a copy in RAM, edit it there, then copy it to the gpu again.

Depending on what you want to do, there are other ways to deform a mesh that don’t require it be read/write, like using a vertex shader or using deform bones in a skinned mesh.

1 Like

Brilliant!!!

Thank you, this clears up a LOT!!!

Had wrongly presumed, for a very long time, that meshes on GPU could be messed with. Not that I’d ever tried.

Just now beginning on the shaders journey.

Two steps forward, three steps back.

So it’s just a contradiction?

Enabling this… means disabling it?

I think what would make it more clear is if the command is: Read/Write and you simply set it to true or false.

When writing my own code I always careful how I name a boolean variable to avoid confusion later. I try to avoid “IsThingOn?” “ThingEnabled”. In other words, don’t mention true or false in the variable, only specify what it is.

So instead my variable would be called “Thing” and then true or false value tells me if its enabled or not. Reduces confusion.

Only I have to read it but it still reduces the brain energy I have to exert especially when I look at things later and I’ve forgot what is happening.

Seems like because we have two options comming from the docs or blog or w/e this is, there isn’t a standard, or at least someone broke it.

Once again one is telling you the action to perform for the optimization and one is telling you what happens if you don’t do it.

Sorry, I’m genuinely still confused.

Which is which?

I’m not sure what part of wording you’re having trouble with. basically when the article says this:

Disable Read/Write: Enabling this option duplicates the mesh in memory, which keeps one copy of the mesh in system memory and another in GPU memory. In most cases, you should disable it (in Unity 2019.2 and earlier, this option is checked by default).

it means:

You want to Disable Read/Write: You don’t want to enable Read/Write because Enabling this option duplicates the mesh in memory, which keeps one copy of the mesh in system memory and another in GPU memory. In most cases, you should disable it (in Unity 2019.2 and earlier, this option is checked by default).

1 Like