![]() |
#17
|
|||
|
|||
Quote:
I tried increasing the number of samples, but the current code adds one line of c++ for each sample. There appears to be a limit to the amount of c++ code that can be passed to the render node's apply function. Next I tried rewriting the c++ to include a for loop so there wouldn't have to be a separate line for each sample. This code, however, seems to be crashing. I have no way to debug it since it's getting run inside Vizard where I can't attach a debugger or print debug statements. Here's my code: Code:
blur_source = """ uniform sampler2D srcImage; uniform float blurScale; void main(void) { vec4 color = vec4(0,0,0,0); float numSamples = blurScale * 4.0; for(float index = -numSamples; index <= numSamples; index += 1.0) { float offset = index / %size%; float temp = index / numSamples; `float weight = 0.05 + ((1.0 - temp * temp) / 4.0); color += ( texture2D( srcImage, gl_TexCoord[0].xy + vec2( %modifier% ) ) * weight ); } color.a = 1.0; gl_FragColor = color / 1.7; }""" #Create horizontal blur shader temp_source = blur_source.replace('%size%', str(float(size[0])) ) blur_code = temp_source.replace('%modifier%', 'offset * blurScale, 0.0' ) horzBlurShader = viz.addShader(frag=blur_code) #Create vertical blur shader temp_source = blur_source.replace('%size%', str(float(size[1])) ) blur_code = temp_source.replace('%modifier%', '0.0, offset * blurScale' ) vertBlurShader = viz.addShader(frag=blur_code) Any ideas what would cause this? Is it worth pursuing if we're going to get a video card that will run your other script? |
|
|