Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# `Hydra.sim.heightmap`

Module responsible for heightmap generation.

## Module Contents

Hydra.sim.heightmap.genHeightmap(obj: bpy.types.Object) → moderngl.Texture

  Creates a heightmap for the specified object and returns it.

  Parameters:

    obj (`bpy.types.Object`) – Object to generate from.

  Returns:

    Generated heightmap.

  Return type:

    `moderngl.Texture`

Hydra.sim.heightmap.genHeightmapFromImage(img: bpy.types.Image) → moderngl.Texture

  Creates a heightmap for the specified image and returns it.

  Parameters:

    img (`bpy.types.Image`) – Image to generate from.

  Returns:

    Generated heightmap.

  Return type:

    `moderngl.Texture`

Hydra.sim.heightmap.prepareHeightmap(obj: bpy.types.Image | bpy.types.Object)

  Creates or replaces a base map for the given Image or Object. Also creates a source map if needed.

  Parameters:

    obj (`bpy.types.Object` or `bpy.types.Image`) – Object or image to generate from.

Hydra.sim.heightmap.subtract(modified: moderngl.Texture, base: moderngl.Texture) → moderngl.Texture

  Subtracts given textures and returns difference relative to base as a result.

  Parameters:

    - modified (`moderngl.Texture`) – Current heightmap. Minuend.

    - base (`moderngl.Texture`) – Base heightmap. Subtrahend.

  Returns:

    A texture equal to (modified - base).

  Return type:

    `moderngl.Texture`

Hydra.sim.heightmap.preview(obj: bpy.types.Object, current: Hydra.common.Heightmap, base: Hydra.common.Heightmap)

  Creates a heightmap difference and previews it.

  Parameters:

    - obj (`bpy.types.Object`) – Object to apply to.

    - current (`common.Heightmap`) – Current heightmap to preview.

    - base (`common.Heightmap`) – Base heightmap for difference calculation.

Hydra.sim.heightmap.setCurrentAsSource(obj: bpy.types.Object | bpy.types.Image, asBase: bool = False)

  Applies the current map as a source map.

  Parameters:

    - obj (`bpy.types.Object` or `bpy.types.Image`) – Object or image to modify.

    - asBase (`bool`) – Applies as base as well if True.