I removed all custom function in my shader and removed the confusing "Incorrect function" error.
But still got this error in AS code, really frustrating!!! the vertex shader code looks fine! fragment shader just do a simple texture sampling to make sure it's ok. I can't see anything wrong in my code. Please help! I'm sure of that pb3dutil compile ok and I clean and rebuild my project to make sure the embeds.
Error in as code:
// occured at this line: PBASMCompiler.compile
var programs : com.adobe.pixelBender3D.AGALProgramPair = com.adobe.pixelBender3D.PBASMCompiler.compile( inputVertexProgram, inputMaterialVertexProgram, inputFragmentProgram );
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.adobe.pixelBender3D.translator.transformations::RegisterAssigner/ renameAndAdjustSourceRegister()[D:\src\aif\sdk\main\pixel_bender_3d\pb 3dlib\src\com\adobe\pixelBender3D\translator\transformations\RegisterA ssigner.as:418]
at Function/<anonymous>()[D:\src\aif\sdk\main\pixel_bender_3d\pb3dlib\sr c\com\adobe\pixelBender3D\translator\transformations\RegisterAssigner. as:352]
at Vector.<*>$/_forEach()
at Vector$object/http://adobe.com/AS3/2006/builtin::forEach()
at Function/<anonymous>()[D:\src\aif\sdk\main\pixel_bender_3d\pb3dlib\sr c\com\adobe\pixelBender3D\translator\transformations\RegisterAssigner. as:380]
at Vector.<*>$/_forEach()
at Vector$object/http://adobe.com/AS3/2006/builtin::forEach()
at com.adobe.pixelBender3D.translator.transformations::RegisterAssigner/ renameAndAdjust()[D:\src\aif\sdk\main\pixel_bender_3d\pb3dlib\src\com\ adobe\pixelBender3D\translator\transformations\RegisterAssigner.as:387 ]
at com.adobe.pixelBender3D.translator.transformations::RegisterAssigner/ assignRegisters()[D:\src\aif\sdk\main\pixel_bender_3d\pb3dlib\src\com\ adobe\pixelBender3D\translator\transformations\RegisterAssigner.as:120 ]
at com.adobe.pixelBender3D.translator.transformations::RegisterAssigner( )[D:\src\aif\sdk\main\pixel_bender_3d\pb3dlib\src\com\adobe\pixelBende r3D\translator\transformations\RegisterAssigner.as:66]
at Translator/http://ns.adobe.com/pb3d/internal/2010::translate()[D:\src\aif\sdk\main\pixel_bender_3d\pb3dlib\src\com\adobe\pixelBend er3D\translator\Translator.as:1882]
at com.adobe.pixelBender3D.translator::VertexTranslator/http://ns.adobe.com/pb3d/internal/2010::translate()[D:\src\aif\sdk\main\pixel_bender_3d\pb3dlib\src\com\adobe\pixelBend er3D\translator\VertexTranslator.as:143]
at com.adobe.pixelBender3D::Translator$/translate()[D:\src\aif\sdk\main\ pixel_bender_3d\pb3dlib\src\com\adobe\pixelBender3D\Translator.as:69]
at com.adobe.pixelBender3D::PBASMCompiler$/compile()[D:\src\aif\sdk\main \pixel_bender_3d\pb3dlib\src\com\adobe\pixelBender3D\PBASMCompiler.as: 57]
at deltax.graphic.render::SkinnedMeshPass/updateProgram()[E:\Flash\proje ct_w11a\branch\develop_version\as\deltax\src\deltax\graphic\render\Ski nnedMeshPass.as:113]
...
and the vertex code:
<languageVersion : 1.0;>
vertex kernel SkinnedMesh
<
namespace : "AIF Test";
vendor : "Adobe";
version : 1;
>
{
parameter float4x4 worldViewProjectionMatrix;
const int MAX_BONE_TRANSFORM = 39 * 3;
// no 4x3 matrix so...
parameter float4 boneTransforms[ MAX_BONE_TRANSFORM ];
input vertex float3 vertexPosition
<
id : "PB3D_POSITION";
>;
input vertex float3 vertexNormal
<
id : "PB3D_NORMAL";
>;
input vertex float4 boneIndice
<
id : "PB3D_BONE_INDEX";
>;
input vertex float4 boneWeights
<
id : "PB3D_WEIGHT";
>;
output float4 vertexClipPosition;
void evaluateVertex()
{
float4 inPos4 = float4( vertexPosition.x, vertexPosition.y, vertexPosition.z, 1.0 );
int4 indice = int4( boneIndice );
float4 result = float4(0.0);
result.x = dot( inPos4, boneTransforms[indice.x] );
result.y = dot( inPos4, boneTransforms[indice.x + 1] );
result.z = dot( inPos4, boneTransforms[indice.x + 2] );
result = result * boneWeights.x;
result.x += dot( inPos4, boneTransforms[indice.y] ) * boneWeights.y;
result.y += dot( inPos4, boneTransforms[indice.y + 1] ) * boneWeights.y;
result.z += dot( inPos4, boneTransforms[indice.y + 2] ) * boneWeights.y;
result.x += dot( inPos4, boneTransforms[indice.z] ) * boneWeights.z;
result.y += dot( inPos4, boneTransforms[indice.z + 1] ) * boneWeights.z;
result.z += dot( inPos4, boneTransforms[indice.z + 2] ) * boneWeights.z;
result.x += dot( inPos4, boneTransforms[indice.w] ) * boneWeights.w;
result.y += dot( inPos4, boneTransforms[indice.w + 1] ) * boneWeights.w;
result.z += dot( inPos4, boneTransforms[indice.w + 2] ) * boneWeights.w;
result.w = 1.0;
vertexClipPosition = result * worldViewProjectionMatrix;
}
}
North America
Europe, Middle East and Africa
Asia Pacific