source-pbr icon indicating copy to clipboard operation
source-pbr copied to clipboard

Strange bug over brightening meshes with a projectedtexture.

Open One-Trick-Viper opened this issue 4 years ago • 0 comments

I've had this bug for a while, completely unsure as to what it could be.

Whenever a projectedtexture is cast from a relatively far distance onto a model, it seems to render the model at max brightness no matter what the actual lamp's brightness value is.

Examples:

Mesh over brightening: image

The lamp's brightness values: image

update: OK, it seems to be an issue regarding the FarZ of the projectedtexture. By the looks of it, the shader doesn't account for possible loss in brightness when the lamp is cast from far away with a high FarZ value, instead what I think it does is take the default FarZ value of 1024 and keeps the brightness from that value meaning it doesn't update with the changes to the FarZ value.

Which explains as to why projectedtextures look absolutely fine from up close (player flashlights), but seem to mess up once the projectedtexture is casted from far away.

One-Trick-Viper avatar Jul 18 '20 00:07 One-Trick-Viper