blenderproc.python.modules.materials.RockEssentialsTextureSampler module¶
-
class
blenderproc.python.modules.materials.RockEssentialsTextureSampler.
RockEssentialsTextureSampler
(config)[source]¶ Bases:
blenderproc.python.modules.loader.LoaderInterface.LoaderInterface
Samples a random texture data from the provided list and sets the images to each selected object (ground tiles created by constructor.RockEssentialsGroundConstructor) if they have a RE-specific material assigned (they have it applied by default if ground tile was constructed by aforementioned constructor module).
Example 1: For all ground planes matching a name pattern select a random set of textures with custom ambient occlusion, displacements strength and UV map scaling factor values.
{ "module": "materials.RockEssentialsTextureSampler", "config": { "selector": { "provider": "getter.Entity", "conditions": { "name": "Gr_Plane.*", "type": "MESH" } }, "textures": [ { "path": "<args:0>/Rock Essentials/Ground Textures/Pebbles/RDTGravel001/", "uv_scaling": 2, "ambient_occlusion": [0.5, 0.5, 0.5, 1], "displacement_strength": 1.5, "images": { "color": "RDTGravel001_COL_VAR1_3K.jpg", "roughness": "RDTGravel001_GLOSS_3K.jpg", "reflection": "RDTGravel001_REFL_3K.jpg", "normal": "RDTGravel001_NRM_3K.jpg", "displacement": "RDTGravel001_DISP16_3K.tif" } }, { "path": "<args:0>/Rock Essentials/Ground Textures/Pebbles/RDTGroundForest002/", "uv_scaling": 4, "ambient_occlusion": [0.7, 0.7, 0.7, 1], "displacement_strength": 0.5, "images": { "color": "RDTGroundForest002_COL_VAR1_3K.jpg", "roughness": "RDTGroundForest002_GLOSS_3K.jpg", "reflection": "RDTGroundForest002_REFL_3K.jpg", "normal": "RDTGroundForest002_NRM_3K.jpg", "displacement": "RDTGroundForest002_DISP16_3K.tif" } } ] } }
Ground plane config:
Parameter Description Type selector Objects (ground planes) with RE-specific material applied. Provider textures A list of dicts with texture data: images, path to the images, etc. list Texture data:
Parameter Description Type path Path to a directory containing maps required for recreating texture. string ambient_occlusion Ambient occlusion [R, G, B, A] color vector for a ground tile material’s shader. Default: [1, 1, 1, 1]. mathutils.Vector uv_scaling Scaling factor of the UV map. Default: 1. float displacement_strength Strength of a plane’s displacement modifier. Default: 1. float images/color Full name of a color map image. string images/roughness Full name of a roughness map image. string images/reflection Full name of a reflection map image. string images/normal Full name of a normal map image. string images/displacement Full name of a displacement map image. string -
_get_random_texture
(textures)[source]¶ Chooses a random texture data from the provided list.
Parameters: textures – Texture data. Type: list. Returns: Selected texture data. Type: Config.
-
_load_images
(selected_texture)[source]¶ Loads images that are used as color, roughness, reflection, normal, and displacement maps.
Parameters: selected_texture – Selected texture data. Type: Config. Returns: loaded_images: Loaded images. Type: dict. Returns: uv_scaling: Scaling factor of the UV map. Type: float. Returns: ambient_occlusion: Ambient occlusion color vector. Type: mathutils.Vector. Returns: displacement_strength: Strength of a plane’s displacement modifier. Type: float.
-
_set_textures
(ground_tile, images, uv_scaling, ambient_occlusion, displacement_strength)[source]¶ Sets available loaded images to a texture of a current processed ground tile.
Parameters: - ground_tile – Ground tile (plane). Type: bpy.types.Object.
- images – Loaded images of a chosen texture. Type: dict.
- uv_scaling – Scaling factor for the UV layer of the tile. Type: float.
-