XML Feeds

.

[jitter] Re: Re: erase_color with half transparancy works on one videocard, not on another

Wesley Smith wesley.hoke at gmail.com
Mon Oct 1 07:39:16 MDT 2007


Hi Mattijs,
thanks for the patch.  I can only speculate right now that there is
some difference in drivers between ato and nvidia causing this
problem.  I could reproduce on my x1600 but my nvidia 8600 had no
problems.  What erase_color with alpha is actually doing is not
erasing the color buffer and drawing a fullscreen black quad with some
blending over the scene so that it gradually disappears.  I've
reproduced this effect in a shader which can be used as a drop in
replacement for cases where you're using additive blending.  To use
the usuall @blend_mode 6 7 blending, you'll have to modify the shader
code a bit, but this takes care of the feedback network.

-----------------------------co.accum.jxs

<jittershader name="accum">
	<description>
	Accumulator
	</description>
	<param name="erase_color" type="vec4" default="0. 0. 0. 0.1">
		<description>fade amount</description>
	</param>
	<param name="tex0" type="int" default="0" />
	<param name="tex1" type="int" default="1" />
	<language name="glsl" version="1.0">
		<bind param="erase_color" program="fp" />
		<bind param="tex0" program="fp" />
		<bind param="tex1" program="fp" />
		<program name="vp" type="vertex" source="sh.passthru.xform.vp.glsl" />
		<program name="fp" type="fragment">
<![CDATA[

// texcoords
varying vec2 texcoord0;
varying vec2 texcoord1;

// samplers
uniform sampler2DRect tex0;
uniform sampler2DRect tex1;

// accum amount
uniform vec4 erase_color;

// entry point
void main()
{
	vec4 current = texture2DRect(tex0, texcoord0);
	vec4 previous = texture2DRect(tex1, texcoord1);

	//simulation of jit.gl.render's @erase_color attribute
	vec4 framebuffer = mix(previous, erase_color, erase_color.a);

	gl_FragColor = framebuffer + current;
//	gl_FragColor = framebuffer;
}

]]>
		</program>
	</language>
</jittershader>


------------------------------Patch

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P newex 247 416 199 196617 jit.gl.videoplane test @transform_reset 2;
#P newex 261 390 143 196617 jit.gl.slab test @dim 720 480;
#P newex 247 359 372 196617 jit.gl.slab test @file co.accum.jxs @param
erase_color 0 0 0 0.2 @dim 720 480;
#P newex 247 333 221 196617 jit.gl.texture test @name scene @dim 720 480;
#P newex 48 76 48 196617 loadbang;
#P toggle 48 241 15 0;
#P newex 48 259 67 196617 prepend fsaa;
#P newex 275 182 104 196617 pak position 0. 0. -2.;
#P message 306 145 67 196617 -1. \, 1. 1000;
#P newex 306 163 40 196617 line 0.;
#P newex 48 279 227 196617 jit.window test @depthbuffer 1 @doublebuffer 1;
#P newex 48 178 50 196617 t b erase;
#P toggle 48 139 15 0;
#P newex 48 158 57 196617 qmetro 30;
#P newex 275 201 234 196617 jit.gl.gridshape test @shape plane @capture scene;
#P newex 48 203 199 196617 jit.gl.render test @erase_color 0. 0. 0. 1.;
#P comment 68 241 219 196617 enable fsaa and erase_color trails disappear;
#P connect 14 0 16 0;
#P connect 14 0 15 0;
#P connect 15 0 14 1;
#P connect 13 0 14 0;
#P connect 5 0 1 0;
#P connect 5 0 13 0;
#P connect 5 1 1 0;
#P connect 9 0 2 0;
#P connect 12 0 4 0;
#P connect 12 0 8 0;
#P connect 4 0 3 0;
#P connect 3 0 5 0;
#P connect 11 0 10 0;
#P connect 10 0 6 0;
#P connect 7 1 8 0;
#P connect 8 0 7 0;
#P connect 7 0 9 1;
#P window clipboard copycount 17;


More information about the jitter mailing list