|
#1
|
|||
|
|||
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? |
#2
|
|||
|
|||
If you want a really blurry look, then just decrease the size of the blur texture. The default is 512x512. Try 128x128 or 64x64.
Code:
import vizblur vizblur.enable(128,128) #Lower texture size creates more blur |
#3
|
|||
|
|||
I've attached a better version of the blur example that allows you to specify the blur kernel size. Previously it was 9. In the test script I have set it to 40. Surprisingly this didn't affect performance on my machine. A larger blur kernel will create more blur. Once you specify the blur kernel, you cannot change it. I recommend setting the blur kernel to the point where it matches your maximum desired blur. This way you can keep the blur scale under 1.0, which will prevent pixelization.
|
|
|