How to render clipped surfaces as solid objects

You want to render a clipped surface as if it were a solid — i.e., not hollow. You can achieve that effect with MeshPhongMaterial — or any three.js material for that matter — with a simple hack to the material shader. material.onBeforeCompile = function( shader ) { shader.fragmentShader = shader.fragmentShader.replace( ‘#include <output_fragment>’, ` vec3 backfaceColor … Read more

How do I focus light or how do I only draw certain circular parts of the window in pygame?

I suggest a solution, which combines a clipping region pygame.Surface.set_clip and drawing a black rectangle with a circular transparent area in the center. Define a radius and create a square pygame.Surface with twice the radius. radius = 50 cover_surf = pygame.Surface((radius*2, radius*2)) Set a white color key which identifies the transparent color (set_colorkey) a nd … Read more