13#include "Fg3dMeshIo.hpp"
15#include "FgVolume.hpp"
29typedef Svec<Scm3Mode> Scm3Modes;
37Scm3SA loadEgt(String8
const & egtFile);
38Img2F loadFim(String8
const & fimFile);
41 Scm3Modes
const & modes,
42 Floats
const & coeffs);
45 ImgRgba8
const & scmMean,
47 float outInvGamma=2.2,
48 bool multithread=
true);
52 ImgRgba8
const & genericMap,
53 ImgRgba8
const & facegenMap,
54 ImgUC
const & sampleRegion);
56ImgRgba8 applyColorFac(ImgRgba8
const & genericMap,Arr3D colorFac);
62 ImgRgba8
const & genericFaceMap,
63 ImgRgba8
const & facegenFaceMap,
65 ImgUC
const & transitionMap);
67ImgRgba8 applyColorShift(ImgRgba8
const & customBodyMap,Arr3D shift);
70ImgRgba8 applyOverlay(ImgRgba8
const & base,ImgRgba8
const & overlay);
95 static inline float gammaDefault() {
return 2.2f; }
99 Scm3(String8
const & dirBase,String8
const & overlayColor=
"");
101 String8
const & imgFile,
102 String8
const & egtFile,
103 String8
const & fimFile);
105 ImgRgba8
const & meanClr,
106 String8
const & egtFile,
107 String8
const & fimFile);
116 bool multithread=
true)
121 ImgV3F accDelta = scmMac(
modes,faceCoord.ts(1,0));
122 return scmAdd(
mean,accDelta,
gamma,multithread);
130 float detailModulation=1.0f,
132 bool multithread=
true)
143 Bytes
const & detailJpegBlob,
144 bool multithread=
true)
const;
149 Floats
const & ColorCoordS,
151 ImgRgba8
const & transformedDetail,
154 float detailModulation=1.0f,
155 bool multithread=
true)
158typedef Svec<Scm3> Scm3s;
161ImgUC getSkinSampleRegion(Img2F
const & detailXfm);
165inline ImgRgba8 customizeBase(
166 ImgRgba8
const & facegenBase,
167 ImgRgba8
const & customBase,
168 ImgUC
const & transition,
171 return imgBlend(facegenBase,applyColorShift(customBase,colorShift),transition);
175Volume<Arr3F> loadEgtScm4(String8
const & egtFile,
size_t padZero=0);
178void multAcc_(Volume<Arr3F>
const & modes,Floats
const & coeffs,Img3F & acc);
180Img3F multAcc(Volume<Arr3F>
const & modes,Floats
const & coeffs);
187 ScbLpp(String8
const & dirBase);
189 size_t numModes()
const {
return modes.dims()[0]; }
190 Vec2UI dims()
const {
return base.dims(); }
191 inline Img3F apply(Floats
const & coord)
const {
return base + multAcc(modes,coord); }
192 ImgRgba8 apply(Floats
const & coord,
float gamma)
const;
198void cmdScm3Base(CLArgs
const &);
Bytes detail
JPEG-encoded detail modulation in internal UV layout.
Sam3Coord coord
Coordinate of this face in 'face space'.
FaceGen face space coordinate.
FaceGen 3 Statistical Color Model for a UV map:
ImgRgba8 calcScmColorMap(Sam3Coord const &faceCoord, bool multithread=true) const
Compute the SCM color map without any detail texture, custom base or overlay:
ImgRgba8 transformDetail(Bytes const &detailJpegBlob, bool multithread=true) const
ImgRgba8 applyFace(Face3 const &face, float detailModulation=1.0f, bool multithread=true) const
Returns the final color map image for the given face:
float gamma
Desired inverse gamma value for output color maps:
ImgRgba8 applyFaceCoord(Floats const &ColorCoordS, ImgRgba8 const &transformedDetail, float detailModulation=1.0f, bool multithread=true) const
Returns the final color map for the given face coordinate and optional transformed detail texture:
Scm3Modes modes
SCM modes (symmetric only) encoded with gamma=1/2.6. Size is power of 2. Can be empty.