Post not yet marked as solved
I am trying to sample a texture inside a Metal vertex shader.
Receiving the following error: "AGX: AGX: Texture read/write assertion failed: depth > 0"
Setup for rendering:
` MTLSamplerDescriptor *samplerDesc = [MTLSamplerDescriptor new];
samplerDesc.normalizedCoordinates = YES;
samplerDesc.rAddressMode = MTLSamplerAddressModeClampToEdge;
samplerDesc.sAddressMode = MTLSamplerAddressModeClampToEdge;
samplerDesc.tAddressMode = MTLSamplerAddressModeClampToEdge;
samplerDesc.minFilter = MTLSamplerMinMagFilterNearest;
samplerDesc.magFilter = MTLSamplerMinMagFilterNearest;
samplerDesc.mipFilter = MTLSamplerMipFilterNotMipmapped;
id ss = [device newSamplerStateWithDescriptor:samplerDesc];
[ commandEncoder setVertexSamplerState : ss atIndex : 0 ];
[ commandEncoder setVertexTexture : l_Texture_Height_Field
atIndex : CTI_Gradient ];
Vertex` Shader:
`vertex PVertex vertexShader_mkali ( uint vertexID [ [ vertex_id ] ],
constant Vertex3D *vertexArray [ [ buffer ( CVI_Vertices ) ] ],
constant vector_uint2 *viewportSizePointer [ [ buffer ( CVI_ViewportSize ) ] ],
constant shader_Data_mkali &vertex_Shader_Data [ [ buffer ( CVI_ShaderData ) ] ],
texture2d < float > heightTexture [ [ texture ( CTI_Gradient ) ] ],
sampler smp [ [ sampler ( 0 ) ] ]
)
{
PVertex outVertex;
float2 l_Point = vertexArray [ vertexID ].position.xy;
l_Point.x = mkali_noxstep( -1.0, 1.0, l_Point.x );
l_Point.y = mkali_noxstep( -1.0, 1.0, l_Point.y );
float4 l_Texture_Heightfield = heightTexture.sample ( smp, l_Point );
outVertex.position = float4 ( vertexArray [ vertexID ].position + float3 ( l_Texture_Heightfield.x, 0.0, 0.0 ), 1.0 );
outVertex.color = float4 ( 1.0, 0.5, 0.0, 1.0 );
outVertex.size = 30;
return outVertex;
}`
Anybody have any ideas?
thank you, Nikki
Post not yet marked as solved
Why do Motion keyframed values do not call parameterChanged even thought the value changed?
The work around was painful.
Please let me know if it can be done with parameterChanged.
thank you,
David Patrick Farmer
Post not yet marked as solved
How do I get the 3D transform of a layer from an Image Well parameter?
matrix_float4x4 l_Transform_Mask_Texture;
FxMatrix44 *l_Pixel_Transform_Temporary = sourceImages [ ki_Mask ].pixelTransform;
Matrix44Data *l_Pixel_Transform = [ l_Pixel_Transform_Temporary matrix ];
Always returns identity matrix.
If I retrieve the pixelTransform on the destinationImage I get something but it must be relating to the tile and that layer's transform.
Could use some help here.
thank you,
David Patrick Farmer
Post not yet marked as solved
FxPlug 4 How do I force a render in the active project?
Thank you,
David Patrick Farmer
Post not yet marked as solved
I am trying to retrieve the layer transform of a layer put into a generator’s image well parameter.I setup like this: [ l_FxParameterCreationAPI_v5 addImageReferenceWithName : [l_Bundle localizedStringForKey: @"Source" value:NULL table:NULL] parameterID : k_Parameter_ID_Source_Texture parameterFlags : kFxParameterFlag_DEFAULT ];- ( BOOL ) properties : ( NSDictionary * _Nonnull * ) properties error : ( NSError * _Nullable * ) error{ *properties = @{ kFxPropertyKey_MayRemapTime : @NO, kFxPropertyKey_IsThreadSafe : @NO, kFxPropertyKey_UsesRationalTime : @YES, kFxPropertyKey_PixelTransformSupport : [ NSNumber numberWithInt : kFxPixelTransform_ScaleTranslate ], // kFxPixelTransform_Full ], kFxPropertyKey_VariesWhenParamsAreStatic : @YES, kFxPropertyKey_NeedsFullBuffer : @YES, kFxPropertyKey_ChangesOutputSize : @YES }; return YES;}- ( BOOL ) destinationImageRect : ( FxRect * ) m_Destination_Image_Rectangle sourceImages : ( NSArray < FxImageTile * > * ) m_Source_Images destinationImage : ( FxImageTile * ) m_Destination_Image pluginState : ( NSData * ) m_Plugin_State atTime : ( CMTime ) m_Render_Time error : ( NSError * _Nullable * ) m_Out_Error{ Matrix44Data* pt = [ m_Source_Images [ 0 ].pixelTransform matrix ]; NSLog( @"NECTAR . PT . 0x:%f 0y:%f 0z:%f 0w:%f", (*pt)[0][0], (*pt)[0][1], (*pt)[0][2], (*pt)[0][3] ); // ••• NSLog( @"NECTAR . PT . 1x:%f 1y:%f 1z:%f 1w:%f", (*pt)[1][0], (*pt)[1][1], (*pt)[1][2], (*pt)[1][3] ); // ••• NSLog( @"NECTAR . PT . 2x:%f 2y:%f 2z:%f 2w:%f", (*pt)[2][0], (*pt)[2][1], (*pt)[2][2], (*pt)[2][3] ); // ••• NSLog( @"NECTAR . PT . 3x:%f 3y:%f 3z:%f 3w:%f", (*pt)[3][0], (*pt)[3][1], (*pt)[3][2], (*pt)[3][3] ); // ••• return YES;}Result:PT . 0x:1.000000 0y:0.000000 0z:0.000000 0w:0.000000PT . 1x:0.000000 1y:1.000000 1z:0.000000 1w:0.000000PT . 2x:0.000000 2y:0.000000 2z:1.000000 2w:0.000000PT . 3x:0.000000 3y:0.000000 3z:0.000000 3w:1.000000 The source layer is rotated 90° so the following identity matrix does make sense? How do I retrieve the transform matrix of the source layer correctly?I tried in the render method as well with the same results.Thank you,David
Post not yet marked as solved
I want to know if I am rendering to final view ( not a tumbnail ) or to export render. How would I know it the pluginState or setting the destinationRect methods?thank you,David
Post not yet marked as solved
FxPlug 4 - How do I retrieve project dimensions when setting output size in a Filter?I want to set my filter output size to the size of the project ( possibly bigger ).If not, is there a way of retrieving child groups or layers of the current filter or generator?Thanks,David
This has been nagging me for years ( long discussion with Darrin Cardini but unresolved ). If I create a Color Solid in Motion and set the values to 0.25, 0.50, 0.75 Motion and the fxplugs I am writing see those exact values - 0.25, 0.50, 0.75. If I create an fxplug filter and render a quad with the values 0.25, 0.50, 0.75 I get 0.286, 0.545, 0.779. This is as basic as I can make my example. I have tried using both kFxImageColorInfo_RGB_GAMMA_VIDEO and kFxImageColorInfo_RGB_LINEAR for kFxPropertyKey_DesiredProcessingColorInfo to no avail.This is obviously something simple I am doing or not doing. Any ideas folks? Can someone start me off Color Solid source? I need this to work as a filter and generator. But as of ten seconds ago I think generators may be treated differently ( will give it a go but still need it to work with filters ).Using for velocity fields and normal maps with FxPlug Filters.Can anyone help?thank you,David Patrick Farmer