Jump to content
  • Advertisement
Sign in to follow this  
KulSeran

Automatic texture count reduction?

This topic is 2854 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So my google foo is failing me, probably cause I don't know the terms to look for. But, I know there are tools out there for lightmap packing and other types of reductions. Are there any tools/algorithms out there that can take a model an pack all the used textures together in a similar way?

In the simplest terms, you have a model that COULD have been unwrapped(right term?) onto a single texture. Instead, it got unwrapped such that several textures were used. As a post process, it would seem reasonable that you should be able to re-map all those texture coordinates onto a new, packed texture. The packed texture would contain, proportionally by area and shape, the sections of the source textures that were used. For a cube with 6 different textures for the sides, you'd obviously end up with a texture that is the direct sum of the source images. But for some humanoid, you'd be able to take that 64x64 source image used to colorize a gold ring, and pack it into just a few dozen pixels on the final image due to the low overall area the ring is in proportion to the larger textures used to cover the clothing and skin.

Such a tool would obviously need some interesting input parameters to tune how it chose to trade off texture space. But does such a process even exist? If not, what might go into making it?

(stemmed from a conversation at work, in how it is easier for the pipeline if you limit the number of textures on any object. But it is more flexible for the artists if they can use a library of source textures instead of making one-off specialized atlas textures for every single object. I suspected there is a best-of-both-worlds solution if you can live with the automation tradeoffs.)

Share this post


Link to post
Share on other sites
Advertisement
Seems like a lot of extra work when it would be so simple for artists to copy/paste the needed pieces from your hypothetical source textures into the texture for each object.

Personally, I have neither seen this done nor believe it is a worthwhile tradeoff to build or use such a system.

I think your artists just need a good kick into gear.

Share this post


Link to post
Share on other sites
Quote:
Original post by 1863
Seems like a lot of extra work when it would be so simple for artists to copy/paste the needed pieces from your hypothetical source textures into the texture for each object.

Personally, I have neither seen this done nor believe it is a worthwhile tradeoff to build or use such a system.

I think your artists just need a good kick into gear.


While that might on the face of it seam reasonable, due to the volume of art changes that come about over the course of a project, anything to speed up the pipeline is appreciated. Optimizing the art files for the game has a tendency of making them un-editable, or unreasonably difficult to edit. Not being an artist, I don't know if the texture unwrapping case is one of those items that makes the art harder to modify (but i suspect it is). And, so, the academic question of "is that automatable" came to mind. In the grand scheme of things, if the tools already are doing transformations on the mesh and texture data to get them into more workable formats, what is one more transformation to add to the mix?

So, back to the question of "does anything do this?" or "how could this be done?"

Share this post


Link to post
Share on other sites
Quote:
Original post by Ashaman73
I don't know a tool, but take a look at Chris Hecker article about spore, especially texture generation: clicky

Interesting. Thanks. Not quite all the way there, but it seems some of the work can be automated in the map creation (i assumed Maya has a way to do something similar to aid in maping out an object to a texture). Still, gives a good look at how the human made map could be broken up into non-optimal chunks, just to get everything onto a single texture.

And that painting tech is really cool too.

Share this post


Link to post
Share on other sites
UV auto-unwrap is a tricky (unsolved) problem... lukily this isn't quite UV-auto-unwrap though, because your artists have already done the UV mapping -- the problem is they've done multiple UV mappings that you need to merge into one.

I'm not sure of any 'shape fitting' algorithms for step 3, but a high-level view could look like:
1) Take each of the exising UV-unwraps for the model (one for each texture used).
2) Decompose these into UV-islands.
3) Use a 'shape fitting' algorithm to translate/rotate/scale each island so they fit together inside a new rectangle/square. Make sure each island has adequate border space around them (so mip-mapping works).
4) Each island now has a set of original UV coordinates, a set of new UV coordinates, an original (source) texture, and a target atlas texture.
5) Set the atlas up as a render target, and set up a (0,0)->(1,1) ortho projection.
6) For each island:
6.1) Bind the 'old texture'
6.2) Using the 'new UV coordinates' as vertex positions and the 'old UV coordinates' as texture coordinates, render the island as 2D polygons.
6.3) The edge colours should probably be 'bled out' into the border region of the island (so mip-mapping works). Not sure on the best approach for this.
7) You've now got an atlas with the old textures rendered into it, save it!
8) Write the new UV coordinates into the model (this should be part of a build-process/export-script, so you've still got the unmodified original model).

Share this post


Link to post
Share on other sites
Quote:
Original post by Hodgman
6.3) The edge colours should probably be 'bled out' into the border region of the island (so mip-mapping works). Not sure on the best approach for this.


Certainly not the best but an easy approach is shown in Chapter 37. Octree Textures on the GPU (Example 37-3. Color Extrapolation Cg Code). Maybe it can help the OP.

Share this post


Link to post
Share on other sites
Well. Thanks for all the suggestions. I learned a lot from this, hope others can too. Maybe if I find time between projects here, I can actually work on trying to make this happen.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!