cube map refraction
Blitz3D Forums/Blitz3D Programming/cube map refraction
| ||
how to do refraction effect using cube map? |
| ||
i dont know, but its in the CEM fx demo, get that and analise the source. if any knows where to get it. please post a link - i wanna do the same thing!! |
| ||
I don't think you can do refraction... |
| ||
This is a big guess - but aren't the vertex normals used to lookup the texels in the cubemap? So, inverting the normals to point in the opposite direction should give you refraction instead of reflection. Worth a try ;) |
| ||
check my sig. |
| ||
Nice cube map demo, I like it :) Although the water is still only doing reflection * fresnel term, no refraction... I was thinking if inverting the normals worked, then you could have two copies of the mesh, one with the normals the correct way (for lighting and reflection * fresnel alpha) and a copy with inverted normals (for refraction * 1-frensel alpha). Render both meshes and tada! - Reflection & refraction. Should work (in theory!) |
| ||
cant wait to see if ur theory works :) |
| ||
Ah well, it worked in theory - but not in practice (slim chance really) :( Looks like the cubic environment mapping in blitz uses the vertex positions not the normals to provide the lookup, I tried several modes, but none of them what I wanted. So, on to a new theory - even crazier :) Setup the cubic environment map as normal and every frame render an inverted sphere with the cube map on it from the opposite direction the camera is facing. Then, copy this into a texture to provide as the source for a spherical environment map. When rendering the object you want both reflection and refraction, you can multitexture with the first stage being the refraction, using the texture setup previously as a spherical environment map, then the reflection using the normal cubic environment map in the second stage. Works in theory ;) - I'll give it a try... |