I am currently working on making "Unity3d Version Of Minecraft", atleast, the game is build around the functions in Minecraft.
I have been able to do alot, more then I thougth whitout any help, but there is a few things I can't seem to work my way around, and I would be very happy if someone could atleast help me whit some of the issues I have been getting so far in the development!
(NB; My questions rely on that you have played Minecraft)
When you damage blocks in Minecraft, a texture is slowly appearing over the main texture of the objects, to help you know how much its left to damage before its broken! This, is something I cant seem to work my way around in Unity3d.
I have already made an method for damage and breaking objects, and its in the same code I need to implement the texture. When the player is clicking the block, and holding it down for a certein time, it gets destroyd, and it works perfect. What I need help whit, is to add a second texture (transperant) to the main texture when this is happening! I have 4 textures that I need to be placed over the main texture, over time, but the only thing I can seem to get to work, is to change the main texture, but I still need that to be there!
Is there someone, who have any ideas? Or, know how to do this?
Thanks in advance! Best Regards, M!
I recommend this thread:
After playing minecraft...
It is a treasure trove of information about all things Minecraft in Unity-related.
Answer by Screenhog
Jul 30, 2012 at 07:06 PM
"When you damage blocks in Minecraft, a texture is slowly appearing over the main texture of the objects, to help you know how much its left to damage before its broken! This, is something I cant seem to work my way around in Unity3d."
The Transparent Cutout shaders might be helpful here. They have a slider that can change at what point a texture's transparency goes from opaque to transparent. You can make good gradual cracked effects with this technique.
Thanks for the reply, I have actualy never heard of this technique! Would you like to explain it abit for me? Maybe throw out an example script?
It's best to experience it for yourself... it might not be quite what you're looking for, although it certainly makes an object look cracked.
Create a texture in an image editing program that can support editing the alpha (transparent) layer.
Do whatever you want for the RGB channels of the texture.
In the alpha channel of the image, put in a grayscale of some kind. In your case, a black and white image of something cracked would be good.
Bring the image into Unity. Apply it as the texture of a transparent cutout shader. Move the slider back and forth to see the texture getting gradually more cracked.
Now, that might not be exactly what you want, but it does do a cracked effect, and if you had a slightly smaller object inside it, it might just work.
Answer by joeyaaaaa
Jul 30, 2012 at 02:40 PM
theres a blended sky script that you caqn probably mess around with to blend a texture like you say search for it
Answer by Bunny83
Jul 30, 2012 at 03:08 PM
The easiest way is to display another block / cube that is slightly larger than the actual block and display your animated "cracking" texture on this cube with a transparent / cutout shader.
Btw, have you seen the Minecraft starter package? Because most people who try to do a minecraft clone start by using seperate cubes and end up with a framerate of 2 fps for 10x10x10 cubes (1000). As seperate objects each object has it's own drawcall. Minecraft has overall something like 250 drawcalls (including gui and mobs). You have to chunk your terrain.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a site navigation guide.
If you are a new user to Unity Answers, check out our FAQ for more information.
Make sure to check out our Knowledge Base for commonly asked Unity questions.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
Answers and Comments
11 People are following this question.
GUIButton Standard Texture?
Do materials with shared textures take up twice the video memory?
how to make textures the same size regardless of object size unity
Transparency seeing back of model