Page 1 of 1

Projector questions

PostPosted: Fri Jan 18, 2019 9:52 pm
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

Re: Projector questions

PostPosted: Mon Jan 21, 2019 4:40 pm
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.

Re: Projector questions

PostPosted: Mon Jan 21, 2019 7:03 pm
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.

Re: Projector questions

PostPosted: Tue Jan 22, 2019 2:54 pm
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

Re: Projector questions

PostPosted: Tue Jan 22, 2019 3:30 pm
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.

Re: Projector questions

PostPosted: Fri Jan 25, 2019 9:52 pm
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.

Re: Projector questions

PostPosted: Mon Jan 28, 2019 4:34 pm
by Amplify_Borba
No problem, please don't hesitate to get back in touch if you come across any further issues or questions!