GoogleTranslate Reference
GoogleTranslate Reference
• The ease the constraints of drawing order of objects CONTROLOBJECT semantics references
• The special object name that can be specified in CONTROLOBJECT semantics Add "(self)"
○ Note
Semantics and annotations specification of development was the NVIDIA of SAS to reference.
http://developer.nvidia.com/object/using_sas.html
However, this is not intended to ensure that FX effect files for Composer operates.
**************************************************
1 technique and path
1.1 configuration
Effects files, such as, has a hierarchical structure by techniques and path.
/ ********************************** /
Parameter declaration 1
Parameter declaration 2
...
technique technique 1 {
pass path 1 {
VertexShader = ...
PixelShader = ...
pass pass 2 {
VertexShader = ...
PixelShader = ...
...
technique technique 2 {
pass path 1 {
VertexShader = ...
PixelShader = ...
pass pass 2 {
VertexShader = ...
PixelShader = ...
...
/ ********************************** /
The techniques and path, it is possible to describe a set value called the annotation.
Annotation, as follows, after the technique name, path name, describing so as to surround with "<" and
">".
/ ************************************************* ***** /
...
}
pass Pass2 {
...
/ ************************************************* ***** /
Moreover, the techniques and path, and a special annotation called Script
Describe one of the conditions to use the technique to draw any scene.
And drawing object (object body / shadow / outline / self-shadowing for Z-value plot)
And drawing flag (texture use ON / OFF, Sphere map use ON / OFF, toon rendering use ON / OFF)
For verification of conditions, to be performed in the order in which they are written to the effect file,
If the technique for this type does not exist on the effects file,
○ annotation
· String Subset
For PMD model, which corresponds to the model number of the material.
"0, 3, 5" as in, it is possible to enumerate the numbers separated by commas, can be specified multiple
numbers.
In addition, "6-10" as such, it is possible to connect a number by a hyphen, and can range specified.
"12" as in, if you specify only the starting number for the range, all of number of later becomes the
target.
· String MMDPass
Specify one of the following. This classification is derived from the procedure of drawing MMD.
· Bool UseTexture
The technique is, when it is intended for only a subset that uses texture specifies a true.
Conversely, if it is intended for only a subset that does not use texture, specify false.
· Bool UseSphereMap
As techniques, only the case of a target subset using the sphere mapping specifies true.
(In PMX model, including even if you specify a sub-texture to Sphere mode)
Conversely, if it is intended for only a subset that does not use the sphere map, specify false.
During the annotation is omitted, the presence or absence of sphere mapping is ignored.
Example: bool UseSphereMap = false;
· Bool UseToon
The technique is, in the case of interest the object (= PMD model) to use the toon rendering, I specify
the true.
Conversely, if it is intended for objects that do not use Cel shading (= accessory), specify false.
At the time of annotation omitted, the presence or absence of Cel shading use is ignored.
○ use cases
>{
...
}
technique Tech2 <
>{
...
>{
...
○ supplement
http://msdn.microsoft.com/ja-jp/library/bb206324(v=VS.85).aspx
· MMDPass = "object", in the technique other than "object_ss", UseTexture, UseSphereMap, UseToon
not function correctly.
**************************************************
Model Parameter name: Semantics name <type name annotation 1 = value; type name annotation 2 =
value; ...>;
Depending on the semantics, and some you do not specify the annotation.
The difference between the case of semantics name and the annotation name is ignored.
● WORLD
● VIEW
● PROJECTION
● WORLDVIEW
● VIEWPROJECTION
● WORLDVIEWPROJECTION
Transformation matrix to be used for coordinate transformation of the vertex.
The I represent.
Type float4x4.
As "WORLDINVERSE", when adding "INVERSE" to the end of the semantics, the inverse matrix of the
matrix is obtained.
Also, as in the "WORLDTRANSPOSE", when adding "TRANSPOSE" to the end, the transposed matrix of
the matrix is obtained.
In order to obtain the transposed matrix of the inverse matrix, adding "INVERSETRANSPOSE" at the end.
○ annotation
In view transformation and projection conversion, I will specify where or to the viewpoint.
"Camera" or "Light" can be specified. The default is "Camera".
Normally, in the case performs coordinate transformation that the viewpoint of the camera, I specify the
"Camera".
Z value plot, etc. for self-shadowing, when the source performs coordinate transformations and
viewpoint, I specify the "Light".
○ use cases
○ supplement
It is the matrix that obtained when you have specified the "Light" in · Object annotation,
Because it is in conjunction with the matrix you are using self-shadowing of MMD,
[Display (V)] - in the self-shadowing Display (P)], when fully would OFF the self-shadowing function,
● DIFFUSE
● AMBIENT
● EMISSIVE
● SPECULAR
● SPECULARPOWER
● TOONCOLOR
● EDGECOLOR
● GROUNDSHADOWCOLOR
The I represent.
Thun color, represent in Cel shading of PMD model, the shadow of color (specifically, toon ??. Bmp
lower left corner of the color of).
The color is composed of four components (red, green, blue, and alpha (transparency)). Alpha value is
omitted If you specify a float3 to type.
○ annotation
And light color, and specify whether to retrieve either the material color of the object.
The "SPECULARPOWER" and "EMISSIVE" and "TOONCOLOR", because there is no light color, "Light" can
not be specified.
○ use cases
○ supplement
· Outline color only in the Technique of MMDPass = "edge", can not be properly obtained.
-Ground shadow color only in the Technique of MMDPass = "shadow", can not be properly obtained.
Other each color value of, in the Technique of MMDPass = "zplot" or MMDPass = "edge", can not be
properly obtained.
● POSITION
● DIRECTION
Of light or camera, the position and orientation within the world space.
○ annotation
Specifies whether to acquire either the coordinates of the camera and light.
○ use cases
○ supplement
For · MMD of lights, is a directional light,
Position coordinates of the light, an infinite far point direction opposite to the direction of the light.
● MATERIALTEXTURE
○ annotation
None
○ use cases
texture = <ObjectTexture>;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = LINEAR;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
};
• Each color value, in the Technique of MMDPass = "zplot" or MMDPass = "edge", can not be properly
obtained.
● MATERIALSPHEREMAP
○ annotation
None
○ use cases
texture = <ObjectSphereMap>;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = LINEAR;
ADDRESSU = WRAP;
ADDRESSV = WRAP;
};
○ supplement
• Each color value, in the Technique of MMDPass = "zplot" or MMDPass = "edge", can not be properly
obtained.
● MATERIALTOONTEXTURE
○ annotation
None
○ use cases
texture = <ObjectSphereMap>;
MINFILTER = LINEAR;
MAGFILTER = LINEAR;
MIPFILTER = NONE;
ADDRESSU = CLAMP;
ADDRESSV = CLAMP;
};
○ supplement
• Each color value, in the Technique of MMDPass = "zplot" or MMDPass = "edge", can not be properly
obtained.
Moreover, when the accessory (for UseToon = false) is not correctly acquired.
· In PMD model, in the case of materials that do not use Thun, it is entirely white texture.
● ADDINGTEXTURE
● MULTIPLYINGTEXTURE
● ADDINGSPHERETEXTURE
● MULTIPLYINGSPHERETEXTURE
For PMX material morph, with respect to the texture of the texture and sphere mapping,
○ annotation
None
○ use cases
○ supplement
• Each value is only in the case of MMDPass = "object_ss", can not be properly obtained.
· In addition, (in the case of UseToon = false) case of accessories, all adding value is 0, become all
multiplication value is 1.
2.3 screen information
● VIEWPORTPIXELSIZE
※ This value refers to the size of the screen or off-screen render target of MMD.
○ annotation
None
○ use cases
○ supplement
2.4 hours
● TIME
● ELAPSEDTIME
Time information.
For example, the 0-th frame, 0.0 (seconds), and the 1.5 (sec) in 45 th frame.
For example, when the AVI output at 60fps, the value of "ELAPSEDTIME", it becomes constant at 1/60.
○ annotation
Even if MMD is in edit mode, you specify whether to work with the frame.
Since MMD is at the edit mode, the reproduction of the frame is stopped,
When the value of TIME is always in conjunction with the frame time,
Editing mode, the value of TIME and ELAPSEDTIME, not the frame time is the system time is used.
As a result, the animation will not stop even during the editing mode.
○ use cases
○ supplement
· SyncInEditMode = If true, the value of ELAPSEDTIME is, by the frame move operation on the MMD, can
be a 0 or negative.
2.5 mouse
● MOUSEPOSITION
Type float2.
The center of the drawing area of the MMD is a (0,0), the lower left corner (-1, -1), made in the upper
right corner is (1,1).
How to take this xy coordinates, after the projection transformation, is the same as the vertex
coordinates.
○ annotation
None
○ use cases
● MIDDLEMOUSEDOWN
● RIGHTMOUSEDOWN
Type float4.
· Finally the mouse when the button is pressed in the coordinates (x and y)
- Finally TIME value at the time the button is pressed (in seconds)
In addition, how to take the mouse coordinates, is the same as the MOUSEPOSITION.
○ annotation
None
○ use cases
● CONTROLOBJECT
Of the specified object, I get the coordinates and world transformation matrix.
Mainly, to be used if you want to control the parameters necessary to the shader from the MMD.
· Bool
· Float
· Float3, float4
· Float4x4
○ annotation
Can be an off-screen of the owner of the object to the target (in the case of during the off-screen
rendering only).
Bone names: I get the coordinates or world transformation matrix of the specified bone of PMD model.
Expression name: I get the value of the specified expression of PMD model. Type float.
"Si": the size of the accessory (Si accessories panel). Type float. (※ 2)
※ 2 resulting values are those where the value of the panel 10 times.
○ use cases
float3 pos: CONTROLOBJECT <string name = "Haku Yowane .pmd"; string item = "Ponite IK";>;
○ supplement
· For world transformation matrix of PMD model does not change in the identity matrix,
Scaling value of accessories, made the value specified in the Size of the accessory on the MMD to 10
times the value.
(Internally, I have been using the value obtained by the length (world_matrix._11_12_13))
• If the object of the specified file name does not exist, the following values are set.
Scaling value: 10
Special item: 0
Scaling value: 1
Expression values: 0
-Than MME ver0.20, even if the referenced object has not been drawn in the later than the reference
the original object,
(1) See the original in the drawing order is earlier than the object, and most drawing order is close.
- Such as the dummy bone .pmd, for objects that do not have even one vertex,
● Normal texture
I generate texture.
The contents of the generated texture, upon setting the sampler, can refer by calling like tex2D (s, t)
function.
○ annotation
· String ResourceType
I will specify the type of texture. "2D", "3D", to specify one of the "CUBE".
· String ResourceName
Supported file formats, bmp, .dds, .dib, .jpg, .png, and a .tga.
If you specify a file name with a relative path, the folder where the effect file is stored is the reference.
· Int Width
· Int Height
· Int Depth
In addition, if ResourceName is specified, the size from the image file is automatically retrieved.
· Float2 ViewportRatio
Texture of width, the height, I specify the ratio of the screen size of the render target.
To generate the texture of the same size as the screen, "float2 ViewportRatio = {1.0, 1.0};" and is
specified.
To generate the texture of the screen vertically and horizontally twice the size of, "float2 ViewportRatio
= {2.0, 2.0};" and is specified.
Dimensions, Width, Height, can not be specified at the same time and Depth.
· String Format
See.
· Int Miplevels
· Int Levels
It is an alias of Miplevels.
○ use cases
texture = <negi_tex>;
};
int Miplevels = 1;
>;
● RENDERCOLORTARGET
Texture that was generated by specifying the semantics, the script of RenderColorTarget
Can be specified.
After rendering, as well as the normal texture, I can see the contents in tex2D () function.
○ annotation
· Int2 Dimensions
· Float2 ViewportRatio
· String Format
· Int Miplevels
· Int Levels
1 or 0 is I can be specified.
○ use cases
texture2D ScnMap: RENDERCOLORTARGET <
int MipLevels = 1;
>;
texture = <ScnMap>;
};
...
● RENDERDEPTHSTENCILTARGET
Texture that was generated by specifying the semantics, the script of RenderDepthStencilTarget
Can be specified.
· Float2 ViewportRatio
· String Format
○ use cases
>;
...
● ANIMATEDTEXTURE
I to generate the animation texture.
Such as a control object can also be animated in conjunction with another parameter.
○ annotation
Made to the texture of the original, I specify the animation image files.
Supported file formats are .gif (animated GIF) and .png (APNG).
For example, specifying a 2.5, it is possible to delay the animation start 2.5 seconds.
For example, if you specify the 2.0, the speed of the animation is doubled.
If you specify the name of the parameter, in conjunction with the change in the value of the parameter,
animation is performed.
By default, it is animation in conjunction with the frame time (TIME <SyncInEditMode = true>).
○ use cases
To animate in conjunction with the changes in the Size of the // object seek.x
>;
○ supplement
• If the animation is the fps to request, was lower than the fps of MMD of drawing, dropped frames
occur.
For APNG ·, huge animation files of GByte unit also (once) can be played.
● OFFSCREENRENDERTARGET
Automatically, drawing of all objects in the specified conditions, come to be performed on the render
target.
Rendering results, as well as the normal texture I can be referenced in tex2D () function.
○ annotation
· Int2 Dimensions
· Float2 ViewportRatio
· String Format
· Int Miplevels
· Int Levels
1 or 0 is I can be specified.
· Float4 ClearColor
With the color specified here, rendering the target is automatically cleared.
· Float ClearDepth
· Bool AntiAlias
· String Description
String that you specify here is displayed on the GUI dialog effects assignment.
· String DefaultEffect
To specify the allocation method of the effect file to be used in the off-screen rendering.
If multiple times described are compared object file name in the order described, that the first match is
employed.
The object file name "*" and "?" Wildcard is I can be specified by.
I represent the object itself the effect is assigned with this OFFSCREENRENDERTARGET.
If you specify a file name with a relative path to the effect file name,
Folder in which the reference source of the effect file is stored is the reference.
In addition, as a special effect file name "none" and "hide" can be specified,
Also, if you specify the "main_default", is the same as the default behavior of the main screen,
Automatic assignment of fx files and emd file based on the object file path is performed.
○ use cases
string DefaultEffect =
"self = hide;"
"Mirror * .x = hide;"
"* = MirrorObject.fx;";
>;
● TEXTUREVALUE
Of the specified texture, to be stored in the array to get the texel information.
If you use this, even in an environment that does not correspond to the VTF (Vertex Texture Fetching),
You can see from the vertex shader texture value (※ There limit. See Supplement)
○ annotation
○ use cases
>;
○ supplement
• In order to pass the value in the constant register, texel number you can see the limit is about 200.
- If the size of the array does not match the size of the texture, there is no guarantee that the correct
value can be obtained.
In some environments, only it is not possible to create a power of 2 sizes of the texture,
Note also specify the size of the other, so automatically have the size is created is expanded.
And acquisition of values from the texture, is done at the start of the frame.
Therefore, updating the texture of the object in the middle, and the value is not updated until the next
frame.
● STANDARDSGLOBAL
In addition, it is also used to describe the annotation for the entire effect file.
The parameter name "Script", type that you specify the 0.8 version number float, as the value.
○ annotation
· String ScriptOutput (optional)
"color" than the value can not be specified. The default value is also this value.
I specify the purpose (what effect that drawing) of the effect file.
Basically, in the normal effects of objects for drawing, specify the "object",
If you specify the "object", is not to be running Draw = Buffer in the path of the script.
"postprocess": I draw after the drawing of the object. For post effects.
To be exact ※, to further before the preprocess, from the beginning of the script of the pre-processing
(technique of postprocess
Typically, in the order listed in the effect file available technique is retrieved (1.2) is
○ use cases
> = 0.8;
> = 0.8;
Self-shadowing flag.
○ use cases
bool parthf;
bool use_texture;
bool use_toon;
int VertexCount;
○ supplement
· MMDPass = "object", if other than "object_ss", there is no guarantee that the correct values for these
parameters are set.
● _INDEX
In the vertex shader, and semantics for obtaining the index value of the vertex.
I can be used in the input parameters of the vertex shader. Type int.
○ use cases
VS_OUTPUT Basic_VS (float4 Pos: POSITION, int index: _INDEX) {
VS_OUTPUT Out;
return Out;
○ supplement
· Because you are once converted to a float type in the process of passing the vertex shader,
If the index value exceeds 2 ^ 24 = 16777216, it is not possible to get the exact value.
2.10 macro
● MME_MIPMAP
○ use cases
texture = <ObjectTexture>;
#ifdef MME_MIPMAP
MIPFILTER = LINEAR;
#endif
};
○ supplement
**************************************************
3 script
The techniques and path, it is possible to specify a special annotation called script.
As long as no special processing such as post-effects usually specified script is not required.
If you omit the technique of script, simply path techniques are executed in the order.
Also, RenderColorTarget1 ~ 3 can not be used alone and must be used in a set RenderColorTarget0.
The argument, I want to specify the name of the texture parameters that are declared in
RENDERCOLORTARGET semantics.
If you want to reset to the default rendering target, specify the blank.
Note that render target set, unless run these command again,
The argument, I want to specify the name of the texture parameters that are declared in
RENDERDEPTHSTENCILTARGET semantics.
If you want to reset to the default depth stencil surface, specify the blank.
I set the color to clear the render target. (Not yet clear)
The argument, I want to specify the name of the float4 type of parameters.
The value set in this parameter, the color to clear the render target.
I set the Z value to clear the depth stencil surface. (Not yet clear)
The argument, I specify the name of the float type of the parameter.
The value set in this parameter, the Z value to clear the depth stencil surface.
· Clear = Color
· Clear = Depth
I clear the depth stencil surface.
· ScriptExternal = Color
This command can not be used only on the technique of the script.
Typically, the post-effects, it did on set texture for input to the render target,
In this, when to render the other objects, and to execute the command.
The post-effects, on the technique of the script, it must be always performed only one time.
This command can not be used only on the technique of the script.
· LoopEnd =
This command can not be used only on the technique of the script.
The argument, numeric (int, bool, float) I specify the name of the parameter of.
Only the number of times of the value set in this parameter, the command string in from LoopByCount
to LoopEnd
Is repeatedly executed.
/ **************************** /
int Count = 3;
string Script =
"LoopByCount = Count;"
"Pass = p0;"
"LoopEnd =;"
"Pass = p1;";
>{
/ **************************** /
The value of the loop counter in the loop is set to the specified parameters.
This command can not be used only between from LoopByCount to LoopEnd.
· Draw = Geometry
This command can not be used only on the path of the script.
· Draw = Buffer
Of size that matches the render target of the screen, I draw a rectangular polygon.
This command can not be used only on the path of the script.
Not supported.
○ use cases
/ * Two string representation ("~" "~") If there is only blank characters between,
string Script =
"RenderColorTarget0 = RenderTarget;"
"RenderDepthStencilTarget = DepthBuffer;"
"ClearSetColor = ClearColor;"
"ClearSetDepth = ClearDepth;"
"Clear = Color;"
"Clear = Depth;"
"ScriptExternal = color;"
"Pass = P0;";
>{
...
}
**************************************************
4 Tips
If you want to use the MMD standard shaders in the other drawing,
The scene of the techniques that you want to use the MMD standard shader, it may have to describe the
effect file.
/ ************************************************* *********** /
* Than the object drawing (at the time of self-shadowing ON) is drawn in MMD standard shader /
pass Pass1 {
...
pass Pass2 {
...
/ ************************************************* *********** /
In addition, because the default shader path is the shader of MMD standard,
As follows, If you do not set the VertexShader and PixelShader of path,
/ ************************************************* *********** /
pass Pass1 {
// VertexShader = xxx
// PixelShader = xxx
/ ************************************************* *********** /
● empty technique
As follows, empty the technique is not performed at all the drawing in that technique.
/ ************************************************* ******** /
/ ************************************************* ******** /
The ON / OFF the path in the presence of an object ●
When you write a script as follows, only while the display of a particular object is ON
/ ************************************************* ******** /
string Script =
"LoopByCount = flag;"
"Pass = Pass1;"
"LoopEnd =;"
>{
pass Pass1 {
...
/ ************************************************* ******** /
It is possible to share the parameters of the same name across the effect file.
Moreover, not only the name, the type name and semantics must also match.
int MipLevels = 1;
>;
/ ******************************************** /
/ ******************************************** /
● if statement
If you want to draw in high speed, when you are writing a shader, the conditional branch like as much as
possible if statement
by referring to the use_texture parameters, rather than conditional branch in the if statement in the
shader,
In that there is no subset a subset texture there, more can be drawn as fast you would divide the
technique itself.
● uniform keyword
Specifying a "uniform" keyword argument of the function declaration, it is possible to give the value of
the argument as a compile-time constant.
In the following example, the if statement in the Basic_PS () is removed at compile time,
/ ************************************************* ****************** /
if (useTexture) {
...
technique TechWithTex {
pass P1 {
...
technique TechWithoutTex {
pass P1 {
...
/ ************************************************* ****************** /
Basically, in a non-comment portion, it is not recommended that you use the Japanese characters in the
effect file.
Dare If used, it can be noted the character code.
Such as object name of the path and the control object of image file for the texture generation,
If you want to use the Japanese to specify the file name, the character code of the effect file
● Post Effects
> = 0.8;
Also, in a typical post-effects, i performs the following processing in the script techniques.
Script example:
"RenderColorTarget0 = (RENDERCOLORTARGET texture);"
"Clear = Color;"
"Clear = Depth;"
In this case, drawing results are stored in a texture that is specified in (1).
Script example:
"ScriptExternal = Color;"
(3) render target was returned to the original, as input texture rendering result, and executes the path.
Script example:
"RenderColorTarget0 =;"
"RenderDepthStencilTarget =;"