ImRadiosity v 0.2 【Shader 3 and after】 (ImSSAO) 【promise】 Allow redistribution of use / redistribution / remodeling / remodeling. Since I can not do any guarantee, please use at your own risk. 【Overview】 It is a counterfeit product of Radiosity and SSAO, I feel that I lost quality and made it lighter. ImRadiosity draws shading and shades that color shifts. ImSSAO puts a shadow on the recessed part. Basically adjusted for indoor use. Since my work SSRadiosity is so heavy, I substituted Radiosity calculation with depth blur and normal blur. There are some somewhat strange places where reflection and shadow appear, but it became considerably lighter. For depth blur algorithm, I referred to PowerBlur of wire P. 【How to use】 Please read ImRadiosity.x or ImSSAO.x. X: Brightness of the environment (-1 to +1) Valid only with ImRadiosity It is the boundary value of reflection and shade. The brighter part will shine, the darker parts will be shade behind. Because the audience seats are dark at the stage, about -0.3 Because the sky is bright outside, is it about + 0.5? Y: Depth blur intensity It is the rough shade and intensity of the shining area. Shade the dented areas. If you make it bigger and weaker It becomes strong if it increases with plus It is doubled by +1 and tripled by + 2. Z: normal blur intensity It is the intensity of fine shade and reflection area. Here, not only the dent but also shadows appear in the convex part. If you make it bigger and weaker It becomes strong if it increases with plus It is doubled by +1 and tripled by + 2. Si: blur amount It is the reach of shadows and shadows. Tr: degree of synthesis with the original image Lowering Tr makes it close to the original image. 【Rewrite】 I will take ImRadiosity.fx as an example, but this is the same for ImSSAO.fx. (It is only the difference of default drawing mode.) *** Near line 20 *** ////////////////////////////////////////////////////////////// // mode #define View_ImRadiosity 0 // shaded / shaded addition #define View_ImSSAO 1 // SSAO type implicit addition #define View_ShadeOnly 2 / / Display only shade for debugging #define View_RadioOnly 3 / / color transfer blur for debugging display #define View_ShadeRadio 4 // Only for color transfer for debugging #define View_Result View_ImRadiosity This is the drawing mode. For example, if you rewrite the last part like this, it becomes ImSSAO. #define View_Result View_ImSSAO Below is a description of setting. View_ImRadiosity This is the rendering of ImRadiosity. View_ImSSAO This is the drawing of ImSSAO. View_ShadeOnly Draws only shadows in ImSSAO. Reflection is also limited to this range. View_RadioOnly ImRadiosity is shining or shadow color drawing. View_ShadeRadio This part is calculated as secondary radiation by ImRadiosity. *** Near line 31 *** static const float DefaultSi = 8.0; // default size (adjustment value when Si = 1) static const float DefaultAmbient = 0.65; // default environment brightness (adjustment value when X = 0) static const float DefaultDepthStrength = 16; // default intensity blur intensity (adjusted value when Y = 0) static const float DefaultNormalStrength = 1; // Default normal blur intensity (adjustment value when Z = 0) It is a numeric value of default value. It is a setting on how internally the default values ??(1 and 0) of Si, X, Y, Z numerical values ??are internally. It would be easier to set Si, X, Y, Z than setting it here. *** Near line 36 *** int BlurDetail = 3; // Size of +1 for every power of 8 It is the number of blurring. Stripe avoidance when increasing the blur amount. Approximately size 2 should be 3. After that, about +1 is required every 8 times. *** Line 38 *** #define EnhanceRound 1.1 // Depth blur Screen end Extension area size 1 or more Expansion of the screen to alleviate the inability to perform blur calculation at the screen edge. If you enlarge it, it will eat more memory, but the end of the screen may be slightly better . 1 is the size of the original screen. *** Near line 40 *** const float MinimumGap < string UIName = "Estimated depth"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float (0.1); float UIMin = 0.0; float UIMax = 1.0; > = 0.15; An estimate of how far invisible behind the model and so on is going on. It becomes the ratio with the distance from the camera. *** Line 50 (ImRadiosity only valid) *** float DDStrength < string UIName = "color transfer direction intensity"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float (50); float UIMin = 1.0; float UIMax = 100.0; > = 20; It is the strength of direction judgment to transfer color. If you decrease the intensity of the depth blur or normal blur, you need to make it larger. If it is enlarged, the color of distant tends to change color easily. *** Near line 60 (ImRadiosity only) *** const float AmbientColorRate < string UIName = "environment color mixing ratio"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float (0.5); float UIMin = 0.0; float UIMax = 1.0; > = 0.2; This is the ratio of how much the color you set as the ambient brightness is mixed when you move color. When color shifting, if you are too vivid, make it big. It is also an amount to add shade and reflection to perfect white and black. *** Near line 70 **** const float NormalBlurRangeRate < string UIName = "Normal blur range rate"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float (0.25); float UIMin = 0.0; float UIMax = 1.0; > = 0.25; Normal blur is for expressing small details. It is a setting of how much ratio of the normal blur to the depth blur. *** Near line 80 (ImSSAO only valid) *** const float SsaoBlackRate < string UIName = "SSAO black mixing ratio"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float (0.2); float UIMin = 0.0; float UIMax = 1.0; > = 0.2; It is a numerical value about how much black is mixed at ImSSAO. If you do not blend them at all, the color of the shadows is too vivid, so mix them somewhat. ** Line 62 (ImRadiosity) Line 35 (ImSSAO) ** ////////////////////////////////////////////////////////////// // for debugging #define View_ImRadiosity 0 #define View_ImSSAO 1 #define View_ShadeOnly 2 #define View_RadioOnly 3 #define View_ShadeRadio 4 #define View_Result View_ImRadiosity It is a drawing selection for debugging. The drawing changes depending on which one is set in View_Result. View_ImRadiosity This is the rendering of ImRadiosity. View_ImSSAO This is the drawing of ImSSAO. View_ShadeOnly Draws only shadows in ImSSAO. Reflection is also limited to this range. View_RadioOnly ImRadiosity is shining or shadow color drawing. View_ShadeRadio This part is calculated as secondary radiation by ImRadiosity. 【History】 2012.11.04 v0.2 Integrating ImRadiosity and ImSSAO ????????????????Add normal blur to shade calculation ????????????????Parameter arrangement, adjustment, etc. 2012.10.28 v0.1 First edition released Elle / data P ------------------- ImRadiosity v0.2【シェーダ3以降】 (ImSSAO) 【お約束】 使用・再配布・改造・改造物の再配布を許可します。 一切の保証は致しかねますので、ご自身の責任においてお使いください。 【概要】 RadiosityとSSAOの模造品で、品質を落として軽くした感じです。 ImRadiosityは、色移りする照り返しと陰を描画します。 ImSSAOは、凹んだところに影をつけます。 基本的に室内用として調整しています。 拙作SSRadiosityが、あまりに重いので、Radiosity計算を深度ブラーと法線ブラーで代用しました。 照り返しや陰の出る位置が多少おかしいところもありますが、かなり軽くなりました。 深度ブラーのアルゴリズムは、針金PのPowerBlurを参考にさせて頂きました。 【使い方】 ImRadiosity.xやImSSAO.xを読み込んでください。 X : 環境の明るさ (-1〜+1) ImRadiosityでのみ有効 照り返しと陰の境界値です。 これより明るいところが照り返し、暗いところが陰になります。 ステージでは客席が暗いことから、-0.3ぐらい 屋外では空が明るいことから、+0.5ぐらいでしょうか。 Y : 深度ブラー強度 大雑把な陰と照り返し領域の強度です。 凹んだところに陰をつけます。 マイナスで大きくすると弱く プラスで大きくすると強くなります +1で2倍、+2で3倍となります。 Z : 法線ブラー強度 細かい陰と照り返し領域の強度です。 こちらは、凹んだところだけでなく、凸のところにも陰が出ます。 マイナスで大きくすると弱く プラスで大きくすると強くなります +1で2倍、+2で3倍となります。 Si : ぼかし量 照り返しや陰の届く範囲です。 Tr : 元画像との合成度合い Trを下げると元画像に近くなります。 【書き換え】 ImRadiosity.fxを例に取りますが、ImSSAO.fxでも同様です。 (デフォルトの描画モードの違いだけです。) *** 20行目近辺 *** /////////////////////////////// // モード #define View_ImRadiosity 0 // 色移り付き 照り返し/陰 付加 #define View_ImSSAO 1 // SSAOタイプ 陰付加 #define View_ShadeOnly 2 // デバッグ用 陰のみ表示 #define View_RadioOnly 3 // デバッグ用 色移りブラー表示 #define View_ShadeRadio 4 // デバッグ用 色移りのみ表示 #define View_Result View_ImRadiosity 描画モードです。 例えば、最後のところを、このように書き換えると、ImSSAOになります。 #define View_Result View_ImSSAO 以下、設定の説明です。 View_ImRadiosity ImRadiosityの描画です。 View_ImSSAO ImSSAOの描画です。 View_ShadeOnly ImSSAOでの陰の部分だけ描画します。照り返しもこの範囲のみです。 View_RadioOnly ImRadiosityで照り返したり陰の色の描画です。 View_ShadeRadio ImRadiosityで2次放射光として計算される部分です。 *** 31行目近辺 *** static const float DefaultSi = 8.0; // デフォルトのサイズ (Si=1の時の調整値) static const float DefaultAmbient = 0.65; // デフォルトの環境明度 (X=0の時の調整値) static const float DefaultDepthStrength = 16; // デフォルトの深度ブラーの強度 (Y=0の時の調整値) static const float DefaultNormalStrength = 1; // デフォルトの法線ブラーの強度 (Z=0の時の調整値) デフォルト値の数値です。 Si,X,Y,Zの各数値のデフォルト値(1や0)が、内部的にはどのぐらいの数値になっているかという設定です。 ここを設定するより、Si,X,Y,Zを設定したほうが楽でしょう。 *** 36行目近辺 *** int BlurDetail = 3; // サイズが8の累乗毎に +1 ぼかし回数です。ぼかし量を大きくした時の縞々回避。 大体サイズ2ぐらいまでは3で良いでしょう。 あとは、8倍毎に+1程度が必要です。 *** 38行目 *** #define EnhanceRound 1.1 // 深度ブラー 画面端拡張領域サイズ 1以上 画面端でブラー計算ができなくなるのを軽減するための画面拡張。 大きくすると、メモリを食い重くなりますが、画面端がちょっとマシになるかも 。 1が元画面の大きさです。 *** 40行目近辺 *** const float MinimumGap < string UIName = "奥行きの推定値"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float(0.1); float UIMin = 0.0; float UIMax = 1.0; > = 0.15; モデルなどの後ろの見えないところが、どこまで続いているのかの推定値。 カメラからの距離との割合になります。 *** 50行目(ImRadiosityのみ有効) *** float DDStrength < string UIName = "色移り方向強度"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float(50); float UIMin = 1.0; float UIMax = 100.0; > = 20; 色移りする方向判定の強度です。 深度ブラーや法線ブラーの強度を小さくすると、逆に大きくする必要があります。 大きくすると、遠くの色が色移りしやすくなります。 *** 60行目近辺(ImRadiosityのみ有効) *** const float AmbientColorRate < string UIName = "環境色混合率"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float(0.5); float UIMin = 0.0; float UIMax = 1.0; > = 0.2; 色移りする時周囲の明るさとして設定した色をどのぐらい混ぜるかという比率です。 色移りする時、鮮やか過ぎるという場合に大きくします。 また、完全な白や黒に陰や照り返しを付ける量でもあります。 *** 70行目近辺 **** const float NormalBlurRangeRate < string UIName = "法線ブラー範囲率"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float(0.25); float UIMin = 0.0; float UIMax = 1.0; > = 0.25; 法線ブラーは細かいところを表現するためのものです。 その法線ブラーを、深度ブラーに対してどのくらいの比率で細かくするかという設定です。 *** 80行目近辺(ImSSAOのみ有効) *** const float SsaoBlackRate < string UIName = "SSAO黒混ぜ率"; string UIWidget = "Slider"; bool UIVisible = true; float UIDefault = float(0.2); float UIMin = 0.0; float UIMax = 1.0; > = 0.2; ImSSAO時に、どのくらい黒を混ぜるかという数値です。 全く混ぜないと、影の色が鮮やか過ぎるので、多少混ぜます。 ** 62行目(ImRadiosity) 35行目(ImSSAO) ** /////////////////////////////// // デバッグ用 #define View_ImRadiosity 0 #define View_ImSSAO 1 #define View_ShadeOnly 2 #define View_RadioOnly 3 #define View_ShadeRadio 4 #define View_Result View_ImRadiosity デバッグ用の描画選択です。 View_Resultに、どれを設定するかで描画が変わります。 View_ImRadiosity ImRadiosityの描画です。 View_ImSSAO ImSSAOの描画です。 View_ShadeOnly ImSSAOでの陰の部分だけ描画します。照り返しもこの範囲のみです。 View_RadioOnly ImRadiosityで照り返したり陰の色の描画です。 View_ShadeRadio ImRadiosityで2次放射光として計算される部分です。 【履歴】 2012.11.04 v0.2 ImRadiosityとImSSAOを統合 陰の計算に法線ブラーを追加 パラメータの整理、調整など 2012.10.28 v0.1 初版公開 Elle/データP