载入中...
搜索中...
未找到
PbrMaterial.cpp
浏览该文件的文档.
49std::unique_ptr<PbrTextureSet> PbrRecipeRegistry::generate(const std::string &id, const Params ¶ms,
86 descriptor.params.push_back(ParamDescriptor::floating("roughnessLow", "Low Roughness", def.pbr.roughnessLow, 0.f, 1.f, 0.01f));
87 descriptor.params.push_back(ParamDescriptor::floating("roughnessHigh", "High Roughness", def.pbr.roughnessHigh, 0.f, 1.f, 0.01f));
88 descriptor.params.push_back(ParamDescriptor::floating("metallic", "Metallic", def.pbr.metallic, 0.f, 1.f, 0.01f));
89 descriptor.params.push_back(ParamDescriptor::floating("normalStrength", "Normal Strength", def.pbr.normalStrength, 0.01f, 32.f, 0.05f));
90 descriptor.params.push_back(ParamDescriptor::floating("aoStrength", "AO Strength", def.pbr.aoStrength, 0.f, 5.f, 0.05f));
91 descriptor.params.push_back(ParamDescriptor::floating("heightStrength", "Height Strength", def.pbr.heightStrength, 0.f, 16.f, 0.05f));
103 RecipeDescriptor::grid(std::string("pbr.everyday.") + names[i], names[i], "Everyday Material", 1, 1);
107 schema.params.push_back(ParamDescriptor::floating("scale", "Pattern Repeats", 4.f, 1.f, 32.f, 1.f));
108 schema.params.push_back(ParamDescriptor::floating("detail", "Surface Detail", .5f, 0.f, 1.f, .01f));
110 schema.params.push_back(ParamDescriptor::floating("variation", "Color Variation", .4f, 0.f, 1.f, .01f));
125std::unique_ptr<image::ImageData> grayscaleImage(const std::vector<float> &values, int w, int h) {
137std::unique_ptr<PbrTextureSet> generatePbrSet(const TextureRecipeDef &def, const Params ¶ms, std::string &error) {
162 paintHeightToImage(*set->albedo, def.colorField ? pigment : height, w, h, def.albedo, ctx.colors, ctx.pixelSize);
210 pbr.roughnessLow + (pbr.roughnessHigh - pbr.roughnessLow) * (def.roughnessField ? microfacet[i] : hh);
static eve::Result< std::unique_ptr< PbrTextureSet > > generate(EverydayMaterial family, const Params ¶ms)
Generate six aligned maps and optical surface metadata.
Definition EverydayMaterials.cpp:31
const RecipeDescriptor * descriptor(const std::string &id) const
Look up recipe metadata.
Definition PbrMaterial.cpp:59
static PbrRecipeRegistry & instance()
Access the process-wide PBR registry.
Definition PbrMaterial.cpp:28
bool applyDefaults(const std::string &id, Params ¶ms) const
Fill missing values from metadata.
Definition PbrMaterial.cpp:64
std::unique_ptr< PbrTextureSet > generate(const std::string &id, const Params ¶ms, std::string &error) const
Generates a PBR map set and transfers its unique ownership to the caller.
Definition PbrMaterial.cpp:49
void registerPbrRecipe(const std::string &id, PbrRecipeFn fn)
Register a recipe without metadata.
Definition PbrMaterial.cpp:33
Definition EvpackPointGraphLoader.h:12
void registerFloorPbrRecipes(PbrRecipeRegistry ®istry)
Register pbr.floor.wood and pbr.floor.tile with schema metadata.
Definition FloorTextures.cpp:1235
void registerCablePbrRecipes(PbrRecipeRegistry ®istry)
Register pbr.cable.steel / pbr.chain.iron / pbr.rope.hemp.
Definition CableTextures.cpp:467
void fillHeightField(const TextureGenContext &ctx, const std::function< float(float, float, const NoiseField &)> &fn, std::vector< float > &height)
Sample a height function over the full [w×h] grid into height (clamped to [0,1]).
Definition TextureRecipe.cpp:108
RecipeDescriptor makeTextureRecipeDescriptor(const TextureRecipeDef &definition)
Build editable metadata for a texture definition.
Definition TextureRecipe.cpp:88
std::unique_ptr< image::ImageData > grayscaleImage(const std::vector< float > &values, int w, int h)
Builds a grayscale RGBA8 image and returns unique ownership to the caller.
Definition PbrMaterial.cpp:125
const std::vector< TextureRecipeDef > & builtinTextureDefs()
All built-in texture definitions (albedo + PBR). Populated lazily.
Definition BuiltinTextures.cpp:1039
std::unique_ptr< PbrTextureSet > generatePbrSet(const TextureRecipeDef &def, const Params ¶ms, std::string &error)
Builds a full PBR set from a texture definition and returns unique ownership.
Definition PbrMaterial.cpp:137
void paintHeightToImage(image::ImageData &img, const std::vector< float > &height, int w, int h, const ColorRamp &ramp, int bands, int pixelSize)
Paint height to image.
Definition TextureRecipe.cpp:128
EverydayMaterial
Everyday surface families; no scene, GPU or registry state is retained.
Definition EverydayMaterials.h:7
std::unique_ptr< image::ImageData > heightToNormalImage(const std::vector< float > &height, int w, int h, float strength, bool seamless)
Builds a normal-map image and transfers its unique ownership to the caller.
Definition TextureRecipe.cpp:148
std::function< std::unique_ptr< PbrTextureSet >(const Params ¶ms, std::string &error)> PbrRecipeFn
Recipe returns a newly owned full PBR set, or null on failure.
Definition PbrMaterial.h:65
static ParamDescriptor floating(std::string key, std::string label, float defaultValue, float minimum, float maximum, float step)
Construct a bounded floating-point descriptor.
Definition ParamSchema.cpp:33
PBR surface defaults for a generated material. Every map in a PBR set is derived from the same displa...
Definition TextureRecipe.h:105
~PbrTextureSet()
Releases all generated maps when the owning set is destroyed.
Definition PbrMaterial.cpp:16
void destroy()
Deletes all maps and nulls the pointers (defined in PbrMaterial.cpp).
Definition PbrMaterial.cpp:18
Complete metadata and parameter schema shared by every procgen recipe family.
Definition ParamSchema.h:52
static RecipeDescriptor grid(std::string id, std::string displayName, std::string category, int minimumWidth, int minimumHeight, int maximumWidth=4096, int maximumHeight=4096)
Create a schema with common seed, width and height parameters.
Definition ParamSchema.cpp:73
void applyDefaults(Params ¶ms) const
Fill missing Params values from this schema.
Definition ParamSchema.cpp:91
static EVENGINE_API_DOMAINS TextureGenContext fromParams(const Params ¶ms)
From params.
Definition TextureRecipe.cpp:63
A procedural texture is described by an albedo ramp, displacement, optional independent PBR pigment f...
Definition TextureRecipe.h:122
std::function< float(float, float, const NoiseField &)> colorField
Optional pigment field, independent of physical relief; empty uses height.
Definition TextureRecipe.h:129
std::function< float(float, float, const NoiseField &)> roughnessField
Optional independent microfacet field, mapped through roughnessLow/High.
Definition TextureRecipe.h:131