The last file does not use nodes. It has a custom shader applied to it.
I finally finished proper reflection/refraction texture rendering.
Now the reflecting/refracting plane can be anywhere in any orientation.
Here are some of the uses of the technique:
blend: (Blender 2.6x only) http://dl.dropbox.com/u/11542084/reflection_shaders_1.0.blend
works fine in Blender 2.60
on old iMac 2006
Intel Core 2 Duo 2 GHz
ATI,RadeonX1600
I would like to hear how it works for you guys.
blend file has scenes:
“ground reflect” - tiled reflecting floor
“reflect” - just reflection of stained glass
“refract” - just refraction of stained glass
“refract_object” - refracting suzanne
“stained_glass” - stained glass
“stained_glass_2” - stained glass without diffuse texture
“wall_mirror” - simple vertical mirror
btw, yah it does some weird things in Blender 2.5x
I guess some stuff in bge.mathutils has changed since 2.5
So I strongly suggest you open the blend in 2.6x
… eventually taking BGE to a Level that I always dreamt of.
I thank you very, very much for this, martinsh! : )
These Methods should be implemented as Standard Material/Texture Options. This is one of these exact Things that People want to see from a Game Engine, and imagine how much BGE could be pushed if such Effects one of the Basic Methods for every BGE Beginner (achieving good Graphics easily can be very motivating).
Instead of the beautiful water I get this error on the console:
----Fragment shader error ----
0(39) : error C1105: cannot call a non-function
---- Fragment shader failed to compile ----
I just downloaded 2.6 off the Blender site and tried to run your newest file, and what do you know, I got a bunch of shader errors in the console. Obviously, the shader doesn’t work. There are too many errors to type up, so here’s a picture:
…Something is very, very wrong:(
Any idea what the problem could be? Maybe I should update my gpu driver?
I get black meshes when I press ‘P’, maybe because I’m using a recent SVN build and not the official release (which I know there were some changes since 2.61).
My GeForce 8800GT works with GLSL and the 2D filters so it might be that this will need an update for the newer revisions.
Thanks laser blaster, this helps a lot. I think I fixed the issue. It was a small mistake, but I though my ATI card would point it out.
Now take a look at the files, please. I have replaced them with fixed ones (at least I hope so…)
C.A.ligári thanks. Yeah having real reflections and refractions for masses as a built-in function in materials options would be something awesome for BGE. Harmony branch will surely make this an easier task.
I still get a fault message from the fragmet shader in the planar_reflections_1.0.blend file.
The fault is in the script line 68 (fragmet shader line 39), because reflect is a 2D texture it is no function “vec2 rcoord = (reflect(vVec,nVec).st);”.
It’s not a black plane anymore, but there are still issues for me. The first is that glClipPlane simply doesn’t work. Things that are below the water are reflected and things that are above it are refracted. The second issue is that I only get refractions, no reflections. If I swap the texture slots that the refractions and reflections render to, then I can get reflections to work instead of refractions. I’m not getting any errors in the console anymore.
Edit: I found the source of the problem. The fresnel term is coming out all black, all the time, so only the refraction is being shown.
everything seems to work, however the water demo you posted has an odd bug with the reflection. it looks like the reflection starts higher than the waters surface.
OWWWW!!!
What i can say? After all amazing works it’s not a surprise, but i’m just astonished with the results.
Project the reflection in View Space is a clever trick,
I can see 2012 will be a happy year for bge lovers xD
Congrats and really thanks for share!
Your work really adds a huge value to BGE
Amazingly nice! too bad isnt too flexible ,like applying to already made materials without “Shadeless” enabled, multiple textures and ramps.
I might be wrong tho.
Great Job anyway!