Адаптирую шейдер для квеста, наткнулся на это:
1)--------------------------------
float4 reflectionDiffuseColor; ???
поставил это:
float4 reflectionDiffuseColor : CHANNELVECTOR0;
Правильно ли? Как я понял:
float2 использует 2 значения,
float3 использует 3 значения.
Как быть с float4??? ???
2)--------------------------------
И это:
sampler2D imageSampler:TEXUNIT0;
Наведите на путь истиный...Заранее благодарен. :)
Quest3D HLSL Semantics
Semantics overview
The table below shows a list of non-standard semantics available in Quest3D.
Name Semantic Description
float CHANNELVALUE0 A value linked to the HLSL channel. The number at the end is the index of the child.
float4 CHANNELVECTOR0 A vector linked to the HLSL channel. The number at the end is the index of the child.
Float4x4 CHANNELMATRIX0 A matrix linked to the HLSL channel. The number at the end is the index of the child.
texture COLORMAP0 A texture linked to the surface channel. The number at the end is the index of the child.
texture ENVIRONMENTCUBE The global cube map that was set
using the command channel.
float NLIGHTS The number of active lights
float[8] LIGHTPHI Float array containing the inner angle of the spotlights falloff if the light is a spotlight.
float[8] LIGHTTHETA Float array containing the outer angle of the spotlights falloff if the light is a spotlight.
float[8] LIGHTATT3 Float array containing the 3rd falloff parameter of the lights(exponential falloff).
float[8] LIGHTATT2 Float array containing the 2nd falloff parameter of the lights(linear falloff).
float[8] LIGHTATT1 Float array containing the 1st falloff parameter of the lights(constant falloff).
float[8] LIGHTTYPE Float array containing the type of each light.
float4[8] LIGHTPOS Float array containing the position of each light.
float4[8] LIGHTCOLOR Float array containing the color of each light.
float4[8] LIGHTDIR Float array containing the direction of each light.
float FOGFALLOFF1 The fog falloff parameter1.
float FOGFALLOFF2 The fog falloff parameter2.
float FOGTYPE The fog falloff type.
float4 FOGCOLOR The color of the fog.
bool ENABLEFOG A boolean that is True if fog is enabled.
float4x3 WORLDMATRIXARRAY An array of matrices containing the matrix for each bone.
bool UseSkinning A boolean that is true if the object is skinned.
bool UseTangent Define this value somewhere if you want Quest3D to generate tangents for the model.
bool UseBiNormal Define this value somewhere if you want Quest3D to generate binormals for the model.
bool DisableObjectClipping Define this variable to disable frustrum clipping. You need to do this if your shader does not use a simple WorldViewProjection to calculate the final screen position.
Example
These are all types you get in your shader:
#define MAX_LIGHTCOUNT 8
#define LIGHT_TYPE_NONE 0
#define LIGHT_TYPE_POINT 1
#define LIGHT_TYPE_SPOT 2
#define LIGHT_TYPE_DIRECTIONAL 3
#define FOG_TYPE_LINEAR 0
#define FOG_TYPE_EXP 1
#define FOG_TYPE_EXP2 2
// when this is defined clipping is disabled
float dummy : DisableObjectClipping;
// Quest3D puts this value to true when the
// shader is used on a skinned mesh
bool useSkinning : UseSkinning;
// when this is defined Quest3D generates binormals for the mesh
float dummy2 : UseBiNormal;
// when this is defined Quest3D generates tangents for the mesh
float dummy3 : UseTangent;
// Light parameters
float lightPhi[MAX_LIGHTCOUNT] : LIGHTPHI;
float lightThetha[MAX_LIGHTCOUNT] : LIGHTTHETA;
float lightAtt3[MAX_LIGHTCOUNT] : LIGHTATT3;
float lightAtt2[MAX_LIGHTCOUNT] : LIGHTATT2;
float lightAtt1[MAX_LIGHTCOUNT] : LIGHTATT1;
float lightType[MAX_LIGHTCOUNT] : LIGHTTYPE;
float4 lightPos[MAX_LIGHTCOUNT] : LIGHTPOS;
float4 lightcolor[MAX_LIGHTCOUNT] : LIGHTCOLOR;
float4 lightDirection[MAX_LIGHTCOUNT] : LIGHTDIR;
float lightcount : NLIGHTS = 0;
// Fog parameters
float fogParam1 : FOGFALLOFF1;
float fogParam2 : FOGFALLOFF2;
float fogType : FOGTYPE;
float4 fogColor : FOGCOLOR;
bool bEnableFog : ENABLEFOG;
// local parameters
float fMaterialPower : CHANNELVALUE0<
string UIName = "Specular Power";
string UIWidget = "Slider";
float UIMin = 1;
float UIMax = 100;
> = 32.f;
float4 vMaterialColor : CHANNELVECTOR0<
string UIName = "Diffuse color";
string UIWidget = "Color";
> = float4 (192.f/255.f, 128.f/255.f, 96.f/255.f, 1.f);
texture cubeMap : ENVIRONMENTCUBE;
texture colorMap : COLORMAP0;
texture Heightmap : TEXTURE0
<
string ResourceType = "2D";
>;
sampler2D HeightmapSampler = sampler_state
{
Texture = <Heightmap>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = WRAP;
AddressV = WRAP;
};
спасибо за ответ. :D
А ка все таки с: sampler2D imageSampler:TEXUNIT0
В квесте это обычно часть относится к подключению текстур:
texture NormalWaterMap : TEXTURE0
<
string ResourceType = "2D";
>;
sampler2D NormalWaterMapSampler = sampler_state
{
Texture = <NormalWaterMap>;
MinFilter = LINEAR;
MagFilter = LINEAR;
MipFilter = LINEAR;
AddressU = WRAP;
AddressV = WRAP;
};
а тут только sampler2D imageSampler:TEXUNIT0 и все. Ни начала ни конца... :-\
и совсем наверное глупый вопрос: зачем ставить в конце букву f, например: 32.f
не буду повторяться,тут всё написано
https://guest3d.wohlnet.ru/forum/index.php?topic=426.0
спасибо, все разобрался. :)
часть шейдера была в другом файле, не обратил внимания на include.