Sign in to follow this  
Jon Alma

OpenGL Photofit Faces - Prebaking of Textures or Using Decals in OpenGL?

Recommended Posts

I am currently using one texture for character faces in my Legends role playing engine which means that if for instance I have an old man NPC I create a texture of an old man's face with the wrinkled skin, specific eyes (and eye colours), grey hair and a beard. If I want another face it is another compeletely separate texture which creates a lot of work and takes up a lot of space on the hard disk (and it is a real pain to manage all the different textures well). In order to add more variety to the characters I am about to implement a photofit face system where the overall face texture would be built up of a number of different elements including, - The basic skin texture (which will vary to take in different skin tones, skin types, etc) - Eye textures (blue eyes, grey eyes, scarred eyes, etc) - Mouth and beard textures - Hair textures (in most cases the hair will just be a texture rather than a separate mesh) - A miscellaneous 'features' texture (tatoos, scars, etc) As I see it I have two options. First off I could, when creating or loading a new NPC into the game, prebake a new texture by combining, in the engine, new textures based on an off screen rendering of a combination of the different texture elements . This would result in one texture being used per face resulting in the best frame by frame performance possible (I only draw each face once). However, creating the textures when creating the NPCs (which is done as content is streamed into the engine on the fly for each new map section) may lengthen map section load times (and this is something I am sensitive about minimising as much as possible). Having not adopted this approach before is there any indication of how fast or slow this prebaking of textures can be? The alternative is to use a decal system where I do multiple drawing passes on the face building up the face texture on the fly first drawing the skin, then the eyes, mouth, etc. This would be easier to implement (from where the code is now), but I imagine that there would be a performance hit per frame even if I can minimise the work done in each redraw. Is there any order of magnitude measure of how serious this performance hit would be (imagining 5 passes on a head model of about 400-500 triangles with the current rendering being handled through vertex arrays)? (There is the third approach of prebaking textures offline and outside the engine and loading as needed, but as already mentioned I really want to limit the disc space / download footprint of the game and I have fears that wide range of faces I want to introduce would see the space used to hold even compressed textures being significant). Any advice or experience on either approach to share or is there another solution that I have so far overlooked? Cheers,

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this