Its pretty straightforward, id like to have access to a low resolution version of a render target, so i can apply blur to it and add it to the original frame texture and make the bloom effect. As of now, the bloom effect is taking down my fps, my intel hd 620 can handle this defold logo with ~55 fps at most:
Well, you set the size of the render target don’t you? Just decrease the size of the render target and, if needed, make sure to take this into account in your shader code.
but how do i rescale it back to the original size, so i can add it to other rt texture? thats my question
I think you can probe the color from such render target normally with texture2D() in fragment program of something to which you draw this RT, but need to probably recalculate the var_texcoord0 (speaking in default fp naming convention). I will try tomorrow, if you won’t manage to do so.
Also, I wonder how your bloom implementation works? It shouldn’t be so resource consuming I believe
it uses this algorithm in the fragment program:
vec4 blur(vec2 viewPort, int radius, vec2 pos, sampler2D texture)
{
float xs, ys; // texture resolution
xs = viewPort.x;
ys = viewPort.y;
float x,y,xx,yy,rr=radius*radius,dx,dy,w,w0;
w0=0.3780/pow(radius,1.975);
vec2 p;
vec4 col=vec4(0.0,0.0,0.0,0.0);
for (dx=2.0f/xs,x=-radius,p.x=0.5+(pos.x*0.5)+(x*dx); x<=radius;x++, p.x+=dx)
{
xx=x*x;
for (dy=2.0f/ys,y=-radius,p.y=0.5+(pos.y*0.5)+(y*dy); y<=radius; y++,p.y+=dy)
{
vec4 pixel = texture2D(texture, vec2(xx, yy));
float brightness = dot(pixel.rgb, vec3(1, 1, 1));
if(brightness > 1.0)
{
yy=y*y;
if (xx+yy<=rr)
{
w=w0*exp((-xx-yy)/(2.0*rr));
col+=texture2D(texture,p)*w;
}
}
}
}
return col;
}
Im trying to understand how learnopengl does it, seems more optimized