Shader Help
-
JamesMillsDev
- Posts: 5
- Joined: Tue Sep 04, 2018 11:31 am
Shader Help
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...
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...
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: Shader Help
Hello,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...
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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
-
JamesMillsDev
- Posts: 5
- Joined: Tue Sep 04, 2018 11:31 am
Re: Shader Help
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.
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.
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: Shader Help
No problem but you might get more replies in the Unity forum, general or the official ASE thread.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.
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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
-
JamesMillsDev
- Posts: 5
- Joined: Tue Sep 04, 2018 11:31 am
Re: Shader Help
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?
But I am dynamically generating the meshes using c#...
How would I go about using a mask in this case?
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: Shader Help
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.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?
Using a Rubic Cube as an example, each face is placed in a different uv position:

Resulting in something like this:

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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
-
JamesMillsDev
- Posts: 5
- Joined: Tue Sep 04, 2018 11:31 am
Re: Shader Help
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
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
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: Shader Help
No problem!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
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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
-
JamesMillsDev
- Posts: 5
- Joined: Tue Sep 04, 2018 11:31 am
Re: Shader Help
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
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
- Ricardo Teixeira
- Posts: 954
- Joined: Fri Aug 09, 2013 2:26 pm
Re: Shader Help
Not sure I understand what you mean, you mentioned vertex color, can you provide an example?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
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!
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!