I want to graph the function f(x,y)=sin(x)sin(y) on the square $[0,2\pi]\times[0,2\pi]$, but only for values that are smaller than some value, for example 0.5.
This is the graph of the whole function on the square:

Which I created by using the pgfplots package:
\documentclass{article}
\usepackage[margin=0.25in]{geometry}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.9}
\begin{tikzpicture}
\begin{axis}[grid=major]
\addplot3[surf,shader=interp,samples=50,domain=0:2pi,y domain=0:2pi {sin(deg(x))*sin(deg(y))};
\end{axis}
\end{tikzpicture}
\end{document}
I thought that I just can declare that the maximum value of z is 0.5 but this is what I get:

I had an idea to define the function to be f(x,y) for values that are less than 0.5, and 5 otherwise, and then to declare the maximum z value to be 1 for example, but I'm not sure how can I define such function.
Can someone please help me with that? Thank you in advance!
point meta={z>.5 ? nan : z}orrestrict z to domain=-1:.5. See Interrupted Plots and Skipping Or Changing Coordinates – Filters. – Qrrbrbirlbel Aug 15 '23 at 07:50z>.5will be jagged. -to avoid that you can use methods as in e.g. https://tex.stackexchange.com/a/617131/8650 and many other posts. – hpekristiansen Aug 15 '23 at 09:35