- Home /
Question by
psomgeorg · Sep 06, 2019 at 12:21 PM ·
bugrendertexturedrawmesh
RenderTexture is black (DrawMeshInstancedIndirect)
i am using DrawMeshInstanceIndirect to render some smoke particles but when i change the render target to a rendertexture the texture is black. Here is the code
void Start()
{
camera = GetComponent<Camera>();
cameraEvent = CameraEvent.AfterEverything;
argsBuffer = new ComputeBuffer(1, args.Length * sizeof(uint), ComputeBufferType.IndirectArguments);
InitPosition();
accumTex = RenderTexture.GetTemporary(Screen.width, Screen.height, 0, RenderTextureFormat.ARGBHalf, RenderTextureReadWrite.Linear);
commandBuffer = new CommandBuffer()
{
name = "Testing"
};
commandBuffer.SetRenderTarget(accumTex);
commandBuffer.ClearRenderTarget(false, true, new Vector4(0.0f,0.0f,0.0f,0.0f), 1f);
commandBuffer.DrawMeshInstancedIndirect(instanceMesh, subMeshIndex, accumMaterial, -1, argsBuffer);
GetComponent<Camera>().AddCommandBuffer(cameraEvent, commandBuffer);
material.SetTexture("_AccumTex", accumTex);
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612211800im_/https://answers.unity.com/themes/thub/images/avi.jpg)