Traditional Culture Encyclopedia - Photography and portraiture - Simple arrangement of polygon clipping in cesium three-dimensional tile model
Simple arrangement of polygon clipping in cesium three-dimensional tile model
Recently, the company's business has been adjusted, and all the business at hand has stopped, only maintenance is left, and it is meaningless to keep it. While changing jobs, I sorted out some things I had copied, consulted and written before. If you are not sure how much you can write, just make a brief record.
Ceisum itself has a clipping plane, but it doesn't support polygon clipping. It takes a lot of effort to support polygon clipping.
The main principle of polygon clipping:
1, build a clipping polygon;
2. Normalize the fixed point of the constructed polygon into the local coordinate system of the model, obtain the model rectangle, record it and transmit it to the chip shader;
3. Render the polygon onto the constructed texture, endow the polygon with the drawn color, and endow the texture to the patch shader;
Fourthly, the fixed point obtained from the attribute is passed to the chip shader in the vertex shader, for example
GL _ Position = czm _ projection * u _ modelViewMatrix * view pos; //Projection matrix * Model view matrix * Vertex coordinates
ViewPos.xyz in
5. In the patch shader, judge whether the vertex is in the rectangle in (2) according to the vertex passed in (4). If so, calculate the uv coordinates of the texture of the vertex in (3), and use texture2D(texture, uv) to obtain the color value of the current vertex. If it is not empty, continue; If it is empty, it is discarded and returned.
Through the above steps, the model clipping with polygon as the boundary can be realized.
- Previous article:What are the ancient forms of travel in China?
- Next article:Zhong Fang qianxun photography
- Related articles
- Model essay on the outline of job search plan
- Which month is the best to travel to the seaside?
- How to shoot illusion photography
- What is a pan-tilt camera?
- Is the manual lens easy to use? What focal length is the most practical? Which one is suitable for Pentax (cheaper, acceptable picture quality)?
- The origin of beginning of spring
- What are the advantages of the drama version and the movie version of love O2O? Which is better?
- Young boys sell "fried shortbread" snacks in the street, including all kinds of vegetables and bananas. Do you want to line up?
- Are there any activities on Arbor Day?
- What does it mean to dream of being imprisoned and unable to escape?