Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 10 of 10

Thread: Projecting screen space texture onto UVs with GL 4.5

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie
    Join Date
    Mar 2014
    Posts
    10

    Projecting screen space texture onto UVs with GL 4.5

    In a deferred rendering path with I have a plane with a default black texture, and a screen space texture. I want to permanently "stamp" this into the plane's black texture from the current camera's viewpoint vec3(5.f) looking at vec3(0.f). I've tried to use image load / store functions with image2D and regular texture() to no avail. I've also tried transforming the UV coordinates by the View, Projection, and ModelView matricies. The texture should be horizontally applied since I'm looking through the screen space tex, as seen here:



    Should the object space UVs be transformed to a different space to match the camera? If so, which space and why?

    Code :
    /* gBuffer_F */
    layout(bindless_sampler, location = 1) uniform sampler2D bakeTest_64;
    layout(location = 0) out vec4 gbuf0;
    layout(location = 1) out vec4 gbuf1;
     
    in Vert
    {
    	vec2 UV;
    } v;
     
    void main()
    {
            gbuf0 = vec4(v.UV, 0.f, 1.f);
     
    	vec3 albedoM = texture(bakeTest_64, v.UV).rgb;
    	gbuf1 = vec4(albedoM, 1.f);
    }
     
    /* projectedTexBake_F */
    in Vert
    {
    	vec2 uv;
    } v;
     
    layout(bindless_sampler, location = 2) uniform sampler2D gbuf0;
    layout(bindless_sampler, location = 3) uniform sampler2D toBake_64;
    layout(location = 0) out vec4 Ci;
     
    uniform mat4 PM, VM, MV;
     
    void main()
    {
    	vec4 UV_regular = vec4(v.uv, 0.f, 1.f);
    	Ci = texture(toBake_64, UV_regular.rg);
    }
     
    /* deferredLighting_F */
    in Vert
    {
    	vec2 uv;
    } v;
     
    void main()
    {
    	Ci = texture(gbuf1_64, v.uv);
    }
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	DUugxnz.jpg 
Views:	249 
Size:	18.6 KB 
ID:	1927  

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •