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?

  • \$\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\$ – Raxvan Dec 29 '14 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\$ – yxyx136 Dec 29 '14 at 17:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.