### Attribution Text Example Source: https://ltcgi.dev/Getting%20Started/Installation/Attribution Use this text format to provide credit if not using the provided attribution prefab. ```text This project/world uses LTCGI by _pi_, see 'github.com/pimaker/ltcgi'. ``` -------------------------------- ### Get and Set Per-Screen Color Source: https://ltcgi.dev/Advanced/Udon_Sharp_API Allows getting and setting the color for a specific screen using its index. Note that color values may be in an unexpected color space; use Color.linear and Color.gamma for conversions. _SetColor expects color.linear for reflected color to match the Unlit object's _Color. ```csharp public Color _GetColor(int screen); ``` ```csharp public void _SetColor(int screen, Color color); ``` -------------------------------- ### Get Screen Index by GameObject Source: https://ltcgi.dev/Advanced/Udon_Sharp_API Retrieves the index of a screen GameObject, which acts as a unique identifier. This should preferably be called in Start, not Update, as it's an expensive call. Only one LTCGI_Screen component is allowed per GameObject. ```csharp public int _GetIndex(GameObject screen); ``` -------------------------------- ### Configure LTCGI Sampler State Source: https://ltcgi.dev/Advanced/Shader_Authors Configure the LTCGI sampler state by defining the LTCGI_SAMPLER macro before importing LTCGI. The sampler should use clamp and trilinear filtering. Anisotropic filtering is optional. ```csharp #define LTCGI_SAMPLER sampler_LTCGI_trilinear_clamp_sampler ``` -------------------------------- ### Enable/Disable Global LTCGI State Source: https://ltcgi.dev/Advanced/Udon_Sharp_API Call this function on the adapter to globally enable or disable LTCGI. Material-swapping is still recommended for performance. ```csharp public void _SetGlobalState(bool enabled) ``` -------------------------------- ### Global Settings API Source: https://ltcgi.dev/Advanced/Udon_Sharp_API Functions for globally enabling/disabling LTCGI and changing the global video texture input. ```APIDOC ## Global Settings API ### Description Provides functions to globally control LTCGI settings, such as enabling/disabling the feature and setting the global video texture. ### Methods #### `_SetGlobalState(bool enabled)` * **Description**: Globally enables or disables LTCGI. It is recommended to also use material-swapping for performance. * **Parameters**: * `enabled` (bool) - Required - `true` to enable LTCGI, `false` to disable. #### `_SetVideoTexture(Texture texture)` * **Description**: Changes the global realtime video texture input at runtime. This operation is expensive and should be called only when necessary. * **Parameters**: * `texture` (Texture) - Required - The new video texture to set. ### Request Example ```csharp // Example for _SetGlobalState LTCGI_UdonAdapter adapter = ...; adapter._SetGlobalState(true); // Example for _SetVideoTexture Texture myVideoTexture = ...; adapter._SetVideoTexture(myVideoTexture); ``` ### Response * No explicit response body for these methods, they perform actions directly. ``` -------------------------------- ### Amplify Shader Editor Include and Tag Source: https://ltcgi.dev/Advanced/Shader_Authors In Amplify Shader Editor, configure the include path and add the custom tag for LTCGI compatibility. This is a prerequisite for using LTCGI nodes. ```shaderlab #include "Packages/at.pimaker.ltcgi/Shaders/Amplify/LTCGI_Amplify.shader" ``` ```shaderlab Tags { "LTCGI" = "ALWAYS" } ``` -------------------------------- ### Include LTCGI.cginc in Shader Source: https://ltcgi.dev/Advanced/Shader_Authors Include the LTCGI.cginc file in your shader to enable LTCGI support. Ensure the file is accessible via the import path. You can check for its inclusion using the LTCGI_INCLUDED define in C#. ```csharp #include "LTCGI.cginc" ``` -------------------------------- ### Toggle LTCGI Global State with UdonSharp Source: https://ltcgi.dev/Getting%20Started/Setup/Basic_Toggle Use this UdonSharp script to enable or disable LTCGI globally. It requires a reference to the LTCGI_UdonAdapter and can be triggered by user input like UI toggles or interaction. ```csharp using UdonSharp; // NOTE: This script has to reference the "LTCGI_AssemblyUdon" to allow it to use the "LTCGI_UdonAdapter" type! [UdonBehaviourSyncMode(BehaviourSyncMode.None)] public class LTCGI_ExampleToggle : UdonSharpBehaviour { // set this to your controller object (specifically the adapter object): public LTCGI_UdonAdapter Adapter; // set this however you want: public bool StartingState = true; private bool state; void Start() { state = StartingState; Adapter._SetGlobalState(state); } // you can make this a UI event as well! public override void Interact() { state = !state; Adapter._SetGlobalState(state); } } ``` -------------------------------- ### Per-Screen Settings API Source: https://ltcgi.dev/Advanced/Udon_Sharp_API Functions for retrieving and modifying individual screen settings, including color and texture. ```APIDOC ## Per-Screen Settings API ### Description Provides functions to manage individual screen settings, such as retrieving screen indices, setting colors, and updating textures. ### Methods #### `_GetIndex(GameObject screen)` * **Description**: Retrieves the internal index for a given screen GameObject. This index is used for other per-screen functions. Requires the GameObject to have a single `LTCGI_Screen` component. * **Parameters**: * `screen` (GameObject) - Required - The GameObject containing the `LTCGI_Screen` component. * **Returns**: * `int` - The internal index of the screen. #### `_GetColor(int screen)` * **Description**: Retrieves the current color setting for a specific screen. * **Parameters**: * `screen` (int) - Required - The index of the screen. * **Returns**: * `Color` - The color of the screen. Note: May be in an unexpected color space; use `Color.linear` and `Color.gamma` for conversions. #### `_SetColor(int screen, Color color)` * **Description**: Sets the color for a specific screen. For the reflected color to match the `_Color` on an Unlit object, provide `color.linear`. * **Parameters**: * `screen` (int) - Required - The index of the screen. * `color` (Color) - Required - The color to set. Use `Color.linear` for accurate reflection matching. #### `_SetTexture(int screen, uint index)` * **Description**: Sets the texture for a specific screen using a texture index. * **Parameters**: * `screen` (int) - Required - The index of the screen. * `index` (uint) - Required - The index of the texture to apply. ### Request Example ```csharp // Example for _GetIndex and _SetColor LTCGI_UdonAdapter adapter = ...; GameObject screenObject = ...; int screenIndex = adapter._GetIndex(screenObject); Color linearColor = Color.linear; adapter._SetColor(screenIndex, linearColor); // Example for _SetTexture uint textureIndex = 0; adapter._SetTexture(screenIndex, textureIndex); ``` ### Response * `_GetColor` returns a `Color` object. * `_GetIndex`, `_SetColor`, and `_SetTexture` do not have explicit response bodies, they perform actions directly. ``` -------------------------------- ### Default Sampler Declaration Source: https://ltcgi.dev/Advanced/Shader_Authors This is the default declaration for the LTCGI sampler state, which uses trilinear filtering and clamp mode. ```csharp SamplerState sampler_LTCGI_trilinear_clamp_sampler; ``` -------------------------------- ### Set Per-Screen Texture Source: https://ltcgi.dev/Advanced/Udon_Sharp_API Sets the texture for a specific screen using its index. ```csharp public void _SetTexture(int screen, uint index); ``` -------------------------------- ### Change Global Realtime Video Texture Input Source: https://ltcgi.dev/Advanced/Udon_Sharp_API Updates the global realtime video texture input at runtime. This operation is expensive and should only be called when necessary. ```csharp public void _SetVideoTexture(Texture texture); ``` -------------------------------- ### Disable Lightmap for Diffuse Contribution Source: https://ltcgi.dev/Advanced/Shader_Authors Use the LTCGI_ALWAYS_LTC_DIFFUSE macro (default in avatar mode) to eliminate the need for a separate lightmap texture, reducing texture slot usage. ```csharp #define LTCGI_ALWAYS_LTC_DIFFUSE ``` -------------------------------- ### Shader Tag for LTCGI Compatibility Source: https://ltcgi.dev/Advanced/Shader_Authors Add a tag named 'LTCGI' to your shader to make it recognizable by the LTCGI controller. The tag value can be 'ALWAYS' or the uppercase name of a shader property that LTCGI support depends on. ```shaderlab Tags { "LTCGI" = "ALWAYS" } ``` -------------------------------- ### LTC Research Paper Citation Source: https://ltcgi.dev/Getting%20Started/Installation/Attribution Reference information for the Linearly Transformed Cosines paper used as the basis for LTCGI. ```text Real-Time Polygonal-Light Shading with Linearly Transformed Cosines. Eric Heitz, Jonathan Dupuy, Stephen Hill and David Neubelt. ACM Transactions on Graphics (Proceedings of ACM SIGGRAPH 2016) 35(4), 2016. Project page: https://eheitzresearch.wordpress.com/415-2/ ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.