当前位置:网站首页>Chapter 8 primitive processing of OpenGL super classic (version 7)
Chapter 8 primitive processing of OpenGL super classic (version 7)
2022-06-30 05:01:00 【Jason_ Chen__】
Primitive processing
- One 、 Surface subdivision
- Two 、 Geometry shaders
- 1. Transfer geometry shaders
- 2. Use geometry shaders in your application
- 3. Delete geometry in geometry shader
- 4. Modify the geometry in the geometry shader
- 5. Generate geometry in geometry shaders
- 6. Modify primitive types in geometry shaders
- 7. Multiple storage streams
- 8. Introducing new primitive types through geometry shaders
- 9. Multiple viewport conversions
One 、 Surface subdivision
Put a triangle ( Or quadrilateral, etc ), Meshing generates more internal triangles
1. Surface subdivision primitive mode
gl_TessLevelInner[]: Inside the graph
gl_TessLevelOuter[]: Outside the graph
(1) Use four view surface tessellation
Four views : quadrilateral
gl_TessLevelInner[]: The length is 2, Inside the graph , Separately control the long 、 The number of wide segments
gl_TessLevelOuter[]: The length is 4, Outside the graph , Respectively control the number of segments divided into four sides
(2) Surface tessellation using triangles
gl_TessLevelInner[]: The length is 1
gl_TessLevelOuter[]: The length is 4
(3) Surface tessellation using isolines
gl_TessLevelOuter[]: Only this , The length is 2, Respectively control the number of lines and the number of segments divided by lines
(4) Surface subdivision point mode
Render as points
2. Surface subdivision mode
(1) Surface subdivision three sub segmentation modes :
equal_spacing: Segmented equidistant mode , shortcoming : The surface tessellation factor is rounded up to the nearest integer , The level may jump , The following two are the solutions to this problem
fractional_even_spacing: Segmented even spacing mode , The surface tessellation factor is rounded down to the nearest even number
fractional_odd_spacing:: Segmented odd spacing mode , The surface tessellation factor is rounded down to the nearest odd number
(2) Control the wrapping order
cw: Clockwise
ccw: Anti-clockwise
3. Data transfer between surface subdivision shaders
(1) The surface tessellation evaluation shader is the same as the surface tessellation control shader , Run once for each generated vertex , You can access all vertex data in the patch
(2) Vertex data is passed in addition to the array form , It can also directly transfer the data between the constant stages on the whole patch (Patch keyword )
(3) No surface tessellation controls the rendering of shaders , The default value for the subdivision level of internal and external surfaces is 1.0, It can be done by void glPatchParameterfv() change
4. Shader call communication
(1) Each output in the surface tessellation control shader is an array , The length is equal to the number of control points in the output patch
(2) The surface tessellation control shader can read its output variables , To confirm whether the output variable is actually written , Added barrier() function , Flow control barrier
5. Example : terrain render
6. Example : Three Bezier patches
Two 、 Geometry shaders
sketch : Shaders that handle primitives , A primitive runs once , A primitive can be a dot 、 Line segments or triangles .
1. Transfer geometry shaders
The output can only be points、line_strip and triangle_strip, have access to EndPrimitive() Indirectly become points、lines and triangles
2. Use geometry shaders in your application
The vertex shader output to the geometry shader becomes an array , Because the geometric shader is based on primitives
3. Delete geometry in geometry shader
sketch : Reduce the number of vertices , It can eliminate objects from different angles
4. Modify the geometry in the geometry shader
sketch : Modify the primitive of Geometry , Model decomposition and model explosion can be realized
5. Generate geometry in geometry shaders
sketch : Generate more objects by increasing the number of vertices
6. Modify primitive types in geometry shaders
sketch : Change primitive type , It can realize the visualization of normal vector
7. Multiple storage streams
sketch : You can configure the 4 Multiple output streams , Render geometry at the same time and store data in the transform cache
Limit :1. The output primitive pattern must be a dot 2. Only the first stream can be rendered , Other streams are used to store
8. Introducing new primitive types through geometry shaders
GL_LINES_ADJACENCY
GL_LINE_STRIP_ADJACENCY
GL_TRIANGLES_ADJACENCY
GL_TRIANGLE_STRIP_ADJACENCY
Do not understand , I'll see it later .
9. Multiple viewport conversions
opengl At least support 16 Three views
void glViewportIndexedf() Set viewport size and boundary
void glViewportIndexedfv() Set viewport binding
void glDepthRangeIndexed() Set the viewport depth range
If you set up multiple viewports at once , You can consider using it glViewportArrayv() and glDepthRangeArrayv()
Built-in variables gl_ViewportIndex You can choose which viewport to render to
边栏推荐
- Lambda&Stream
- [recruitment] UE4 Development Engineer
- Singapore must visit these scenic spots during the Spring Festival
- Ripple effect of mouse click (unity & shader)
- Unity multiple UI page turning left and right
- Connect to the database and run node JS running database shows that the database is missing
- Photon pun refresh hall room list
- Harbor API 2.0 query
- Malignant bug: 1252 of unit MySQL export
- Li Kou 2049: count the number of nodes with the highest score
猜你喜欢
Unreal 4 learning notes - data storage using blueprints
Malignant bug: 1252 of unit MySQL export
PS1 Contemporary Art Center, Museum of modern art, New York
Unreal 4 unavigationsystemv1 compilation error
【Paper】2021_ Uniformity of heterogeneous hybrid multi-level intelligent systems using UGV and UAV
Unity packaging failure solution
PBR material: basic principle and simple fabrication
Autowired注解警告的解决办法
Unreal 4 learning notes - set player birth point
Unity3d lookat parameter description
随机推荐
Connect to the database and run node JS running database shows that the database is missing
Unrealeengine4 - about uobject's giant pit that is automatically GC garbage collected
Yolov5 torch installation
Unity a* road finding force planning
【Paper】2019_ Distributed Cooperative Control of a High-speed Train
Recommended cultural landmarks of these tourist attractions in Bangkok
Introduction to some representations, neighbors and degrees of Graphs
The golden deer, a scenic spot in London -- a sailing museum that tells vivid sailing stories
Moore Manor diary I: realize the reclamation, sowing, watering and harvest in Moore Manor
Operation file file class method
UnityEngine. JsonUtility. The pit of fromjason()
Arsenal Stadium Tour - take you to the front and back of Arsenal Stadium
EasyRecovery数据恢复软件 恢复了我两年前的照片视频数据
【Paper】2021_ Analysis of the Consensus Protocol of Heterogeneous Agents with Time-Delays
Steamvr causes abnormal scene camera
Photon pun refresh hall room list
Detailed explanation of sorting sort method of JS array
Brew install NVM command not found solution
Unit screenshot saved on the phone
Preorder traversal of Li Kou 589:n fork tree