Page 1 of 1

Scale screen space texture according to distance of object

PostPosted: Fri Nov 30, 2018 8:43 am
by KennyGuillaume
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.

Re: Scale screen space texture according to distance of obje

PostPosted: Mon Dec 03, 2018 11:35 am
by Ricardo Teixeira
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!

Re: Scale screen space texture according to distance of obje

PostPosted: Wed Dec 05, 2018 10:27 am
by KennyGuillaume
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.

Re: Scale screen space texture according to distance of obje

PostPosted: Wed Dec 05, 2018 11:02 am
by Ricardo Teixeira
No problem!