holoride
Search Results for

    Show / Hide Table of Contents
    ❮ Map Nodes
    Masks & Texture Layers ❯

    Distances & Heights

    To build comfortable, motion-synchronized virtual worlds, developers must construct a mathematically precise correlation between real-world geographical road coordinates and procedural terrain elevations.

    The most fundamental layout principle of every vehicle-bound XR environment is to evolve elevations around the road network. This ensures the road remains flat and cleared at 0.0 to guarantee smooth, collision-free gameplay, while mountains and valleys rise organically in the distance.

    In other words, you compute a heightmap over a continuous distance.


    1. The Distance Transform (Calculating Clearances)

    To map the distance away from real-world road lanes, the SDK provides the Distance Transform node.


    The Algorithm:

    • Inputs: Receives a binary road mask (such as the Road Network Mask where roads are 1.0 and space is 0.0).
    • Calculation: Per output pixel, the Distance Transform calculates the continuous 2D Euclidean distance (measured in meters) to the closest non-zero pixel of the road mask.
    • The Shape Output: Applying a raw Distance Transform to a grid road network results in a terrain covered in sharp, pyramid-like shapes. The elevation increases linearly towards the absolute center of each block, culminating in rigid ridges where the distance vectors converge.

    2. Injected Detail (Organic Perlin Noise)

    While a raw Distance Transform is too rigid to serve as a natural terrain, multiplying these distances with a Perlin Noise node produces highly organic, varied landscapes:


    The resulting terrain has a natural appearance: hill shapes are defined by the noise while their heights scale up smoothly with the distance from the road.

    Understanding Noise Wave Properties:

    A 2D Perlin noise is a smooth, continuous gradient function. To sample it across your generation bounds, we evaluate its amplitude coordinates along a two-dimensional grid:

    • The Size Parameter (Period / Frequency): The Size parameter in the node controls the frequency of the noise signal. In standard physics, frequency is calculated as 1 / Size.
    • Self-Similarity: Adjusting Size captured broader or tighter segments of the continuous Perlin wave, allowing you to scale between broad rolling plateaus or tight, craggy ridges.
    • Seamless Tiling: The SDK's 2D noise output is natively tileable, ensuring that as the ESG loads new world cells ahead of the vehicle, the noise values transition with absolute continuity.

    3. Signal Modulation (Combining Maps)

    Map Modifiers execute mathematical operations on every pixel of the input maps simultaneously on background CPU threads. To understand how Map addition and multiplication shape terrains, it is helpful to think of a map slice as a 1D wave signal.

    The interactive graph below visualizes these signal operations. The top chart represents your raw input maps (Map A and Map B). You can drag the knobs on these curves to adjust their amplitudes and observe how the resulting mathematical outputs shape the combined curve in the bottom chart:

    Tip

    The top chart is fully interactive! Drag the knobs on the curves to dynamically shape the output graphs and visualize how procedural map addition and multiplication combine signals.

    Math Principles for Terrain Modifiers:

    • Map Multiplication (Map A * Map B): Operates as a gating mask. Any pixel where Map A is 0.0 forces the output to 0.0, regardless of Map B's value. This is the ultimate tool to carve flat valleys or clear roads.
    • Map Addition (Map A + Map B): Operates as a combiner. It overlays detail (like fine noise bumps) on top of broad, macro shapes (like macro mountain ranges) without erasing the underlying form.

    ❮ Map Nodes
    Masks & Texture Layers ❯
    In This Article

    Back to top
    ©   holoride
    Privacy   Imprint