1 / 8

Off-Screen RENDER TO TEXTURE

s. n. ns. C m x s. Prodotto matriciale a blocchi. Off-Screen RENDER TO TEXTURE. blockA. blockB. Prodotto matriciale a blocchi. Partiziono le matrici A e B con sottomatrici quadrate di ugual dimensione nello specifico con blocchi di 2x2 elementi.

cliff
Download Presentation

Off-Screen RENDER TO TEXTURE

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. s n ns C m x s Prodotto matriciale a blocchi Off-Screen RENDER TO TEXTURE

  2. blockA blockB Prodotto matriciale a blocchi Partiziono le matrici A e B con sottomatrici quadrate di ugual dimensione nello specifico con blocchi di 2x2 elementi Memorizzo sulla memoria video i singoli sottoblocchi di 2x2 elementi in strutture rgba

  3. blockA.rgba i,k blockA.rgba * blockB.rara blockB.rgba k,j blockA.rgba*blockB.rara i,k Ci,j = = k,j x blockA.grab * blockB.bgbg Prodotto matriciale a blocchi Prodotto matriciale del generico sottoblocco Ci,j da 2x2 elementi calcolato con strutture rgba tex2D (Tex_Ck, gl_FragCoord) + ( blockA.rgba * blockB.rara ) + ( blockA.grab * blockB.bgbg )

  4. blockA blockB X = colonne = j Y = righe = i Prodotto matriciale a blocchi vec2 texCoordA = vec2( k_parz , gl_FragCoord.y ); vec2 texCoordB = vec2( gl_FragCoord.x , k_parz ); vec4 blockA = vec4( texture2DRect( textureA , texCoordA ) ); vec4 blockB = vec4( texture2DRect( textureB , texCoordB ) ); vec4 blockC = vec4( texture2DRect( Tex_Ck , gl_FragCoord) );

  5. OpenGL uniform sampler2DRect Tex_Ck; uniform sampler2DRect textureA; uniform sampler2DRect textureB; uniform float k_parz; void main(void) { vec2 texCoordA = vec2( k_parz , gl_FragCoord.y ); vec2 texCoordB = vec2( gl_FragCoord.x , k_parz ); vec4 blockA = vec4( texture2DRect( textureA , texCoordA ) ); vec4 blockB = vec4( texture2DRect( textureB , texCoordB ) ); vec4 blockC = vec4( texture2DRect( Tex_Ck , gl_FragCoord) ); blockC += vec4( (blockA.rgba * blockB.rara) + (blockA.grab * blockB.bgbg) ); gl_FragColor = vec4(blockC); } Prodotto matriciale a blocchi Shader Multi-Pass

  6. Prodotto matriciale a blocchi glActiveTexture glBindTexture glFramebufferTexture2DEXT Tex_Ck Input: Red Texture Output: Green Texture Input: Green Texture Output: Red Texture Off-Screen Render to Texture

  7. A = Prodotto matriciale a blocchi le texture sono memorizzate per righe di pixel e i pixel in successione sono memorizzati i canali di colore rgba. Versione Pre-Wrappata

  8. OpenGL uniform sampler2DRect mat; void main(void) { vec4 block; int mod_x = int(mod(gl_FragCoord.x, 2)); int div_x = int(gl_FragCoord.x / 2); int mult_y = int(gl_FragCoord.y)* 2; float x = 0.5 + div_x; float y = 0.5 + mult_y; vec4 rg_block = texture2DRect( mat, vec2( x , y ) ); vec4 ba_block = texture2DRect( mat, vec2( x , y + 1.0 ) ); if (mod_x == 0) { block.rg = rg_block.rg; block.ba = ba_block.rg; } if (mod_x == 1) { block.rg = rg_block.ba; block.ba = ba_block.ba; } gl_FragColor = vec4( block ); } Pre-Wrapped Prodotto matriciale a blocchi Shader Single-Pass

More Related