Final Image after Quad Pass is Zoomed in

Problems building or running the engine, queries about how to use features etc.
Post Reply
psysu
Halfling
Posts: 72
Joined: Tue Jun 01, 2021 7:47 am
x 6

Final Image after Quad Pass is Zoomed in

Post by psysu »

Ogre Version: 3.0.0unstable (E)
Operating System: Windows 10
Render System: DirectX11

Hi, I'm learning some basic compositor features of ogre-next.

i written a compositor script that renders all the render queues into a local rtt, which is copied and rendered as quad on the main render texture as the final image.

On Vulkan and OpenGL rendersystems this works fine, but on DirectX11 the final image after quad pass is zoomed in comparing to the final image of local rtt.

For you reference:

Final image of local rtt:

Image

Final image after copying the rtt into a quad:

Image

This .compositor script i used for this:

Code: Select all

compositor_node QuadTest
{

in 0 rt_renderwindow

texture sample_rtt target_width target_height PFG_RGBA8_UNORM_SRGB msaa_auto

target sample_rtt
{
    
    pass clear 
    {
        colour_value 0.1 0.1 0.1
    }
    pass render_scene
    {
        rq_first 1
        rq_last max
    }
    
}

target rt_renderwindow
{

    pass render_quad
    {
        load
        {
            all dont_care
        }
        store
        {
            depth dont_care
            stencil dont_care
        }

        material CopyAndRenderTexMat
        input 0 sample_rtt
    }
    
}

}

CopAndRenderTexMat .material script:

Code: Select all

material CopyAndRenderTexMat
{
    technique
    {
        pass
        {
            depth_check off
            depth_write off 
            
cull_hardware none vertex_program_ref quad_vs { } fragment_program_ref CopyAndRenderTex_ps { } texture_unit { filtering none tex_address_mode clamp } } } }

The vertex and fragment shaders i used are the ones that are written for Ogre/Copy/4xFP32 material.

User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Final Image after Quad Pass is Zoomed in

Post by dark_sylinc »

I don't see anything wrong in what you posted, the problem is probably either in the vertex/fragment script definition, or in the shaders themselves.

I can only recommend you can merge the clear and render scene passes, but that does not have to do with your problem:

Code: Select all

compositor_node QuadTest
{
// ...
target sample_rtt
{
    pass render_scene
    {
        load
        {
            all clear
            colour_value 0.1 0.1 0.1
        }
        rq_first 1
        rq_last max
    }
    
} // ... }

Have you tried RenderDoc? It's a powerful debugging tool and it will help you debug what's going on.

For Vulkan and D3D11 it even supports source-level shader debugging for both vertex and pixel shaders.

EDIT: Are you able to repro the problem by modifying a sample? This problem rings a bell: there was a recent bug in OgreNext where the aspect ratio would be incorrectly set and would cause something like what you are seeing (different AR or FOV results in "zooming" in or out). It was supposedly fixed.

psysu
Halfling
Posts: 72
Joined: Tue Jun 01, 2021 7:47 am
x 6

Re: Final Image after Quad Pass is Zoomed in

Post by psysu »

Yikes!! i made a mistake in the Vertex Shader for the Quad Mesh.

For Calculating the gl_Position :

I did this

Code: Select all

outVs.gl_Position = mul( inVs.vertex, worldViewProj  ).xyzw;

instead of

Code: Select all

outVs.gl_Position = mul( worldViewProj, inVs.vertex  ).xyzw;
psysu
Halfling
Posts: 72
Joined: Tue Jun 01, 2021 7:47 am
x 6

Re: Final Image after Quad Pass is Zoomed in

Post by psysu »

Also I had to add this in the cmake script for the Tutorial_VulkanExternal sample

Code: Select all

include_directories(${Vulkan_INCLUDE_DIRS})

Otherwise, it cannot find the ''vulkan/vulkan_core.h" included in that sample source files

Post Reply