Back to Filament

setPolygonOffset

docs/android/dokka/filament-android/com.google.android.filament/-material-instance/set-polygon-offset.md

1.75.01.2 KB
Original Source

//filament-android/com.google.android.filament/MaterialInstance/setPolygonOffset

setPolygonOffset

[main]
open fun setPolygonOffset(scale: Float, constant: Float)

Sets a polygon offset that will be applied to all renderables drawn with this material instance. The value of the offset is scale * dz + r * constant, where dz is the change in depth relative to the screen area of the triangle, and r is the smallest value that is guaranteed to produce a resolvable offset for a given implementation. This offset is added before the depth test. Warning: using a polygon offset other than zero has a significant negative performance impact, as most implementations have to disable early depth culling. DO NOT USE unless absolutely necessary.

Parameters

main

scalescale factor used to create a variable depth offset for each triangle
constantscale factor used to create a constant depth offset for each triangle