Texture in screenspace UV - how to fix position/offset

Node-based Shader Editor
Post Reply
pdrummond
Posts: 26
Joined: Wed Sep 19, 2018 12:28 pm

Texture in screenspace UV - how to fix position/offset

Post 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
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

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

Post 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.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
pdrummond
Posts: 26
Joined: Wed Sep 19, 2018 12:28 pm

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

Post 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.
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

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

Post 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.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
pdrummond
Posts: 26
Joined: Wed Sep 19, 2018 12:28 pm

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

Post by pdrummond »

Thank you!
Post Reply