BrushDoubleSided brush[,enable]
Parameters
|
brush - brush handle enable (optional) - True draws both sides of each surface, False culls back faces; True (default) |
Description
|
Draws both sides of the surfaces painted with a Standard brush. Normally the renderer skips faces that point away from the camera, which is exactly right for closed models like crates and characters. Geometry that is only one polygon thick - leaves, cloth, capes, playing cards, fences - disappears when seen from behind. Enable double-sided rendering on those brushes and both sides are drawn. Leave it disabled for closed meshes: back-face culling is free performance, and double-sided closed models just pay to draw their own insides. Calling this command attaches the Standard material to the brush automatically. Double-sided rendering pairs naturally with mask-mode transparency for foliage - see alpha and sidedness in the shader guide. Requires Extended mode. See also: BrushAlphaMode, BrushStandard, EntityFX. |
Example
; BrushDoubleSided Example ; ------------------------ ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,1,-5 light=CreateLight() RotateEntity light,35,-30,0 brush=CreateStandardBrush(255,170,70) ; A plane is a one-sided surface, ideal for showing back-face culling plane=CreatePlane() double_sided=True tilt#=0 While Not KeyDown(1) ; Press Space to toggle double-sided rendering If KeyHit(57) Then double_sided=Not double_sided ; Apply the sidedness and repaint the plane BrushDoubleSided brush,double_sided PaintEntity plane,brush ; Tumble the plane so its underside faces the camera half the time tilt=tilt+1 RotateEntity plane,tilt,0,0 ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 RenderWorld Color 255,255,255 Text 0,0,"Space: toggle sidedness Arrow keys: move camera Esc: exit" Text 0,20,"BrushDoubleSided brush,"+double_sided+" (0 hides the plane's back face)" Flip Wend FreeBrush brush End
Index