Page 1 of 1

Render Passes

Posted: Sun Jun 23, 2024 16:31
by cat
I still haven't got my head around render passes in glsl it seems.
I am trying to downsample an image in steps of 1/2 each time, this shader gives no errors, but doesnt output anything.
also does $WIDTH mean the previous render pass size or the original input size? should it be $WIDTH/2 , $WIDTH/4 etc?
Is there any way of getting point sampling rather than linear?

Code: Select all

/*{
    "CREDIT": "",
    "DESCRIPTION": "",
    "CATEGORIES": [ "generator" ],
    "INPUTS": [
        {
            "TYPE": "image",
            "NAME": "tex0",
        }
	
    ],
	
	"PASSES": [
		{
	    "TARGET" : "pass0",
		},
		{
		"TARGET" : "pass1",
      "WIDTH": "$WIDTH/2",
	  "HEIGHT": "$HEIGHT/2"
		}
	,
		{
		"TARGET" : "pass2",
      "WIDTH": "$WIDTH/2",
	  "HEIGHT": "$HEIGHT/2"
		}
	]
}*/



void main() {
	//vec2 uv =  isf_FragNormCoord.xy ;
	if (PASSINDEX == 0) 
	    {
	    vec4 col = IMG_NORM_PIXEL(tex0, isf_FragNormCoord );		
        gl_FragColor = col; 
		}
	if (PASSINDEX == 1){
		gl_FragColor =  IMG_NORM_PIXEL(pass0, isf_FragNormCoord );
		
	    }
	else{ 
		gl_FragColor =  IMG_NORM_PIXEL(pass1, isf_FragNormCoord ); 
	    }
	
}

Re: Render Passes

Posted: Sat May 31, 2025 20:44
by dtristram
has anyone succeeded in reading multiple buffers in different passes? I don't believe it works.

Re: Render Passes

Posted: Tue Jun 03, 2025 09:15
by cat
I have, but it didn't feel logical to me

"PASSES":
[
{
"TARGET": "P01",
"FLOAT": true
},
{
"TARGET": "P02",
"FLOAT": true
}

accessed by

some code here
ie setup some floats vec2's

if (PASSINDEX == 0) {
process1 }

if (PASSINDEX == 2) {
process the output of process1
}

Shouldn't we be targeting via process name? It seems not, just its pass number
index 0 seems to work in that manner, ie 0 is pass one, thats fine, but pass 2 is accessed by part of the name, or suddenly counting from 1 not zero, I don't get it. I gave up after this point and used separate shaders.