Page 1 of 1

Texture in screenspace UV - how to fix position/offset

PostPosted: Fri Nov 02, 2018 8:22 pm
by pdrummond
I'm working on a shader that uses Tonal Art Mapping to create non-photorealistic effects. I'm able to blend the tone textures with the light intensity and map it all to screen space UV, but of course I've got the shower door effect where the tone texturing looks like an overlay on the screen. I'd like to lock the texture by applying an offset based on the object's position in screen space. I've tried a few things but I'm stumped. Can you recommend the best approach?

Image

Re: Texture in screenspace UV - how to fix position/offset

PostPosted: Mon Nov 05, 2018 11:28 am
by Amplify_Borba
Hello, I'm not entirely sure on what to suggest without examining the shader itself and, although this is beyond the scope of our support, we might be able to provide some insight if you're able to share a sample with us.

Re: Texture in screenspace UV - how to fix position/offset

PostPosted: Tue Nov 06, 2018 12:47 pm
by pdrummond
Sorry if I wasn't very clear. I'm blending textures in screenspace UV and wondered if there's a way get the x and y position of the target object in screenspace too, so I can use this as on offset for the texture. At the moment the texture simply acts as an overlay across the whole screen, but I'd like to clamp it to the target object so it actually moves with it.

Re: Texture in screenspace UV - how to fix position/offset

PostPosted: Tue Nov 06, 2018 2:53 pm
by Amplify_Borba
No problem, thank you for elaborating!

I believe that this has been previously tackled by another user in this tweet.

Please refer to the comments for a screenshot of the node setup and the code itself, and do let us know if this helps you achieve the intended effect.

Re: Texture in screenspace UV - how to fix position/offset

PostPosted: Wed Nov 07, 2018 10:42 am
by pdrummond
Thank you!