文字列をオブジェクトとして扱うには、英語の場合であれば text オブジェクトが利用できます。
textオブジェクトは次のような形式で記述します。
object { text { ttf "フォントファイル名", "作成する文字列", 文字の厚さ, 0 } texture { ... } }
string1.pov |
#include "colors.inc" #include "shapes.inc" #include "stones.inc" #include "komuro.inc" camera { location <5,5,-10> look_at <0,0,0> angle 20 } light_source { <0,10,-10> color White } object { text { ttf "crystal.ttf", "abc", 1, 0 } texture { T_Stone12 } } object { XYZaxis } |
利用できるフォントファイル(*.ttf)は、以下の3種類のフォルダにあるものです。
公式版のPOVRayでは、日本語TrueTypeフォントを利用した立体文字列オブジェクトを 作ることはできません。(改良版POVRayを利用すると可能です。)
ここでは、どのPOVRayでも通用する「2次元の図として表現した日本語文字列を立体にする」方法で日本語文字列を表示してみます。
何かのお絵書きソフトを使って、文字の部分が白、他の部分が黒の図を作ります。 ここではWindows付属の「Paint」を使って以下のような 320x320 の図 nihongo.png を作りました。
string2.pov |
#include "colors.inc" #include "shapes.inc" #include "stones.inc" #include "komuro.inc" camera { location <5,5,-10> look_at <0,0,0> angle 20 } light_source { <0,10,-10> color White } object { height_field { png "nihongo.png" } texture { T_Stone12 } } object { XYZaxis } |
string2b.povへの変更 |
*** string2.pov Wed Oct 7 09:21:30 2020 --- string2b.pov Wed Oct 7 09:21:30 2020 *************** *** 12,20 **** light_source { <0,10,-10> color White } ! object { ! height_field { png "nihongo.png" } ! texture { T_Stone12 } } object { XYZaxis } \ No newline at end of file --- 12,26 ---- light_source { <0,10,-10> color White } ! difference { ! object { ! height_field { png "nihongo.png" } ! texture { T_Stone12 } ! } ! object { ! Plane_XZ ! translate <0, 0.2, 0> ! } } object { XYZaxis } \ No newline at end of file |
string2d.povへの変更 |
*** string2c.pov Wed Oct 7 09:21:30 2020 --- string2d.pov Wed Oct 7 09:21:30 2020 *************** *** 21,26 **** --- 21,27 ---- Plane_XZ translate <0, 0.2, 0> } + scale <2, 0.2, 2> rotate <-90, 0, 0> } |