3d texture

hi
I want to render volume date(like a cube) with 3d texture .I dont know how to ascertain the texcoord when the texture inside of the cube,it is changede for exanple some times it is triangle,
but sometimes it is polygon. Maybe it is a math problem ,but I really want someone who could give me some advise.Thank you !

If you mean that the slice might be cut at an angle such that the cross section is a triangle then you simply need to determine the intersection of the lines of the faces of the cube with the plane used to slice the cube. In other words google “line plane intersection”.