unlimited planar reflections & refraction (update)


(Mathes) #241

So these samplers

uniform sampler2D reflection,refraction, normals, diffuse;
are available external data? Is it simliar to this below ?


So that they are actually “components” ?


(Jsewill) #242

Yes, declaring them as uniforms lets the shader program (at compile time and while running on the GPU) know to expect data assigned to those locations (coming from the currently running application). The Sampler2D variables are reserved for textures.

If you look at the python script which assigns the shader source and compiles the shader program, it also sets these uniforms. The samplers get set to a specific texture slot on the material via a blender specific API function that wraps a bunch of OpenGL stuff.


(Mathes) #243

Thank you again. That was a important thing i need to know. Now the only thing is missing where to find all available functions or “component” , in this example we used the 2D sampler : reflection,refraction, normals, diffuse; Are there more ? How are they named ?

I am currently digging into the Blender Source code and i found many interesting things and corresponding code items. But, i still need to get
some deeper image to understand it further. I don´t know if i should set up a new thread or if it is ok to write here.

Greetings, Mathes


(Jsewill) #244

Well, the thing is, there are two languages in use here, Python and GLSL. Blender Game Engine has a Python API that lets us access much of Blender and the BGE at runtime, which are written in C.

First lets talk about GLSL. The link you referenced (http://en.wikibooks.org/wiki/GLSL_Programming/Blender) gives you a good basic understanding of GLSL (at least the specification blender currently implements), especially as it pertains to blender.

Lastly, in the BGE we’re limited by what has been implemented in the Python API. So, in terms of that, you can see what is available to you by looking at the current release’ documentation here: http://www.blender.org/documentation/blender_python_api_2_70_4/

Yes, this discussion should continue in another thread.


(Mahalin) #245

Can someone update the water shader (v0.99 one)? It doesn’t seem to work anymore on 2.7.


(Jsewill) #246

It works for me in the 2.70a release. Did you get any errors in the console when you tried it?


(Mahalin) #247

Ah, okay I switched to using my dedicated card (GeForce 610M) and it works properly. I could’ve sworn it used to work properly with my integrated card (Intel HD4000).


(rombout) #248

This is really stunning work! that code makes me scary :slight_smile:


(papalagi) #249

Hello martinsh,

i love your water / underwater shader, i’m playing with v0.99

i’d like to use it in one of my projects (despite your advice not to do so), i’m trying to add objects to it, but looks like they need to have the “ground” material in order to be correctly influenced by illumination and caustics

would you share some informations on how to have other material render correctly with your setup?

thanks in advance


(Ace Dragon) #250

Just a heads up should any of you decide to use these shaders in a serious project.

You will need to make additions to the existing code that will discard the generated video textures when you change the scene or restart the current one. Otherwise the texture will break and you will just get the test grid.

To delete the textures when doing such a thing, just add something like del(myTexture). Don’t forget to make sure the rest of the code stops running before you do though.

I have already used this successfully in one of my larger game projects, but the lack of what I said above can easily lead to frustration for those who don’t know much about how the video textures work.


(papalagi) #251

Hello Ace Dragon,

thank you for your answer, the problem is that i don’t have a clear idea of the way the system works, you imply some knowledge of it…


(cdo1955) #252

is there a download blend for the update #3 seen at this youtube site https://www.youtube.com/watch?v=nv89chmj6b4.


(gizd) #253

Hello,

Could anyone tell me what I should do If I wanna create two other types of water on one scene(example: lake and a river)? I changed the name of material and a script “watershader_high” is working but script “watertexture.py” not. I tried to modify the script but it’s still don’t work. Any tips?


(adriansnetlis) #254

Hi, Martin!
Are you Latvian?:slight_smile:
Es esmu latvietis:D


(BluePrintRandom) #255

Can someone mix this OpenGL goodness with the dynamic wave system in resources,

If someone could do a optimized by distance version of it, with this shader applied to the waves generated,in real time…


(adriansnetlis) #256

I hope this describes my problem enaugh… I have the same issues for both- 0.99 and 0.95 water/underwater shaders, but not the watersurface…


(pqftgs) #257

I get that on my test machine with Intel integrated graphics.
Disabling clip planes in watertexture.py fixes it for the most part, but I still get weird artifacts. And it’s damn slow either way.

Since you have an nvidia card, I’d say install the latest proprietary driver and provide a simpler water setup for lesser machines to fall back on.


(adriansnetlis) #258

So with less words you mean- driver?


(carlo697) #259

Try deleting the lines 99, 100, 101, 114, 142, 143, 144 and 156 in watertexture.py
That delete the plane clipping and it help me, but I have a Intel integrated, but well It is not bad to test.


(adriansnetlis) #260

Wow! Thanks, that works. Could you tell me the lines in the v0.95 so I can use it(requeres less performance). However, I have a chance to get better computer soon, lets see if I do(for myself instead of all family:))…