I'm looking for a shader CG or HLSL, that can count number of red pixels or any other colors that I want.
相关问题
- Unity - Get Random Color at Spawning
- Direct2D Only Partially Linking in C++ Builder
- Unity3D WebGL Headless not rendering
- glsl pyOpenGL array passing
- Unity3D loading resources after build
相关文章
- Programmatically setting and saving the icon assoc
- Omnisharp in VS Code produces a lot of warnings ab
- Call non-static methods on custom Unity Android Pl
- Behavior of uniforms after glUseProgram() and spee
- How can a game created in Unity can run on an Andr
- How to smooth the blocks of a 3D voxel world?
- Calculating Vertex Normals of a mesh [duplicate]
- How to add Persistent Listener to Button.onClick e
You could do this with atomic counters in a fragment shader. Just test the output color to see if it's within a certain tolerance of red, and if so, increment the counter. After the draw call you should be able to read the counter's value on the CPU and do whatever you like with it.
edit: added a very simple example fragment shader:
You would also need to set up the atomic counter in your code: