3d texture shader


im having trouble with my glsl code. im new to glsl so sorry if there’s a misunderstanding here and there.

so im trying to build a dynamic 3D texture to an object, where the third coordinate is mapped to the camera-to-pixel direction. so when i move my camera, the vertex shader check the direction from vertex to camera, and find the proper z index for the 3D texture.

the camera index is in spherical coordinate, 0-180 azimuth and altitude. so the index should mapped from 0-180 to 0-1 considering the z coordinate for the texture is 0-1.

here is the shaders code:

but when i run the program, is shows blank screen. any1 know where did i miss?

thanks in advance

EDIT: my spherical coordinate use vector3(radius, azimuth, altitude). radius is always 1. however, i dont think the problem on this one.