Projector questions

Node-based Shader Editor
Post Reply
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Projector questions

Post by mossman »

Hello,

I saw the projector example, is very useful. I created a custom shader derived from this example. But I have two questions.

It is possible that the projection has a intensity attenuation by the distance like the light of a spotlight?

It is possible make that the projector only projects in the front side of the destination mesh?

Thanks
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Projector questions

Post by Amplify_Borba »

Hello, the Falloff Texture is already responsible for attenuation of the projection, and you can further modify this node setup and / or change the texture in order to get a different or more noticeable effect:

Image

The other question is quite tricky, and the following solution is not very elegant and might not work for all situations:

Image

Image

We've tweaked the ProjectLight sample shader in order to limit the projected area, which seems to be working decently for the standard sphere, and further increases the complexity of the shader. It would be a complicated endeavor to figure out how to achieve a correct display for all types of meshes, but it might just be possible.
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!
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Projector questions

Post by mossman »

Hello,


Many thanks for the quick response. All the test that I made with this solution are good.

Also I will try other approach.
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Projector questions

Post by mossman »

Hello,

I tried various approach to get the backface culling but your approach is better for now.

The result is nice with all the meshes that I test.

Now I am trying to make that objects nearest to projector culls the projection on the objects farest to projector.

This image illustrates the problem. The brown cube does not occlude the projection in the grey plane.

Image

Thanks
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Projector questions

Post by Amplify_Borba »

I'm afraid that won't be possible through a shader, at least not to my knowledge.

As it states in the documentation, "A Projector allows you to project a Material onto all objects that intersect its frustum.", so you'd have to either adjust its far clipping plane so that the frustum won't intersect with unintended geometry, or alternatively use the Ignore Layers parameter and set the geometry you don't want to be affected in an ignored layer.
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!
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Projector questions

Post by mossman »

I think the same. I reviewed the source code of Projector component to understand how works but the code is incomplete. I is a shame.

Thanks for all.
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Projector questions

Post by Amplify_Borba »

No problem, please don't hesitate to get back in touch if you come across any further issues or questions!
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!
Post Reply