Bluring textures with nodes!

Hello! I am looking for a way to blur textures in GLSL node editor. Does anyone know a way? And maybe also a way to do it without FPS loss. Thanks already now!:wink:

There is no “real” way to do it because shader nodes can’t sample other areas of the texture which you can do if you write your fragment shader in GLSL. After seeing your post I tried faking it by duplicating the texture node a whole mess of times and before passing it the UVs from the geometry node, shift it using a vector mapping node, then mix the result with the original. Do that over and over with subtle shifts to the UVs and you get something that looks blurred. Not optimal at all because the more blurred you want the image the number of nodes grows rapidly.


Is this a way how normal blur is calculated?:eek: It shall cause so much lag that way. So hard to calculate. Maybe there are other ways. I need something to make the texture rough. Yeah - this is correct. Maybe someone knows roughness calculation used in PBR?

There are a lot of ways that a “normal” blur can be calculated. None of them can be done in the node-editor because you have to be able to sample the colors of the texture around the point that is currently being worked on.

I just had an idea however, you could blur your texture at several different amounts beforehand, load in each into your shader, and blend between them based on distance or even based on the vertex color which you can change in the BGE while it is running.

Could you post a .blend, please?

Here you go: https://drive.google.com/open?id=0B59fehhFH26fTjhvVFJJNkxxbTA&authuser=0

The pic of my dog should be packed in the file.

Well, this is not it, because I need it to be done on real-time rendered texture. I mean render to texture.

I get 5 FPS and the plane is white and gets black when I press SPACE.
Well, I am wondering - could anyone find what calculation is hidden behind the Smoothness slider in Unity 5. Basicly what I need is that - exactly that calculation. Or at least similar.

I don’t know why you are getting 5fps. My 2011 MacBook Pro gets 60 solidly with 0.43ms on the rasterizer. None of my stats change between running the file and then hitting space. What system are you running that is only pulling 5fps? I double checked and re-saved the file over the one that I had uploaded making sure the texture was packed… it should start as a pattern of red and green squares before hitting SPACE. Try grabbing it again.

One thing about these forums is you should try to be as specific as possible in your first post about what the issue you are having is and what you want to achieve with a .blend posted somewhere if you are hitting a bug or some confusing problem. I tried to do what you initially asked only to learn through each post more details about what you wanted which could have been given upfront. I’ve found that there are a pretty good group of people on here who want to help others but nobody really wants to do it all for you. Some of the stuff you will find posted or examples of what can be done are more ready for use than others. In the end if you want a specific effect you are probably going to have to research it and very likely write it yourself (which is what I did with my blur - part research, part me making things up as I went along) or move to Unity if it does what you want.

I don’t want to use Unity(bad community, no experience, lack of tutorials), I don’t know how to script shaders, especially in Blender(all my experience in shader scripting: https://www.youtube.com/watch?v=6B7IF6GOu7s theese tutorial series. I am using the stats shown below(in my signature), they are much better than Macbook Pro 2011. Here is a video of what I get:

@adriansnetlis: You should look at the errors in the console (run blender from terminal prompt). Add a texture to the plane (whatever you want). http://www.pasteall.org/blend/36617 (it’s the file from DownshiftDX with a texture packed in 2.75 blender’s version so texture will not be available for earlier versions)

Well now that is crazy indeed. Maybe it is something up with Ubuntu? I dunno, Linux graphic drivers and my MacBook Pro don’t get along very well otherwise I would be running something other than OS X myself. It could be the driver, or an incompatibility in what I wrote in GLSL. (I am not exactly well versed, most of what I put together is pretty rough.) What does blender’s console output say? Maybe there are errors I don’t know about for your system.

The frame rate drop below 60.0 in the video is caused by the screen recorder and I am doing a full backup in the background right now.

Now that isn’t saying I can’t get it to drop (Change the value in “shader.setUniform1i(“useBlur”,7)” to a higher number for a stronger blur) but you see on mine the rectangle starts with the red-green grid pattern and then blurs. It shouldn’t be white and black at all so something isn’t right to start which is why I suggested re-downloading the file. (Though I have had textures appear black after running the BGE and using scripts that make use of renderToTexture, but reloading Blender later restores them to normal… it is a bug but I haven’t really investigated it further.)

EDIT:
@youle Your file also works for me and instead of the red-green texture it instead starts by showing the whole scene from the camera.

@DownshiftDX: Hi! Your file didn’t work for me initially (same result as adriansnetlis video) so I looked at the console and it told me a texture was missing on the plane. So because it’s renderToTexture, I choosed a random texture on my computer and apply it to the overlay plane and then pack it…

Now it works fine for me(with texture selected). I tried the shader in my game. It works fine, but… I use node materials for car and with that python shader car looks very flat(shadeless). I use HG1s v1.5 rela time cubemap node to be mroe exact. Could you tell me how to use this in nodes?

@adriansnetlis: Hi! You want to blur the textures captured by the six cameras? If yes, could you share a simplified .blend (a plane with HG1’s node material). I’ll try to make a simple blur on it.

I will post my car matte paint material with model. Thank you, man. By the way, it’d be nice if you seperate your added things in frames.:slight_smile:
.blend: not time yet.

@youle Yeah I had thought that might have happened initially when I uploaded the file which is why I came back later and double checked the .blend and made sure I packed the texture.

@adriansnetlis You can’t use GLSL code in nodes and applying a vertex and fragment shader of your own means you are overriding the node material. So you will have to combine this blur (or another) with the code needed to calculate the shading of the surface of your car. I planned to use the shader I wrote only for overlay UI stuff so I didin’t care about shading/lighting/shadows. (The blur also has issues near the screen edge because I didn’t clip the sampling of the renderedTexture.)

@DownshiftDX: HG1 realtime cubemap node system has textures captured by 6 cameras (with renderToTexture). So I think it’s possible to blur those textures with GLSL code before sending it to the node setup…

I hope the same, I will make the file now, but not much time - family waits for me…

OK! Here is the .blend:
http://www.pasteall.org/blend/36625