0
\$\begingroup\$

I'm currently creating a voxel game like Minecraft. To display the damage of blocks, I want to combine the alpha channel of one part of my texture map with the actual texture (like Minecraft does), how could I do that in Unity?

\$\endgroup\$
2
  • \$\begingroup\$ shader code: final_color.rgb = lerp(block_texture_color.rgb,damage_texture_color.rgb,damage_texture_color.a * damage_factor) and damage_factor is a float 0 or 1 depending if you want to see the block damaged or not (you can pass it trough alpha color from vertex color or via a uniform \$\endgroup\$ Commented Dec 29, 2014 at 13:40
  • \$\begingroup\$ Thanks for the code!, My problem is that my world is divided into chunks, as far as I know, you can only attach shaders to the entire chunk gameobject, how could I target only the damaged block? \$\endgroup\$ Commented Dec 29, 2014 at 17:23

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.