Jump to content

Rendering a viewport in to a texture causes stutter on SoundSource objects


photo

Recommended Posts

I'm not sure if this is a bug or a mis-understanding on our part. We're rendering a Viewport in to a texture it cases SoundSource objects audio to stutter in line with the frame rate that we render the viewport in. The code from update() is


 

    // Update LED screen
    static NodePtr camNode = World::getNodeByName("led_screen_camera");
    static PlayerDummyPtr player = checked_ptr_cast<PlayerDummy>(camNode);
    static CameraPtr camCam = player->getCamera();
    

    static TexturePtr bbTexAlbedo = 0;
    static TexturePtr bbTexEmission = 0;

    if (!bbTexAlbedo) {
        ObjectMeshStaticPtr billboardObject = checked_ptr_cast<ObjectMeshStatic>(World::getNodeByName("st_mesh_screen"));
        MaterialPtr billboardMat = billboardObject->getMaterial(2);
        bbTexAlbedo = billboardMat->getTexture(billboardMat->findTexture("albedo"));
        bbTexEmission = billboardMat->getTexture(billboardMat->findTexture("emission"));
    }
    
    

    static float elapsed = 0.0f;
    elapsed += ifps;
    if (elapsed > 1.0f / 10.0f) {
        elapsed -= 1.0f / 10.0f;
        //  I have tried everytihng, but this call makes the soundsources stutter as if they're getting rendered by the viewportptr
        viewport->renderTexture2D(camCam, bbTexAlbedo);
        bbTexAlbedo->createMipmaps();
        
        viewport->renderTexture2D(camCam, bbTexEmission);
        bbTexEmission->createMipmaps();

 

Is there a better way of doing this that doesn't cause sound issues?

Link to comment

Hi Angus,

How the audio is being sent to device? Are you using the same HDMI / DP cable for audio or it comes from dedicated sound card (3.5mm / spdif connector)?

Is it possible to create a minimal test sample which will behave exactly the same so we can try to run & debug it on our side?

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...