View Full Version : Coding for an Avatar

03-07-2009, 06:58 PM

I have a pretty specific question. I want my users to be able to create an avatar, but not in the uploading a picture type way. I want them to be able to enter their height, weight, eye color, etc, and then the program creates a 3-D avatar for them. I was thinking that then the user can change the color of their clothes, or put glasses on, etc.

I was thinking to make this easier(or maybe harder who knows), that each avatar wouldn't be unique(Obviously, since some people are going to have the same weight, eye color, etc). More like a(fairly large) catalog of advatars, and then the program chooses for you which one to use.

Does this make sense? I'm new to CF, but I have a considerable amount of coding experience, so you can throw whatever you got at me.

THANK YOU in advance.

03-07-2009, 07:52 PM
Hi madpar3,

From your description of what you'd like to happen:

More like a (fairly large) catalog of avatars, and then the program chooses for you which one to use.

it sounds like it's more to do with logic than graphics, which would be best addressed with some server-side code like PHP. I'm not a PHP guru, but I can't imagine it would be hard to write a script that would assign an avatar based on a particular matrix of user-defined variables.

If, on the other hand, you want the script to dynamically generate the image based on user input, I would look into either PHP extensions designed to handle graphics (http://www.php.net/manual/en/refs.utilspec.image.php) or some Flash programming.

Welcome to CF, by the way. :thumbsup:

03-07-2009, 08:14 PM
Thanks for the reply!

I see where you're going but I guess my question is PHP's ability to make 3-D graphics? Although I have experience with PHP, I have no experience with graphics or PHP creating graphics at all.

I'm thinking of more of the matrix type deal, but what would I use to actually create the avatar?

I'm sorry for my utter and complete ignorance on this subject. I'm trying to expand my skills, so I thought this might be a good project to tackle.

Thanks again.

03-07-2009, 08:37 PM
Explain what you mean by 3-D graphics. Are you thinking a static graphical representation of a 3-dimensional object (like this (http://www.ethereal3d.com/Products/Flight-Joystick-Full.jpg))? Or were you after an interface that would allow the user to actually create and manipulate an object in virtual 3-D space, as with a CAD/CAM program like Alias or SolidWorks? For the latter you're going to need a fancy browser plugin or possibly (speaking from ignorance here) some very fancy Flash programming.

I don't have experience using the PHP extensions I linked to; I'm just aware of them, however, I can't imagine they'd be able to do any heavy lifting graphically--they're probably limited to merging images, adding filters, changing colors here and there. Nothing major.

Give us an example of an avatar that yours would be similar to and we can point you to the right application. To create basic graphics most of us use a bitmap graphics (http://en.wikipedia.org/wiki/Raster_graphics) editor like Adobe Photoshop (http://en.wikipedia.org/wiki/Adobe_Photoshop) (proprietary) or GIMP (http://en.wikipedia.org/wiki/GIMP) (open source). For vector graphics (http://en.wikipedia.org/wiki/Vector_graphics) we use programs like Adobe Illustrator (http://en.wikipedia.org/wiki/Adobe_Illustrator) (proprietary), CorelDRAW (http://en.wikipedia.org/wiki/Coreldraw) (proprietary) or Inkscape (http://en.wikipedia.org/wiki/Inkscape) (open source). For 3D graphics, there are a host of programs to choose from (http://en.wikipedia.org/wiki/3D_computer_graphics_software).

03-07-2009, 08:59 PM
Thank you so much for your patience.

I'm thinking of this kind of graphic for the avatar:


At this point, I think I'll surrender my hopes of having it animated. So what I want is to create these avatars, store them in a matrix where the user inputs certain characteristics and is "assigned" an avatar. And then they can change shirt colors, etc(accessories, really), but I'm pretty sure I can do this part with the PHP help you sent me.

So, can you give me some insight of how to create the said avatars in the above jpg image?

Again, thank you!!!

03-07-2009, 09:18 PM
The ideal way would be to contact the creators of the avatars and ask them what program they used.

Most 3-D graphics software can handle making those images. I use FormZ and SolidWorks at work and either could take that on. If you're interested in an open source solution, you might consider Blender (http://www.blender.org/). There's a bit of a learning curve but making 3-D graphics can get really fun, and that helps take the edge off learning new software.

However, if you want to keep it really simple, another option would be to download and learn a program like Inkscape (http://www.inkscape.org/) and just illustrate the images. You could add glows and shading that would give the illusion that you made it using 3-D software. It would be more labor-intensive to create the images versus just using the rendering engine of 3-D software, but you're looking at some legwork either way, since learning the software is going to take some elbow grease as well.

Just some thoughts. Good luck!

03-08-2009, 01:42 AM
Thanks. I'm going to play around with Blender tonight. We'll see how it goes.

03-08-2009, 04:14 AM
Wow. This program is really cool. Thank you thank you thank you.