Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by m261087 · Jan 04, 2013 at 01:42 PM · blendermodelspixel

Generating a pixelmodel from scripts.

Hey guys.

Im working on a little project, where all models are in a pixel art style (a lot like cube world). I'm not very good at 3D modelling, so I got an idea that might work. Is it possible to construct the models via scripting in unity? The way I thought it might works is as follows:

The model would lie in a form of data. XML or something. Like coordinates for all the blocks, that the pixel-model would consist of. Then there would be a model in the unity game, of a cube. Then the scripting would generate the model, by instantiating cubes and connecting them, attach it to a skeleton somehow, attach textures and such, and then let that be the model of the character.

Another idea i have for this little game (1 vs 1 duel arena), is if it would be possible to animate, that if a character was hit on the arm, the cubes forming the arm would break off, and the player would be an amputee.

If it isnt possible to do it this way, does anyone know of a piece of software, that lets me draw 3d pixelart, much like qubicle, export it as a 3d model and import it into blender? preferably something free?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by MountDoomTeam · Jan 04, 2013 at 08:54 PM

Hello! Great question! Pixel-model is basically a pixel-Sprite made from blocky pixels same as a Commodore game.-For others that wonder-

I would guess that the code you are after ... would be about 30 or 50 lines of forensically collated code, quite complicated code!it's part of a domain that I'm very interested in, using data from different emulations and different sources and converting it inside unity so that have a lot of cheap easy pretty unity content that you don't have to make in so much time.

I wouldn't use XML, just use pictures, there is a command in unity called getPixel http://docs.unity3d.com/Documentation/ScriptReference/Texture2D.GetPixel.html

So what you can do, is search all the pixels one by one, or every 10 pixels, depending on the size of the picture you are working from, get the colour of it, and make a cube in the middle of the game with the correct relative position and colour of the getpixel.

You can also put in a command which says if pixel is white, don't make a cube.

To begin with, you can just use "set texture colour" unity command- which sets the texture colour RGB of the cube in one line without having to do any other texture material stuff to it.

That basically covers it.

By this time you will find you have 10 lines of code only-that can take any picture and make a pixel model out of it

You could actually just feed simple pictures of cartoon characters and it would only sample every 10 pixels, or you could get proper little sprites and sample every pixel, which would be more stylised.

Afterwards, you will want to combine the cubes into one model using-combine children extended version, which is somewhere on the unity forums

and then you will also want to use export object script, which basically lets you export something we have made in playtime as a fully coloured nice file that you can use as a prefab.

By this time you will have about 15 lines and some extra scripts.

To make unity running efficiently, you'll have to learn a complicated trick-you have to give all the cubes only one texture, the texture of a colour chart, and the have to modify the cube UVs says they are equal to only one pixel, for example if you want to bluecube you have to set the UVs to all equals .443 on the colour chart. and all the cube will be blue. This means that you can have 50 or 100 cubes using only one model and one texture, which makes the 50 or 100 times more efficient, I had to find all this out myself, if I do get the script's I put together to do it I can post them online, basically I found it piece by piece from the forum. Good luck!

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MountDoomTeam · Jan 04, 2013 at 09:04 PM 0
Share

if you wanted to draw inside unity, there were maybe already some free drawing demo programs or cheap asset store things,what you want to do is just use the code which selects the colour and puts it on objects, use it to colour a Grid of 100 X 100 cubes, and then just go into edit mode and delete the ones which aren't coloured.

avatar image MountDoomTeam · Jan 04, 2013 at 09:07 PM 0
Share

to get the colour of a pixel you select with the mouse, and apply it to the texture of the cube, it only takes about 20 lines if you know how to code it!

avatar image MountDoomTeam · Jan 04, 2013 at 09:08 PM 0
Share

that's why you have to learn coding! Like that any time you need to do something like that, you will do it in 2 or 3 hours.

avatar image m261087 · Jan 04, 2013 at 09:22 PM 0
Share

That sounds brilliant. So basically I'll be making a script that will generate the 3D model, and then export it at runtime. Then when that is done, I can (outside of runtime) attach a skeleton to the exported 3D model? Or can I do that at runtime as well? Or will I have to have a "blank" 3D model with a skeleton, and then attach the cubes to that skeleton?

avatar image MountDoomTeam · Jan 05, 2013 at 02:44 AM 0
Share

Yes, maybe the easiest is work on 90 x 90 pixel pictures and zoomed in really big, and then just get each pixel and converted to a cube. you can use alpha to say the cube is there or not or totally white and off-white. don't know about skeletons! I haven't fiddled with skeletons for the moment,probably just find a tutorial and figure how they work, think you have to group some of the cubes into limbs with hinge joint if you want to use classic Unity movement.

In classic pixels, they use a few different pictures for the different movements and just change those around, it would look better with something original and new so probably best to make the unity skeleton thing however it works!

Show more comments
avatar image
0

Answer by ssaullors · Jan 05, 2013 at 03:14 AM

Hi, I'm from Brazil and I'm working in a project that looks similar to yours. I think you are talking abou voxels, right? For me it was easier to make all the parts in a 3D Modeller software(C4D) and then just give the option for the user to choose the part type and color. I am in my third day of development in this project and... It's running, that's the good part... :p Take a look in the picture. Your idea is a good one but, in my project, the user would have to model the hand, torso, hair, head and foot separately...

![alt text][id] [id]: C:/S.png "The Book : Athos part I"

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image m261087 · Jan 05, 2013 at 03:21 AM 0
Share

So you have a kind of modular setup, where the character chooses between heads, hands and stuff? I wasnt going to let the player model their own character. Its more for when I have to make 3D models of characters, monsters and items. $$anonymous$$y system is more for building the models that the player can choose from in the first place. If you understand what i mean?

avatar image
0

Answer by ssaullors · Jan 05, 2013 at 03:31 AM

So you kinda just want a software to make the voxels, right? I use Voxel Section Editor III, is very easy to model... Sproxel is a good one too. With Voxel3D you can export as obj.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

My .blender files arent textured in unity, what am i doing wrong? 3 Answers

Blender to Unity textures are blurry. 3 Answers

Blender imported models reset position and scale. 1 Answer

Blender files won't appear as meshes in Unity 2 Answers

blender glass trouble 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges