Scale screen space texture according to distance of object

Node-based Shader Editor

Scale screen space texture according to distance of object

Postby KennyGuillaume » Fri Nov 30, 2018 8:43 am

Hi everyone.

I'm trying to achieve an effect where characters are masked by a texture, mapped in screen space. So they look flat.
This is what it currently looks like:

Image

Image

All good, but I want to achieve two more things with this shader:

1. When I walk away from the character (or zoom out) I want the texture to scale down. So that size of the texture looks consistent according to the distance. I kind of achieved this effect already but the problem was that it scaled from the left bottom corner. So it looked like it was panning at the same time. Is there a way to do this?

2. After that, maybe a little trickier, I'd like to minimise the same effect when panning the camera. So according to where the object is on the screen, the texture should pan (I guess?).

The main thing I want to achieve with this shader is, I want the flatness of a screen space shader, but want to eliminate the fact that the texture is 'stuck' to the screen.

I hope it's clear. Any help/tips are much appreciated.
KennyGuillaume
 
Posts: 7
Joined: Mon Feb 05, 2018 1:49 pm

Re: Scale screen space texture according to distance of obje

Postby Ricardo Teixeira » Mon Dec 03, 2018 11:35 am

KennyGuillaume wrote:Hi everyone.

I'm trying to achieve an effect where characters are masked by a texture, mapped in screen space. So they look flat.
This is what it currently looks like:

Image

Image

All good, but I want to achieve two more things with this shader:

1. When I walk away from the character (or zoom out) I want the texture to scale down. So that size of the texture looks consistent according to the distance. I kind of achieved this effect already but the problem was that it scaled from the left bottom corner. So it looked like it was panning at the same time. Is there a way to do this?

2. After that, maybe a little trickier, I'd like to minimise the same effect when panning the camera. So according to where the object is on the screen, the texture should pan (I guess?).

The main thing I want to achieve with this shader is, I want the flatness of a screen space shader, but want to eliminate the fact that the texture is 'stuck' to the screen.

I hope it's clear. Any help/tips are much appreciated.



Greetings,

Thank you for getting in touch, we would be happy to help but please keep in mind that this forum is aimed primarily at technical support.

One of our users as created an excellent example that should serve you well, be sure to check the link below. Please do elaborate on number 2.

Image

Screen Space Texture


Hope it helps!
Sales & 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!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Scale screen space texture according to distance of obje

Postby KennyGuillaume » Wed Dec 05, 2018 10:27 am

Ricardo Teixeira wrote:
KennyGuillaume wrote:Hi everyone.

I'm trying to achieve an effect where characters are masked by a texture, mapped in screen space. So they look flat.
This is what it currently looks like:

Image

Image

All good, but I want to achieve two more things with this shader:

1. When I walk away from the character (or zoom out) I want the texture to scale down. So that size of the texture looks consistent according to the distance. I kind of achieved this effect already but the problem was that it scaled from the left bottom corner. So it looked like it was panning at the same time. Is there a way to do this?

2. After that, maybe a little trickier, I'd like to minimise the same effect when panning the camera. So according to where the object is on the screen, the texture should pan (I guess?).

The main thing I want to achieve with this shader is, I want the flatness of a screen space shader, but want to eliminate the fact that the texture is 'stuck' to the screen.

I hope it's clear. Any help/tips are much appreciated.



Greetings,

Thank you for getting in touch, we would be happy to help but please keep in mind that this forum is aimed primarily at technical support.

One of our users as created an excellent example that should serve you well, be sure to check the link below. Please do elaborate on number 2.

Image

Screen Space Texture


Hope it helps!


This was exactly what I was looking for. Thanks for the help.
KennyGuillaume
 
Posts: 7
Joined: Mon Feb 05, 2018 1:49 pm

Re: Scale screen space texture according to distance of obje

Postby Ricardo Teixeira » Wed Dec 05, 2018 11:02 am

No problem!
Sales & 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!
User avatar
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 0 guests

cron