Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - quinor

Pages: [1]
1
SFML projects / Re: Screenshot Thread
« on: August 29, 2017, 06:18:44 am »
Just a teaser, will publish on the forums soon (TM) :)

(click to show/hide)

The generated path is actually meant to be plotted by a pen plotter. A very short demo (old version) below:
https://twitter.com/EMSL/status/901971935138947072

Repository:
github.com/quinor/tspart
Buid/run instructions suck. I know. Contact me on github if you wanna run it.

2
Graphics / Re: Make blur sprites.
« on: January 13, 2017, 05:56:16 pm »
(a bit necro, but for future generations...)

http://en.sfml-dev.org/forums/index.php?topic=21363.0

3
Graphics / Re: Looking for a nice variable sigma gaussian blur shader
« on: January 13, 2017, 01:03:15 pm »
If anybody needed it:

#version 130

uniform sampler2D tex;
uniform float sigma;

#define gauss_constant 0.3989422804014327

float gauss_weight(int d)
{
  return (gauss_constant/sigma)*exp(-d*d/(2*sigma*sigma));
}

void main()
{
  vec3 sum = vec3(0.0);
  float delta = 1.0/textureSize(tex, 0).x;
  float div = 0;
  sum += gauss_weight(0)*texture(tex, gl_TexCoord[0].xy).rgb;
  div += gauss_weight(0);
  for (int i=1; i<=3*sigma; i++)
  {
    sum += gauss_weight(i)*texture(tex, gl_TexCoord[0].xy+vec2(delta*i, 0)).rgb;
    sum += gauss_weight(i)*texture(tex, gl_TexCoord[0].xy+vec2(-delta*i, 0)).rgb;
    div += 2*gauss_weight(i);
  }
  gl_FragColor = vec4(sum, 1.0)/div;
}
 

And in sfml:
frag.setUniform("sigma", (float)sigma_input.get_data());
frag.setUniform("tex", in.get_data());
 

Though it slows down a bit (800ms! per x and y pass on sigma=200) so I'll be experimenting with speeding this up.


EDIT:

Indeed, computation of the gaussian weight isn't important - eliminating it doesn't change computation time pretty much at all. The blur isn't ideal (average of the gaussian function over one unit of distance isn't exactly the value in the middle of said distance) but it's much closer to the real one and suits my application.

4
Graphics / Re: Looking for a nice variable sigma gaussian blur shader
« on: January 12, 2017, 12:09:17 pm »
Thanks, I've found some very helpful things there :)

How much faster will it be in GLSL to pass an array of gaussian blur weights instead of computing them at runtime (it's 1/(2pi*sigma)*exp(-x^2/(sigma^2)),  so quite a compllicated function)?

5
Graphics / Looking for a nice variable sigma gaussian blur shader
« on: January 12, 2017, 02:27:01 am »
For my project I need a blur shader. It has to have per-pass adjustable intensity in very wide range (sigma from 1 to 500) and becouse of some deeper mathematical reasons I would really prefer to have gaussian blur (well, discrete approximation of one) with actual sigma as control parameter.

I don't have enough experience to generate proper weights and pass them to a kernel yet. For now I am using crappy approximation of two passes of a moving average but it's very far from perfect.

I feel like this is such a standard problem that somebody must have had written it before and probably posted somewhere over the internet. If you happen to have such a piece of code stashed somewhere, it would be wery helpful if you've posted it to me or pointed in the right direction.

6
General / Re: Texture copy inefficiency
« on: January 11, 2017, 12:27:00 am »
Thanks, Laurent! I'm looking forward to this.

eXpl0it3r: I am using SFML to do some dirty, nasty image processing stuff. If you really wanna know more ( ;) ) I'm using it as a backend for image processing pipeline library. I may even publish it on forums when it's more finished!

7
General / Texture copy inefficiency
« on: January 10, 2017, 03:38:57 pm »
Why sf::Texture copy constructor is implemented by copying onto and from sf::Image? You could copy a texture directly on a GPU, Is there a reason, or just nobody wrote it yet?

EDIT:

I have found https://github.com/SFML/SFML/issues/190 but it seems outdated as RenderTexture already works on Intel GPUs (I'm using one right now)

Pages: [1]
anything