   Characters customization in online games
  In many games there's a way to set quite unique view of your character. I've thinked about possible ways of implementation and wanted to ask you what of those are really good for games.Wanted to mention that I don't appreciate some virtual reality programs where traffic 5 MB/minute is good.I think every character has a body and face - main parametrized object. Fat, tall, dark, man, woman etc. must be selected. Clothes can replace some parts of the body - there's no questions.Problem is: who's responsible for building a model from parameters (height, fat, gender, clothes, hair etc.)If server, so there must be an server engine that merges body parts, textures and sends it to client (we think that there are hundreds of clothes, hairs and client storage will never save it all, so form a model fully with merged texture). About 50k mesh data and 50-100kb texture data is not a problem. But if there are 10-20 people that walk (come and go), change clothes. Maybe more than 5 MB/min.Client has an engine that has generalized body, affects parameters to it (about 50 bytes-parameters). After that sends queries to server, i.e. "I need green shorts number 283, dark cap number 24, shoes number 523". Theoretically it's less than get full model from server because we have same body model for all players - we just morph it, but every player load needs a lot of processing (morphing) meanwhile in previous approach (server-side) once player dressed, no more computation needed.   
  -[Edited by - Gnoll on April 24, 2010 3:10:56 AM];  This is a solved problem (well, at least I implemented it in 2001, and the people at Real Time Worlds will take it to the next level with All Points Bulletin).Artists build base meshes, plus morph targets, and base textures, plus adjustment textures.User customizes avatar by pulling slides, which basically creates a set of blend weights. Only these blend weights are transmitted as the "looks" of an avatar.When I see you in the world, my computer just gets the weights, and then load up the avatar base assets, and compose the new mesh/texture based on those assets and the blend weights.For custom clothing, you either have to procedurally re-map base morphs ("fatness") to new mesh topologies, or you have to create each new clothing mesh with the full set of morph targets. We did the latter in There.com, which was a PITA, but looked great (for the time).Additionally, you want to have a skin-tone-colored base texture, and then texture clothing on top of that using alpha overlay. That can be done offline ("baking" the texture) or as part of rendering (with multi-texturing).Note that there may be IP protection for certain implementations of this scheme (like for any kind of engineering, really).;  Yes, the main problem that textures and models are unknown before game start - maybe some player is uploading new clothes right now.It's clear that "clothes baking" must be on client because body is constant, but being modified with some weights (fatness, tallness, etc). But what about tattoos? Or body art? In those cases server-baked mesh and texture would be smaller than full body art texture and clothes that quite fully close those body art.   ;Quote:Original post by Anton VatchenkoYes, the main problem that textures and models are unknown before game start - maybe some player is uploading new clothes right now.Just send the models and texture across. Normally a texture manager of some kind will allow an object to be rendered even though the textures haven't yet loaded. Might try looking at Second Life which uses player made content.Quote:Original post by Anton VatchenkoBut what about tattoos? Or body art? In those cases server-baked mesh and texture would be smaller than full body art texture and clothes that quite fully close those body art.Could look into a decal system unless you're trying to do something like zbrush painting? With decals sending the position and orientation of the texture would suffice.;Quote:Original post by Anton VatchenkoIn those cases server-baked mesh and texture would be smaller than full body art texture and clothes that quite fully close those body art.If all contents must be downloaded at the start, then it doesn't really matter. Downloading 43MiB vs. 59MiB (that would be SI units, not men in black) doesn't make much difference in the grand scheme of things.And if assets are reusable, then caching them individually makes much more sense, since they are reusable among models. Same tattoo on 17 models will require just one download.Each asset has unique ID or hash. On start, desired resource IDs are sent to client. If client doesn't have them locally, it requests them. Those might in turn reference additional ones, so the process is repeated. This whole process might also be possible to implement dynamically, so that placeholder assets are displayed until read ones are transferred, but such approach can result in inconsistent visuals, popping, increased run-time load and similar.Quote:Wanted to mention that I don't appreciate some virtual reality programs where traffic 5 MB/minute is good.5 megabytes is barely enough to transfer one texture.50MB per level might be a good start, without duplicates, highly compressed. 5MB/minute is only ~80kB/second. For completely server-side assets, that would be a bargain. It's also worth noting that SecondLife comes with very limited graphics compared to even console engines these days.And downloading raw assets is probably out of question anyway, considering that there is a reason GPUs today have gigabyte of RAM.   ;  No, I already mentioned that data is changing meanwhile game runs. I wanted to add black boots - I add texture, upload model. It cannot be loaded on startup.Yes, I looked into Second Life. There are standard clothes - I can control it like body morphing (how long, how fat etc). For example skirt has 5-6 parameters, but it's not unique. Why if I want to add shirt with some holes, or cap rotated right, etc. Yes, I'm not a modeller. Game developers must produce hundreds of models, but Second Life shirt long and width and height parameters are really poor.   ;Quote:Original post by Anton VatchenkoNo, I already mentioned that data is changing meanwhile game runs. I wanted to add black boots - I add texture, upload model. It cannot be loaded on startup.As it's already been discussed, sending actual image or mesh information from client to server or anything not on a webserver or a specified data streaming server is almost always a terrible idea. Send a series of values that represent appearance (int HelmetID, float Fatness, etc). For tattoos and the like, you can send UV coordinates to specify where to apply them. If you really want special holes in clothing, have another layer which clothes uses as an alpha mask and can be specified by the player. In a situation like this, definitely use models. But...Memory-intensive (but will be totally badass in the long run)For each character, use a unique render target texture. Whenever their character is loaded, changes equipment, etc, draw all the appropriate textures to the render target. Make sure to render skin first, then on top of that tattoos, clothes, armor, etc.It's very memory intensive, but the only real processing it takes is the fillrate when equipment updates (SUPER FAST). However, after you start getting a lot of characters on screen, you're going to want to do something like shrink the render target size for characters at a far distance. This will also let you have completely unique looking characters, since each one uses a unique texture. It also won't let you use hardware instancing. But I'm guessing that's not an issue.Memory-lite (lame, but scales better)All characters use shaders which do some magical things. You might be able to use blend modes, but shaders would allow you to fit textures anywhere you please. Whenever characters are loaded, change equipment, etc, set the textures for the character so that layer 0 is skin, 1 is tattoos, 2 is clothes, 3 is armor, etc.Since all characters share the same textures, all you need to do is render the textures so that the tattoo texture blends over the skin, etc. Obviously this is also reliant on the fillrate, but does so every frame (slow, depending on number of layers). As for optimization, reduce the number of layers. It still is fairly memory intensive, since you need to load all those equipment textures.Obviously, all of these techniques are a bit slow and have their drawbacks, but the solution to the problem is pretty easy if you have a good texture artist and a well UV mapped model.[Edited by - Akitsune on April 21, 2010 5:51:22 PM];Quote:the main problem that textures and models are unknown before game startYes, this is the "user-generated content problem." Multi-resolution streaming ends up being the best solution, but most solutions I know about only does one resolution (full rez) or two resolutions (thumbnail + full rez).You could actually stream each MIP map level separately, and for many objects, the higher MIP map levels will seldom be needed at all.This is also why most UGC systems will put a hard limit on texture size. For example, at IMVU.com, your submitted textures will be downsampled ("optimized") to 512x256 if you submit something bigger.When it comes to texture baking, baking a unique texture per avatar is probably using *less* memory overall than loading all the shader bits and pieces for each avatar, if you assume that each avatar will use individual clothing anyway. Doing that also allows you to set a finite cost per avatar. For example, you can say that my own avatar and the few nearest avatars always get a single 1024x1024 texture (4 MB of render target), and any other avatar always gets 512x512 (1 MB). This will allow you to budget memory however you want. You could also decide to drop these settings further if there's a crowd of avatars -- if there are 200 avatars on the screen, most of them will only take maybe 50x50 pixels of screen space, so a texture much bigger than 128x128 probably isn't that useful.Server baking pretty much never makes sense, except possibly for preview textures. And, even then, you probably want to upload the baked texture from the client machine that configures the avatar in the first place, rather than provision render resources on the server side.;  hplus0603, how do you advise to solve problems with morphing? We have a body, about 2 parameters for general body (height, fat), for face about 5 parameters (eyes distance, height, nose position, mouth position, head size). The easiest way is to have a list of vertices and directions for every parameter - where to move while player touch a slider. But I have about 3000 vertices, every will have from one to 10 vectors. So it's a lot of data... Is there way to optimize?   