Serialize only visible nodes