# Quick Start This article shows the recommended way to use the feature. Starting from an empty project, you will declare two parameters, fill in their values, and read them back to build a finished image. The example is a radar view. A radar reacts to something the renderer knows nothing about: how strongly a surface sends a pulse back. Sheet metal answers brightly, plaster scatters, glass falls somewhere in between. Any other parameter of your own is set up the same way, whatever its values mean. The example needs two parameters, because a radar return is made of two things: - **The substance itself.** Sheet metal reflects the same way wherever it is used, so this value is stored on the **material**. - **The object.** A corroded panel or a wet deck answers differently from the clean substance, so this value is stored on the **surface**. [Choosing Where a Value Belongs](../../../content/materials/custom_parameters/index.md#choosing) explains the rule in general. 1. **Declare the parameters.** Open *Settings -> Runtime -> World -> Render -> [Custom Parameters](../../../editor2/settings/render_settings/custom_parameters/index.md)* and add one entry on each of two tabs: One *Save* commits both tabs. The declarations are stored with the project, and the same two can be made from code instead, as [Declaring Parameters](../../../content/materials/custom_parameters/declaring_and_setting_cpp.md#declare) describes. > **Notice:** A declaration changes the **SurfaceParameters** and **MaterialParameters** structures that every shader reading them is compiled against, so *Save* reloads the materials to rebuild them - on a large project that takes a while. Declare the parameters the project needs in one pass in *UnigineEditor*, rather than adding them one at a time as they turn out to be needed. - On the *Material* tab - a float named radar_gamma_db, the backscatter coefficient of the substance in decibels. A default of -20 and a range from -40 to 30 covers everything from a poorly answering ground to a metal corner reflector: ![radar_gamma_db being declared on the Material tab of the Custom Parameters settings page](custom_material_parameter_create.png) - On the *Surface* tab - a float named gamma_offset, the correction one particular surface applies to that coefficient, also in decibels, with a range from -20 to 20. Its default has to be 0, so that a surface nobody has touched answers exactly as its material says: ![gamma_offset being declared on the Surface tab of the Custom Parameters settings page](custom_surface_parameter_create.png) 2. **Make sure the surfaces write their ID into buffers.** Opaque geometry always does, and nothing has to be switched on for it. Alpha-blend meshes, particles and decals write their ID only while the corresponding state of their material is enabled. In this example that is the glazing: an *Alpha Blend* material writes no Surface ID until *Surface ID* is switched on in its *Buffers* group (or *Write Surface ID* in the settings of a [material graph](../../../content/materials/graph/index.md)), and without it the glass is simply absent from the radar picture while the roof and the walls show up correctly. ![](enable_surface_id_mesh.png) ![](write_surface_id_mgraph_alphablend.png) A surface that writes no ID cannot be found through a buffer: its values are stored under that ID, so a reader sampling a pixel has nothing to look them up by. [Surface ID Buffers and the Multilayered Mode](../../../content/materials/custom_parameters/ids_and_buffers.md#modes) shows where the switch sits for each kind of material, and covers the *Multilayered* setting that decides whether transparency and water get buffers of their own. 3. **Fill in the values on the materials.** This is where most of the scene is described, and there is one value to write per substance rather than per object. In the *Materials* window select a material and open its *[Custom Parameters](../../../content/materials/custom_parameters/declaring_and_setting_cpp.md#values_material)* tab, which appears as soon as the material layout declares something. Set radar_gamma_db there: about 15 dB for the sheet metal of the roof, -30 dB for the plaster of the walls, something in between for the glazing. Every surface using that material now answers with the value, including the ones added to the scene later, and nothing had to be selected object by object. 4. **Correct the individual surfaces that deviate.** Only where an object differs from the substance it is made of. Select the object, and in the *Parameters* window open its *[Surfaces](../../../content/materials/custom_parameters/declaring_and_setting_cpp.md#values_surface)* section. Pick a surface in the list, then scroll down to *Custom Parameters* - the last one, after *Surface Custom Texture*. Set gamma_offset to -6 on the corroded roof panel, and leave every other surface at 0. A value is written for the selected surface only, and the section with custom parameters is displayed only if a [surface parameter is declared](#declare_parameter) - [Setting Values](../../../content/materials/custom_parameters/declaring_and_setting_cpp.md#values) covers what else it offers, including how to write such values from code while the application runs, which is what a changing state like wetness or target velocity needs. 5. **Read both values where the image is formed.** In a post-effect material graph take two nodes and set the *Type* property of each to *Scene*: Add the two together, and the sum is the backscatter coefficient of that pixel in decibels. Connect it to whatever forms the sensor picture - a brightness, a palette lookup, a threshold. Both nodes start from the same Surface ID, so reading the pair costs one lookup more than reading either alone. In a shader that is literally one extra call - *[Reading Both Blocks at One Pixel](../../../code/uusl/custom_parameters.md#usage)* writes it out. ![A post-effect graph adding the radar_gamma_db port of the Scene Material Parameters node to the gamma_offset port of the Scene Surface Parameters node](custom_parameters_radar_post_mat.png) To see the result, enable the material in *Settings -> Runtime -> World -> Render -> [Custom Post Materials](../../../editor2/settings/render_settings/custom_post/index.md)* - a post-effect material renders nothing until it is listed there. [In a Shader](../../../content/materials/custom_parameters/reading_parameters.md#shader_uusl) shows the same reading done in a custom shader instead of a graph. - *[Material Parameters](../../../content/materials/graph/node_library/input/material_parameters.md)* for the *radar_gamma_db* output port - the node samples the Surface ID Buffer at the pixel, follows the Material ID stored in the surface block, and gives back the values of the material drawn there; - *[Surface Parameters](../../../content/materials/graph/node_library/input/surface_parameters.md)* for the *gamma_offset* output port - the values of the surface itself, at the same pixel. 6. **Check what the buffers actually hold.** The [Rendering Debug](../../../editor2/rendering_debug/index.md) panel draws the Surface ID and Material ID buffers as they are, which answers "is this surface writing an ID at all" before you start debugging the shader. [Visual Debugging](../../../content/materials/custom_parameters/ids_and_buffers.md#debug) lists the modes it offers. 7. **Do the rest of the logic for the effect.** The values the renderer knew nothing about are available in the graph now, and everything that turns them into a radar picture - the sweep, the palette, how quickly old returns fade - is specific to the sensor being built and is left to be written for the project at hand. 8. **Add the material to the camera.** Listed among *Custom Post Materials*, the effect covers the whole screen. A sensor view usually lives in a window of its own instead. To see the final result there, enable the post-effect material in the final renderer of the camera that renders the sensor view. One way to do that is *[*Camera::addScriptableMaterial()*](../../../api/library/rendering/class.camera_cpp.md#addScriptableMaterial_Material_void)*, another is *World Hierarchy -> Camera -> Scriptable Materials -> Add Scriptable Material*. What that camera returns is then drawn over the main image. Notice how little was written by hand. The scene is described by as many numbers as it has substances, filled in on the materials, and the surfaces were touched only where an object had to deviate from what it is made of. Had the coefficient been kept per surface instead, the same number would have been repeated on every metal surface in the project and kept in sync by hand from then on. The surface side is also the side that moves. A gamma_offset is set once in the editor here, but nothing stops the application from rewriting it every frame - which is how a doppler processor gets the velocity of a moving target, and how a deck getting wet changes the sensor image as it happens. [Choosing Where a Value Belongs](../../../content/materials/custom_parameters/index.md#choosing) compares the two sides in detail.