This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
static_batching [2021/05/02 17:31] 73.95.178.156 old revision restored (2021/05/02 17:09) |
static_batching [2021/12/13 19:18] (current) uninomiconadmin |
||
---|---|---|---|
Line 23: | Line 23: | ||
The lightmap coordinates from [[lightingdataasset|Lighting Data Asset]] are baked into the Combined Mesh UV coordinates when the scene loads((I think this also happens **during** standalone build, not at runtime, but I'm not sure)). Afterwards, querying '' | The lightmap coordinates from [[lightingdataasset|Lighting Data Asset]] are baked into the Combined Mesh UV coordinates when the scene loads((I think this also happens **during** standalone build, not at runtime, but I'm not sure)). Afterwards, querying '' | ||
+ | Static batching can actually work with manually provided lightmap scale/ | ||
+ | |||
+ | ===== Batching and MaterialPropertyBlocks ===== | ||
+ | |||
+ | Static and SRP batching is incompatible with MaterialPropertyBlocks, | ||
+ | |||
+ | This is the data sent by the SRP batcher for each draw call: | ||
+ | |||
+ | {{ :: | ||
+ | |||
+ | This data is efficiently managed by the engine and uploaded to the GPU as fast as Unity can. The idea is to abuse some of these built-in values to pass custom data. Good candidates are '' | ||
+ | |||
+ | An example, when using SRP batching: | ||
+ | |||
+ | <code csharp> | ||
+ | renderer.realtimeLightmapIndex = 0; // forces " | ||
+ | renderer.realtimeLightmapScaleOffset = ...; // Vector4 of custom data | ||
+ | |||
+ | // For custom SRPs: | ||
+ | // (Only relevant for custom SRPs; in existing RPs it should likely just work as is, as they all support lightmapping in the main pass) | ||
+ | drawingSettings.perObjectData = ...; // PerObjectData.Lightmaps or otherStuffYouNeed; | ||
+ | </ | ||
+ | |||
+ | On the GPU you should have a '' |