Shader Help

Node-based Shader Editor

Shader Help

Postby JamesMillsDev » Tue Sep 04, 2018 11:40 am

Hello,

I am attempting to make a Voxel based game with Biomes and I would like to color each biome differently. I would like to check if the part of the texture we are looking at is greyscale, and color it if it is... please keep in mind though, that a single side of a block can have a texture that has greyscale AND colored parts to it... is there a way to achieve this? and if so, please elaborate...
JamesMillsDev
 
Posts: 5
Joined: Tue Sep 04, 2018 11:31 am

Re: Shader Help

Postby Ricardo Teixeira » Tue Sep 04, 2018 2:42 pm

JamesMillsDev wrote:Hello,

I am attempting to make a Voxel based game with Biomes and I would like to color each biome differently. I would like to check if the part of the texture we are looking at is greyscale, and color it if it is... please keep in mind though, that a single side of a block can have a texture that has greyscale AND colored parts to it... is there a way to achieve this? and if so, please elaborate...


Hello,

We would be happy to help but please keep in mind that this forum is aimed mainly at technical support.

It really depends on what you're trying to setup, you could try comparing a color directly but I'm not sure if that's all you need. (check the UV Light Reveal sample, it compares light color to a custom value ) From your description it sounds that you might need a few additional scripts beyond the scope of our editor.

What's the intended goal here after you "check the value of the texture"?

Thanks!
Sales & 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
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Shader Help

Postby JamesMillsDev » Tue Sep 11, 2018 9:49 am

Hello,
Thanks for the reply. Sorry, didn't realise it was mainly tech support!

For purely educational and fun purposes, I am working on a Minecraft clone and I am attempting to implement the block colouring system low, which means that I have two textures for the side of the grass block, one with the grass bit that is grey scale and one that is coloured which is the dirt bit, and I would only like to colour the grass bit runtime, then add them together to create the one texture for the side of the block.
JamesMillsDev
 
Posts: 5
Joined: Tue Sep 04, 2018 11:31 am

Re: Shader Help

Postby Ricardo Teixeira » Tue Sep 11, 2018 11:01 am

JamesMillsDev wrote:Hello,
Thanks for the reply. Sorry, didn't realise it was mainly tech support!

For purely educational and fun purposes, I am working on a Minecraft clone and I am attempting to implement the block colouring system low, which means that I have two textures for the side of the grass block, one with the grass bit that is grey scale and one that is coloured which is the dirt bit, and I would only like to colour the grass bit runtime, then add them together to create the one texture for the side of the block.


No problem but you might get more replies in the Unity forum, general or the official ASE thread.

In this case you'll want to create a mask to control which area is affected. Did you create the cube in an external application?
Sales & 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
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Shader Help

Postby JamesMillsDev » Mon Sep 17, 2018 7:54 am

Yeah, I think I'll do that too.

But I am dynamically generating the meshes using c#...

How would I go about using a mask in this case?
JamesMillsDev
 
Posts: 5
Joined: Tue Sep 04, 2018 11:31 am

Re: Shader Help

Postby Ricardo Teixeira » Mon Sep 17, 2018 10:03 am

JamesMillsDev wrote:Yeah, I think I'll do that too.

But I am dynamically generating the meshes using c#...

How would I go about using a mask in this case?


There are a couple of ways in which you can achieve that effect, it really depends on how you decide to handle it. I recommend looking into UV generation in Unity, on the shader side you would only need to apply the desired affect to specific areas.

Using a Rubic Cube as an example, each face is placed in a different uv position:
Image

Resulting in something like this:
Image

Be sure to check the available documentation.

Hope it helps!
Sales & 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
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Shader Help

Postby JamesMillsDev » Mon Sep 17, 2018 11:08 am

Hello,

Sorry, I think you have missed the point of the post, I already have UV's setup, I just need to dynamically colour a specific part of the face using vertex painting on greyscale parts of the texture
JamesMillsDev
 
Posts: 5
Joined: Tue Sep 04, 2018 11:31 am

Re: Shader Help

Postby Ricardo Teixeira » Mon Sep 17, 2018 11:15 am

JamesMillsDev wrote:Hello,

Sorry, I think you have missed the point of the post, I already have UV's setup, I just need to dynamically colour a specific part of the face using vertex painting on greyscale parts of the texture


No problem!

In that case you just need to use the Vertex Color node to access the information you're painting or assigning to your mesh.
Sales & 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
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm

Re: Shader Help

Postby JamesMillsDev » Mon Sep 17, 2018 11:23 am

Sorry,

I still don't think you understand fully what I am asking... I need to only colour part of a texture... that is the question. How would I colour anything in a texture that is greyscale... this texture could also have non greyscale parts to it
JamesMillsDev
 
Posts: 5
Joined: Tue Sep 04, 2018 11:31 am

Re: Shader Help

Postby Ricardo Teixeira » Mon Sep 17, 2018 11:29 am

JamesMillsDev wrote:Sorry,

I still don't think you understand fully what I am asking... I need to only colour part of a texture... that is the question. How would I colour anything in a texture that is greyscale... this texture could also have non greyscale parts to it


Not sure I understand what you mean, you mentioned vertex color, can you provide an example?

It usually works like this:
-The Mesh has specific UV's that assign parts of your texture to each area.(regardless of being gray scale or not)
-Vertex Color is used as the actual "mask" that defines what should be displayed, as show in our node page.

Please elaborate.
Sales & 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
Ricardo Teixeira
 
Posts: 954
Joined: Fri Aug 09, 2013 2:26 pm


Return to Amplify Shader Editor

Who is online

Users browsing this forum: No registered users and 3 guests

cron