Problem with RenderMonkey

I have a problem with renderMonekey. When i apply inversion transformation in vertex shader piece of object which is in negative coordinates disappears…
Vertex shader:

uniform mat4 view_proj_matrix;
attribute vec4 rm_Vertex;
uniform float h;

vec3 inversion(vec3 real, vec3 center, float r)
float d = pow((real[0]-center[0]), 2.0) + pow((real[1]-center[1]), 2.0) + pow((real[2]-center[2]), 2.0);
return (rr/d)(real-center)+center;

void main(void)
float r = sqrt(1.0+(h*h));
vec3 myPos = vec3(rm_Vertex[0]+50.0, rm_Vertex[1]+50.0, rm_Vertex[2]+50.0);
myPos = inversion(myPos, vec3(0.0, 0.0, h), r);
myPos = inversion(myPos, vec3(0.0, 0.0, -h), r);
myPos = myPos;
gl_Position = view_proj_matrix * vec4(myPos, 1.0);
//gl_Position = view_proj_matrix * rm_Vertex;

Any help would be appreciated. Thank you

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.