Skip to content

Getting Started

Matt Dean edited this page Jan 24, 2020 · 8 revisions

BACK > Home


Welcome to kDecals!

This page explains how to get started using kDecals in your project.

Installing kDecals

kDecals is a package. Using this tool requires manual modification of your project's package manifest.

  • Open your project manifest file (MyProject/Packages/manifest.json).
  • Add "com.kink3d.decals": "https://github.com/Kink3d/kDecals.git" to the dependencies list.
  • kDecals has a dependency on kPooling. Add "com.kink3d.pooling": "https://github.com/Kink3d/kPooling.git" to the dependencies list.
  • Open or focus on Unity Editor to resolve packages.

Setting up kDecals

alt text Adding the DecalRendererFeature.

kDecals uses the Universal Render Pipeline's ScriptableRenderFeature system for rendering. To start using kDecals add a DecalRendererFeature to the active Universal Render Pipeline Renderer.

Placing Decals in Editor

alt text Placing Decals in Editor.

To Place decals in the Editor either use the Create menu in the Hierarchy and select kTools/Decal or use the Add Component menu to add the Decal component via kTools/Decal.

Decals can be positioned and scaled using the objects transform like any other GameObject. However, the Transform scale Z component is controlled by the Depth value of the decal's DecalData.

Placing Decals at runtime

alt text Placing Decals at runtime.

To place decals at runtime use the API entry points in DecalSystem. For more information see Scripting API.

Decal

alt text

Decal component.

The Decal component defines a decal instance. It provides transform and projection information to the DecalRenderPass. For more information see How it works.

Data - Defines the DecalData to use for this decal. This defines how the decal will be rendered. For more information see the DecalData section below.

DecalData

alt text

And example DecalData.

The DecalData defines a decal that you can then make instances of in the scene. It provides pooling, projection and rendering properties.

Pooling Options

Enabled - When enabled, decals using this DecalData will use kPooling to pool decal instances. When a decal is requested via the DecalSystem, it will be taken from this pool.

Instance Count - When using decal pooling, this value is the maximum amount of decals that can be created using this DecalData. When this limit is reached, kPooling will disable the oldest decal using this DecalData when a new one is requested, maintaining this limit.

Projection Options

Depth - Controls how far the decal projection extends in the local Z axis.

Depth Falloff - Controls the transparency falloff towards the Depth value. A value of 0 will have no falloff, while a value of 1 will linearly interpolate.

Axis - Controls the maximum angle, in degrees, between the decal's direction and the surface angle to project the decal.

Axis Falloff - Controls the transparency falloff towards the Axis value. A value of 0 will have no falloff, while a value of 1 will linearly interpolate.

Layer Mask - Controls which layers the decal is applied to.

Sorting Order - Controls the order in which decals are sorted. Decals with higher values are drawn on top of ones with lower values.

Material Options

Materials options are controlled by the decal's Material. The Material is generated by default and can be editied via the DecalData inspector.

For more information see Shaders.