Barycentric coordinates in Custom Expression Node

Your feedback is very important to us. We are listening.

Barycentric coordinates in Custom Expression Node

Postby francois85 » Mon Oct 15, 2018 2:59 pm

Hello,

Im wondering if someone can help me with the Custom Expression Node. Im not sure why it is not working. Basically Im trying to use it to blend 3 textures together inside a given triangle.

Im my example I broke it down the the smallest components possible.I pass the 3 points of my triangle (a,b,c) and p (vertex position node). I calculate the barycentric coordinates(u, v, w). Then I check if p is inside my triangle by making sure the sum of u+v+w is <=1 (image has typo of * but I use +). If true I return the desired blend weigh (u,v,w) to a Weighted Blend node and a texture index to my texture array.

Im not seeing any affect, I would expect my triangle to have a different color than the surrounding triangles and have a gradient blend.

Please help I not sure if the Nodes are used correctly
Attachments
Screen Shot 2018-10-15 at 7.39.25 AM.png
Screen Shot 2018-10-15 at 7.39.25 AM.png (123.47 KiB) Viewed 3604 times
Screen Shot 2018-10-15 at 7.35.34 AM.png
Screen Shot 2018-10-15 at 7.35.34 AM.png (212.02 KiB) Viewed 3604 times
Screen Shot 2018-10-15 at 7.18.49 AM.png
Screen Shot 2018-10-15 at 7.18.49 AM.png (211.6 KiB) Viewed 3604 times
francois85
 
Posts: 32
Joined: Thu Oct 04, 2018 2:20 pm

Re: Barycentric coordinates in Custom Expression Node

Postby francois85 » Tue Oct 16, 2018 7:19 am

Ive narrowed it down to the Custom Expression Node. Either its a bug or I have it setup wrong. In the setup below I try and return a float3 to the summed blend node weight and it renders black but when I connect the same values through a vector it works. Im I doing something wrong in the expression?
Attachments
Screen Shot 2018-10-16 at 12.19.58 AM.png
Screen Shot 2018-10-16 at 12.19.58 AM.png (181.13 KiB) Viewed 3570 times
Screen Shot 2018-10-16 at 12.12.23 AM.png
Screen Shot 2018-10-16 at 12.12.23 AM.png (253.2 KiB) Viewed 3571 times
francois85
 
Posts: 32
Joined: Thu Oct 04, 2018 2:20 pm

Re: Barycentric coordinates in Custom Expression Node

Postby Amplify_Borba » Tue Oct 16, 2018 1:41 pm

Hey there!

From what I can tell by the screenshots you've shared, you'll need to specify the type of the values you're assigning to the variables.

Please consider the example shared below:

Image

In this example, I'm declaring a variable within the function's scope, "myVector", which will be returned through the Out port, and a I'm initializing the custom Out0 output as a different value.

Please let me know if this helps, thanks!
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
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Barycentric coordinates in Custom Expression Node

Postby francois85 » Sat Oct 20, 2018 5:06 am

Very helpful as alway thanks for the reply. I got confuse when the out mode created an input plug but your help got me back on track

Awesome tool love the power it give
francois85
 
Posts: 32
Joined: Thu Oct 04, 2018 2:20 pm

Re: Barycentric coordinates in Custom Expression Node

Postby Amplify_Borba » Mon Oct 22, 2018 10:48 am

No problem, happy to know you're having a good time with ASE!

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, every bit helps and your feedback is extremely valuable to us!

Feel free to get back in touch if you have further issues or questions, thanks!
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
Amplify_Borba
 
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron