proper texture projection onto a surface?


👉Blast3D is now FREE👈

Support Future Updates by Becoming a Blitz Backer on Patreon.

 

Tweet
subzerocatalyst

i've been trying to improve upon an issue with a demo that fredborg has made a while back, specifically the spotlight demo. the issue is that the light distort at corners in a way that looks... bad. i've tried various formulas for calculating the uvs, and none have yielded good results.

with dist being the length of the position relative to the light source, and dot being the negative z of the normal relative to the light, such formulas are:

tu# = (((x)*dist)+0.5)
tv# = (1.0-(((y)*dist)+0.5))

Image

tu# = (((x)*dist)+0.5)/dot
tv# = (1.0-(((y)*dist)+0.5))

Image
and, worst of all:

tu# = (((x*z)*dist)+0.5)
tv# = (1.0-(((y*z)*dist)+0.5))

Image
if you have any idea on how to make this project work properly, please share. i have been suffering and bashing my head with this for too much time, fruitlessly.

RasterRon commented:

For reference, this could be the demo that you're talking about:

subzerocatalyst commented:

yes, that's the one. you can see the incorrect mapping of the spotlight texture near edges very clearly in the video, which is what i'm trying to fix. do you have any suggestions for how to fix this?

RasterRon commented:

you can try tweaking with the uv coordinates position and scale to the final applied texture.

alternatively, if you need a flashlight feature there are other methods of achieving this like having a mask on screen
like this one:

Reply To Topic (minimum 10 characters)

Please log in to reply