Difference between revisions of "Community extensions"

From Bakery GPU Lightmapper: Wiki
Jump to navigation Jump to search
(Better Lit Shader)
(Lightmap Swapper & Light Probe Storage)
 
(20 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
 
If you want to submit any extensions, contact me on [https://forum.unity.com/threads/bakery-gpu-lightmapper-v1-6-released.536008/ Unity forum], [https://twitter.com/guycalledfrank Twitter] or anywhere else.
 
If you want to submit any extensions, contact me on [https://forum.unity.com/threads/bakery-gpu-lightmapper-v1-6-released.536008/ Unity forum], [https://twitter.com/guycalledfrank Twitter] or anywhere else.
 
=== Better Lit Shader===
 
(by [https://assetstore.unity.com/publishers/25047 Jason Booth])
 
 
The Better Lit shader is an improved Lit shader which runs across all render pipelines, and offers a number of multi-layer and procedural techniques to texturing. Supports all [[Manual#Bakery_shaders|Bakery shader features]] out of the box.
 
 
[https://assetstore.unity.com/packages/vfx/shaders/better-lit-shader-189232 Asset Store]
 
 
{{note|Current versions of Better Lit / Better Shaders may have some problems in HDRP. Light probe lighting may look wrong, and volume/vertex/bicubic shadowmasks are not supported yet.}}
 
 
<hr>
 
 
=== Better Shaders ===
 
(by [https://assetstore.unity.com/publishers/25047 Jason Booth])
 
 
Want to write shaders that are compatible with the render pipeline without being forced to use a shader graph? Better Shaders makes that a viable option. Supports all [[Manual#Bakery_shaders|Bakery shader features]] out of the box.
 
 
[https://assetstore.unity.com/packages/tools/visual-scripting/better-shaders-standard-urp-hdrp-187838 Asset Store]
 
<hr>
 
  
 
=== [https://assetstore.unity.com/packages/tools/visual-scripting/amplify-shader-editor-68570 Amplify] shaders ===
 
=== [https://assetstore.unity.com/packages/tools/visual-scripting/amplify-shader-editor-68570 Amplify] shaders ===
Line 36: Line 17:
 
<hr>
 
<hr>
 
=== Lightmap Swapper & Light Probe Storage ===
 
=== Lightmap Swapper & Light Probe Storage ===
(by [https://twitter.com/EugeneCone Eugene Cone])
+
(by [https://twitter.com/EugeneCone Eugene Cone], fixed by [https://github.com/pysijuice pysijuice])
 
[[File:Sslightprobes.jpg|thumb|Lightmap/probe switching]]
 
[[File:Sslightprobes.jpg|thumb|Lightmap/probe switching]]
[https://drive.google.com/open?id=1C-wnsfM358tSkCR1UuQqxjp4O1EmrTru Download]
+
[https://drive.google.com/file/d/1vbRbYMTZnMTD7MS6BeHmfwe4C79M-V2-/view?usp=sharing Download]
  
 
* Lightmap swapper
 
* Lightmap swapper
Line 55: Line 36:
 
If for some reason you get warning "Can't find harmonics #X", then set precision slider to 0.02 and press button again - this should help.
 
If for some reason you get warning "Can't find harmonics #X", then set precision slider to 0.02 and press button again - this should help.
  
[https://gfycat.com/thinbrokenkinkajou GIF]
+
[https://gfycat.com/redmassivechrysomelid GIF]
[https://gfycat.com/redmassivechrysomelid GIF 2]
 
  
 
=== UV Debug Shader ===
 
=== UV Debug Shader ===
Line 87: Line 67:
  
 
New assets are saved to Assets/VCMesh folder.
 
New assets are saved to Assets/VCMesh folder.
 +
 +
UPD: addded support for skinned mesh renderers. Normally Unity can't use additionalVertexStreams on them, but by using this script it is possible to generate a new skinned mesh with lighting baked in.
 +
 +
=== Make Exportable ===
 +
(by Mr F)
 +
 +
[https://drive.google.com/file/d/1zAHxTW_Mk_wv4AWlTkxgfxJOkBMUjp-u/view?usp=share_link Download]
 +
 +
This tool makes a copy of the scene with [https://docs.unity3d.com/ScriptReference/Renderer-lightmapScaleOffset.html lightmapScaleOffset] baked into vertex buffers, so it can be exported via e.g. the [https://docs.unity3d.com/Packages/com.unity.formats.fbx@2.0/manual/index.html FBX exporter] package and used outside of Unity with lightmaps being properly mapped.
 +
 +
Usage: Bakery -> Utilities -> Make Exportable. A new copy of the scene will be created inside an "ExportableScene" object.
  
 
=== Batch scene baker ===
 
=== Batch scene baker ===
Line 95: Line 86:
  
 
Script to automatically bake multiple scenes, one by one (lightmaps, light probes and reflection probes). All dialog boxes during the bake will be suppressed.
 
Script to automatically bake multiple scenes, one by one (lightmaps, light probes and reflection probes). All dialog boxes during the bake will be suppressed.
 +
 +
=== Copy Lightmap ===
 +
(by Mr F)
 +
 +
[https://drive.google.com/file/d/1O5wmkEp8EoMKCx8Rdn-Zrb5-YZLc66AD/view?usp=sharing Download]
 +
 +
Copies all lightmapping references from one GameObject hierarchy to another. Any destination objects with matching names will receive the same lightmaps as source objects. Doesn't require rebaking, applied immediately.
 +
 +
Usage:
 +
* Add CopyLightmapComponent to the destination hiearchy parent object.
 +
* Put the source parent into the "source" field.
 +
* Click Update.
 +
 +
=== Get AO Maps ===
 +
(by Mr F)
 +
 +
[https://drive.google.com/file/d/1VQVdL2TNYTo2pC_2dO7cw6pDO8guZ6D0/view?usp=sharing Download]
 +
 +
Gets ambient occlusion maps from the last bake as single-channel PNGs, avoiding a separate "Ambient occlusion only" pass.
 +
Usage:
 +
* Bake with ambient occlusion enabled; if you don't want AO in your base lightmaps, just set the AO intensity to a small value above 0 (e.g. 0.0001).
 +
* Click "Bakery -> Get AO maps".
 +
* New single-channel textures named like "lightmapName_AO.png" will appear next to original lightmaps.

Latest revision as of 19:34, 3 December 2024

This page lists some additional and user-made scripts, shaders and extensions that can help you in specific scenarios, as well as other big assets which have interoperability with Bakery.

If you want to submit any extensions, contact me on Unity forum, Twitter or anywhere else.

Amplify shaders

Updated ASE shaders for URP, with SH lightmap and Volume support (with specular) by Not_Lonely:

Link


Previous ASE shaders by Ben Woodford:

Github Link

Allows using Bakery SH lightmaps with specular in Amplify.


Lightmap Swapper & Light Probe Storage

(by Eugene Cone, fixed by pysijuice)

Lightmap/probe switching

Download

  • Lightmap swapper

- Put this script onto the root of your lightmap group.

- Assign a new lightmap to the New Lightmap slot.

- Assign Lightprobe Storage to the Lp Storage slot (if you have one).

- Press Apply New Lightmap. Script will try to find a mesh with a valid lightmap index and use this index to swap an original lightmap with the new one.

  • Light Probe Storage

Created for use with multi-scene lightmap baking (Unity tends to store LightProbes data in a wrong Lighting Asset, thus making your lightprobes completely black upon loading the project) and runtime lightmap/lightprobe swapping (like turning lights on and off). Put this script onto LightProbeGroup you want to save and press Grab Harmonics after baking the Lightprobes. To restore saved probes, press Apply Harmonics or enable one of applyHarmonicsOnEnable/applyHarmonicsOnStart options and start the game. If for some reason you get warning "Can't find harmonics #X", then set precision slider to 0.02 and press button again - this should help.

GIF

UV Debug Shader

(by Mr F)

UV debugging

Download

Simple shader that visualizes UV1 with overlaps.

Debug Tools

(by Mr F)

Download

A small suite of debugging tools I use for development. Adds some new options to Bakery menu:

  • Debug select storage: selects the invisible storage object in the scene so you can see actual saved values (lightmap, renderer, light lists, etc),
  • Show storage: makes the invisible object visible.
  • Clear useless data: clears some temporary data on the invisible object. This shouldn't be needed, as it's always performed after the bake anyway.
  • Debug asset: if "Adjust UV padding" was used to alter the model, will log saved mesh/padding settings of the selected asset.
  • Clear asset meta: clears all Bakery UV padding related settings from selected assets.

Vertex Lightmap To Mesh Asset

(by Mr F)

Download

Vertex color baking uses additionalVertexStreams to bind an additional vertex buffer to the graphics pipeline without breaking the link with the original mesh asset; but additionalVertexStreams cannot be batched/instanced.

This tool adds "Bakery/Utilities/New mesh asset with vertex color" menu option that'll generate a new complete mesh asset out of every selected GameObject having MeshRenderer/MeshFilter. These can be then used with batching.

New assets are saved to Assets/VCMesh folder.

UPD: addded support for skinned mesh renderers. Normally Unity can't use additionalVertexStreams on them, but by using this script it is possible to generate a new skinned mesh with lighting baked in.

Make Exportable

(by Mr F)

Download

This tool makes a copy of the scene with lightmapScaleOffset baked into vertex buffers, so it can be exported via e.g. the FBX exporter package and used outside of Unity with lightmaps being properly mapped.

Usage: Bakery -> Utilities -> Make Exportable. A new copy of the scene will be created inside an "ExportableScene" object.

Batch scene baker

(by Mr F)

Batch scene baker

Download

Script to automatically bake multiple scenes, one by one (lightmaps, light probes and reflection probes). All dialog boxes during the bake will be suppressed.

Copy Lightmap

(by Mr F)

Download

Copies all lightmapping references from one GameObject hierarchy to another. Any destination objects with matching names will receive the same lightmaps as source objects. Doesn't require rebaking, applied immediately.

Usage:

  • Add CopyLightmapComponent to the destination hiearchy parent object.
  • Put the source parent into the "source" field.
  • Click Update.

Get AO Maps

(by Mr F)

Download

Gets ambient occlusion maps from the last bake as single-channel PNGs, avoiding a separate "Ambient occlusion only" pass. Usage:

  • Bake with ambient occlusion enabled; if you don't want AO in your base lightmaps, just set the AO intensity to a small value above 0 (e.g. 0.0001).
  • Click "Bakery -> Get AO maps".
  • New single-channel textures named like "lightmapName_AO.png" will appear next to original lightmaps.