|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Shinya Kitaoka |
810553 |
|
|
Toshihiro Shimizu |
890ddd |
/*------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
Iwa_MotionBlurCompFx
|
|
Toshihiro Shimizu |
890ddd |
露光量/オブジェクトの軌跡を考慮したモーションブラー
|
|
Toshihiro Shimizu |
890ddd |
背景との露光値合成を可能にする
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef IWA_MOTION_BLUR_COMP_H
|
|
Toshihiro Shimizu |
890ddd |
#define IWA_MOTION_BLUR_COMP_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tfxparam.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "stdfx.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "motionawarebasefx.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TStageObjectId;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
struct float2 {
|
|
Shinya Kitaoka |
120a6e |
float x, y;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
struct float3 {
|
|
Shinya Kitaoka |
120a6e |
float x, y, z;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
struct float4 {
|
|
Shinya Kitaoka |
120a6e |
float x, y, z, w;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
struct int2 {
|
|
Shinya Kitaoka |
120a6e |
int x, y;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*- m_premultiTypeの取る値 -*/
|
|
Toshihiro Shimizu |
890ddd |
enum PremultiTypes {
|
|
Shinya Kitaoka |
120a6e |
AUTO = 0,
|
|
Shinya Kitaoka |
120a6e |
SOURCE_IS_PREMULTIPLIED,
|
|
Shinya Kitaoka |
120a6e |
SOURCE_IS_NOT_PREMUTIPLIED
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class Iwa_MotionBlurCompFx : public MotionAwareBaseFx {
|
|
Shinya Kitaoka |
120a6e |
FX_PLUGIN_DECLARATION(Iwa_MotionBlurCompFx)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
protected:
|
|
Shinya Kitaoka |
120a6e |
TRasterFxPort m_input;
|
|
Shinya Kitaoka |
120a6e |
TRasterFxPort m_background;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_hardness; /*- フィルムのガンマ値 -*/
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*-- 左右をぼかすためのパラメータ --*/
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_startValue; /*- シャッター開け時のフィルタ値 -*/
|
|
Shinya Kitaoka |
120a6e |
/*- シャッター開け時〜現時点までのフィルタ値のガンマ補正値 -*/
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_startCurve;
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_endValue; /*- シャッター閉じ時のフィルタ値 -*/
|
|
Shinya Kitaoka |
120a6e |
/*- 現時点〜シャッター閉じ時までのフィルタ値のガンマ補正値 -*/
|
|
Shinya Kitaoka |
120a6e |
TDoubleParamP m_endCurve;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- 残像モードのトグル -*/
|
|
Shinya Kitaoka |
120a6e |
TBoolParamP m_zanzoMode;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
TIntEnumParamP m_premultiType;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- ソース画像を0〜1に正規化してホストメモリに読み込む
|
|
Shinya Kitaoka |
120a6e |
ソース画像がPremultipyされているか、コンボボックスで指定されていない場合は
|
|
Shinya Kitaoka |
120a6e |
ここで判定する -*/
|
|
Shinya Kitaoka |
120a6e |
template <typename pixel="" raster,="" typename=""></typename>
|
|
Shinya Kitaoka |
120a6e |
bool setSourceRaster(const RASTER srcRas, float4 *dstMem, TDimensionI dim,
|
|
Shinya Kitaoka |
120a6e |
PremultiTypes type = AUTO);
|
|
Shinya Kitaoka |
120a6e |
/*- 出力結果をChannel値に変換して格納 -*/
|
|
Shinya Kitaoka |
120a6e |
template <typename pixel="" raster,="" typename=""></typename>
|
|
Shinya Kitaoka |
120a6e |
void setOutputRaster(float4 *srcMem, const RASTER dstRas, TDimensionI dim,
|
|
Shinya Kitaoka |
120a6e |
int2 margin);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- フィルタをつくり、正規化する -*/
|
|
Shinya Kitaoka |
120a6e |
void makeMotionBlurFilter_CPU(float *filter_p, TDimensionI &filterDim,
|
|
Shinya Kitaoka |
120a6e |
int marginLeft, int marginBottom,
|
|
Shinya Kitaoka |
120a6e |
float4 *pointsTable, int pointAmount,
|
|
Shinya Kitaoka |
120a6e |
float startValue, float startCurve,
|
|
Shinya Kitaoka |
120a6e |
float endValue, float endCurve);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- 残像フィルタをつくり、正規化する -*/
|
|
Shinya Kitaoka |
120a6e |
void makeZanzoFilter_CPU(float *filter_p, TDimensionI &filterDim,
|
|
Shinya Kitaoka |
120a6e |
int marginLeft, int marginBottom,
|
|
Shinya Kitaoka |
120a6e |
float4 *pointsTable, int pointAmount,
|
|
Shinya Kitaoka |
120a6e |
float startValue, float startCurve, float endValue,
|
|
Shinya Kitaoka |
120a6e |
float endCurve);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- RGB値(0〜1)を露光値に変換 -*/
|
|
Shinya Kitaoka |
120a6e |
void convertRGBtoExposure_CPU(float4 *in_tile_p, TDimensionI &dim,
|
|
Shinya Kitaoka |
120a6e |
float hardness, bool sourceIsPremultiplied);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- 露光値をフィルタリングしてぼかす -*/
|
|
Shinya Kitaoka |
120a6e |
void applyBlurFilter_CPU(float4 *in_tile_p, float4 *out_tile_p,
|
|
Shinya Kitaoka |
120a6e |
TDimensionI &dim, float *filter_p,
|
|
Shinya Kitaoka |
120a6e |
TDimensionI &filterDim, int marginLeft,
|
|
Shinya Kitaoka |
120a6e |
int marginBottom, int marginRight, int marginTop,
|
|
Shinya Kitaoka |
120a6e |
TDimensionI &outDim);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- 露光値をdepremultipy→RGB値(0〜1)に戻す→premultiply -*/
|
|
Shinya Kitaoka |
120a6e |
void convertExposureToRGB_CPU(float4 *out_tile_p, TDimensionI &dim,
|
|
Shinya Kitaoka |
120a6e |
float hardness);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- 背景があり、前景が動かない場合、単純にOverする -*/
|
|
Shinya Kitaoka |
120a6e |
void composeWithNoMotion(TTile &tile, double frame,
|
|
Shinya Kitaoka |
120a6e |
const TRenderSettings &settings);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
/*- 背景を露光値にして通常合成 -*/
|
|
Shinya Kitaoka |
120a6e |
void composeBackgroundExposure_CPU(float4 *out_tile_p,
|
|
Shinya Kitaoka |
120a6e |
TDimensionI &enlargedDimIn,
|
|
Shinya Kitaoka |
120a6e |
int marginRight, int marginTop,
|
|
Shinya Kitaoka |
120a6e |
TTile &back_tile, TDimensionI &dimOut,
|
|
Shinya Kitaoka |
120a6e |
float hardness);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
Iwa_MotionBlurCompFx();
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
void doCompute(TTile &tile, double frame, const TRenderSettings &settings) override;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
void doCompute_CPU(TTile &tile, double frame, const TRenderSettings &settings,
|
|
Shinya Kitaoka |
120a6e |
float4 *pointsTable, int pointAmount, double hardness,
|
|
Shinya Kitaoka |
120a6e |
double shutterStart, double shutterEnd,
|
|
Shinya Kitaoka |
120a6e |
int traceResolution, float startValue, float startCurve,
|
|
Shinya Kitaoka |
120a6e |
float endValue, float endCurve, int marginLeft,
|
|
Shinya Kitaoka |
120a6e |
int marginRight, int marginTop, int marginBottom,
|
|
Shinya Kitaoka |
120a6e |
TDimensionI &enlargedDimIn, TTile &enlarge_tile,
|
|
Shinya Kitaoka |
120a6e |
TDimensionI &dimOut, TDimensionI &filterDim,
|
|
Shinya Kitaoka |
120a6e |
TTile &back_tile);
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
bool doGetBBox(double frame, TRectD &bBox, const TRenderSettings &info) override;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
473e70 |
bool canHandle(const TRenderSettings &info, double frame) override;
|
|
Shinya Kitaoka |
120a6e |
/*- 参考にしているオブジェクトが動いている可能性があるので、
|
|
Shinya Kitaoka |
120a6e |
エイリアスは毎フレーム変える -*/
|
|
Shinya Kitaoka |
473e70 |
std::string getAlias(double frame, const TRenderSettings &info) const override;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|