Page 1 of 1
Shader Help
Posted:
Tue Sep 04, 2018 11:40 am
by JamesMillsDev
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...
Re: Shader Help
Posted:
Tue Sep 04, 2018 2:42 pm
by Ricardo Teixeira
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!
Re: Shader Help
Posted:
Tue Sep 11, 2018 9:49 am
by JamesMillsDev
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.
Re: Shader Help
Posted:
Tue Sep 11, 2018 11:01 am
by Ricardo Teixeira
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?
Re: Shader Help
Posted:
Mon Sep 17, 2018 7:54 am
by JamesMillsDev
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?
Re: Shader Help
Posted:
Mon Sep 17, 2018 10:03 am
by Ricardo Teixeira
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:
Resulting in something like this:
Be sure to check the available
documentation.
Hope it helps!
Re: Shader Help
Posted:
Mon Sep 17, 2018 11:08 am
by JamesMillsDev
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
Re: Shader Help
Posted:
Mon Sep 17, 2018 11:15 am
by Ricardo Teixeira
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.
Re: Shader Help
Posted:
Mon Sep 17, 2018 11:23 am
by JamesMillsDev
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
Re: Shader Help
Posted:
Mon Sep 17, 2018 11:29 am
by Ricardo Teixeira
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.