Page 1 of 2

Odd behaviour with objects of differing scale.

PostPosted: Wed May 16, 2018 11:44 am
by funselektor
Hey!

Relatively new to Amplify shader, but it's been very useful and powerful so far!

Been running into a strange issue where the scale of objects leads to different behaviour of the shader on Unity 2018.1.0f1 on Windows 10.

Here's an example with my triplanar shader (and I'm aware of the Amplify Triplanar sample, but I need more control over the falloff so I'm making this!)

So the sphere w/ Scale of 1,1,1 acts as expected, but when the scale is increased the effect doesn't work as expected. I tried a bunch of googling but couldn't see an issue, is there some beginner mistake that I'm making?

Image

Image

And here's the triplanar sample for sanity which works as expected (http://wiki.amplify.pt/index.php?title= ... nar_Sample)
Image

Re: Odd behaviour with objects of differing scale.

PostPosted: Wed May 16, 2018 5:47 pm
by Amplify_Borba
Hey there, thank you for the kind words and support!

Depending on the type of effect you're creating, you could potentially use the Vertex Position node to ensure that the effect that is bound to the object stays exactly the same even if it changes position, rotation or size.

I would also recommend examining the PositionCutOff ( local and world ) and SnowAccum samples, as well as the TriplanarProjection.

Please let me know if this helps, and don't hesitate to let me know if you have any further questions, thanks!

Re: Odd behaviour with objects of differing scale.

PostPosted: Fri May 18, 2018 6:16 pm
by funselektor
Amplify_Borba wrote:Hey there, thank you for the kind words and support!

Depending on the type of effect you're creating, you could potentially use the Vertex Position node to ensure that the effect that is bound to the object stays exactly the same even if it changes position, rotation or size.

I would also recommend examining the PositionCutOff ( local and world ) and SnowAccum samples, as well as the TriplanarProjection.

Please let me know if this helps, and don't hesitate to let me know if you have any further questions, thanks!


Thanks for the quick answer!

After checking out those examples it turns out the World Normal node was the one to use.

This shader is for a road and is trying to replicate the Standard Shader with the Transparent or Cutout Rendering Mode but with Triplanar Projection to make the steeper parts of the road darker.

One other thing I'm wondering about is how to make the shader receive shadows? I've tried different combinations of the Blend Mode to no avail.The following screenshot shows a road w/ my shader and the Standard Shader side-by-side and the Standard shader does accept shadows so perhaps my configuration needs to be tuned?

Re: Odd behaviour with objects of differing scale.

PostPosted: Mon May 21, 2018 10:31 am
by Amplify_Borba
Could you send us a simple project with the issue present, so that we can check whether it's an expected result or a potential issue?

Could you also elaborate on why you intend to use triplanar, and if you're going to use it on the rest of your terrain as well?

Feel free to attach it to your reply, or send it over through [email protected], thanks!

Re: Odd behaviour with objects of differing scale.

PostPosted: Mon May 21, 2018 6:57 pm
by funselektor
I just intend to use this triplanar shader on the road so that it's easier to see changes in elevation.

The road is a separate mesh that is on top of the terrain, so the terrain would not be using this shader.

Ok I will email a project over in Unity 2018.1.0f2, just making it now!

Re: Odd behaviour with objects of differing scale.

PostPosted: Tue May 22, 2018 10:42 am
by Amplify_Borba
Thank you for sending the sample, I've noticed that you have the Blend mode set to Transparent, which is working as expected since transparent surfaces have no concept of depth, making them unable to cast or receive shadows.

There are a couple of workarounds which you could try, I suggest setting the Blend mode to Masked or Custom, and experiment with different Render Type and Queue settings in order to enable the required ports on the Output node. Making use of Cutout would be ideal for this sort of effect.

Please let me know if you have any further questions.

Re: Odd behaviour with objects of differing scale.

PostPosted: Tue May 22, 2018 8:51 pm
by funselektor
Thanks so much for the help and suggestions, Cutout & Alpha Test w/ an Opacity Mask did the trick!

Re: Odd behaviour with objects of differing scale.

PostPosted: Wed May 23, 2018 9:05 am
by Amplify_Borba
No problem, glad I could help!

Have you had the chance to rate and review Amplify Shader Editor? It would be awesome if you could share your experience with the Unity community, the Unity Asset Store thrives on user interaction and direct feedback.
Every bit helps, your feedback is extremely valuable to us!

Feel free to get back in touch if you have further issues or questions, thanks!

Re: Odd behaviour with objects of differing scale.

PostPosted: Wed May 23, 2018 4:50 pm
by funselektor
Yep left a nice rating through the unity editor already. Moved over from Shader Forge and will definitely recommend Amplify to everyone I know!

Re: Odd behaviour with objects of differing scale.

PostPosted: Wed May 23, 2018 5:20 pm
by Amplify_Borba
Thank you for your support and for taking the time to review ASE, it truly means alot to us!

Don't hesitate to get back in touch if you come across any further questions or issues, we're looking forward to see what you create with ASE, thanks!