danni.coy Posted February 5, 2013 Share Posted February 5, 2013 I created an expression that uses ObjectWater.getHeight() to make objects appear to be floating in the water. It looks great up close but at a distance the objects appear above the waterline. Link to comment
nat.harrold Posted February 5, 2013 Share Posted February 5, 2013 We know the reason, though we cannot find the fix. To elaborate: This error / or visual bug we have, is to do with the absence of a relationship between the rendered wave falloff (re:wave_radius in the shader) versus the actual vertex deformation of the non-rendered wave function called by ObjectWater.getHeight() not having the falloff. (We looked at the shaders but appear to be to stupid to work out the maths to make this correction for the ObjectWater.getHeight() to respect the falloff in the shader) Our question is: How do we (urgently) compensate for the difference listed above so the the expression using ObjectWater.getHeight() returns the height including the rendered wave falloff? Thanks in advance. Nat. Link to comment
danni.coy Posted February 8, 2013 Author Share Posted February 8, 2013 ok we managed to compensate for this using linear interpolation float ratio = 1 - ( clamp( abs( length(p-player.getWorldPosition()) ), 0.f, radius ) / radius ); pos.z = (pos.z - water.getHeight()) * ratio; normal = lerp(vec3(0.f,0.f,1.f),normal,ratio); Link to comment
manguste Posted February 22, 2013 Share Posted February 22, 2013 Danni, thank you for sharing that in case anybody needs it as well. Link to comment
Recommended Posts