[REQ] Texture Atlas Generator for Sketchup
-
This is one of my top requests,
A texture atlas, is a single image containing a number of smaller textures. This is useful as it is more efficient for the graphics card to process (it doesnβt have to keep switching textures when drawing different textures, as it can just use the single texture and sample from different parts of it). It is also faster to load into RAM, as you are only loading in one image, as opposed to several smaller ones, so the loading can be done in one stage, broadly speaking, this is similar to when a painter has to un-load their brush with one colour of paint, and load it up with another, before continuing to draw.
And here's a 3ds Max script which automatically generates texture atlases for you:http://www.scriptspot.com/3ds-max/scripts/texture-atlas-generator. This is worth looking at even if you don't have 3ds Max, because the page has some good animated examples of how a texture atlas is formed.
Why do i require something similar in sketchup, well many reasons, im looking into visualisation and game development on mobile devices, and for a scene on a mobile device we are restricted to 30 Draw calls per scene, yes i mentioned these draw calls in the past and as baffled as i was i baffled others, so what are draw calls, let me explain, If you have a number of scattered scenery objects in your scene which all use the same texture and material - for example, many buildings, rocks, fences, etc - which do not need to move independently, you can combine these objects together into a single large mesh which shares one single material even though the parts may be physically separate in space. This way, you incur one draw call for the whole set, rather than one per object.
If you have objects which use different textures and materials, it's still possible to combine them into a single mesh and thereby reduce draw calls, by creating what's known as a Texture Atlas. A texture atlas is a single large texture which contains each of the smaller textures used by a number of objects. Each object's UV coords is modified to fit the smaller area within the atlas.For example, if you had a building which uses different textures for the roof, doors, walls, beams, cornerstones, windows, etc, you might combine these into a single texture atlas. In doing this, you sacrifice the ability to use a different material for each item, but you gain the benefit of being able to collapse the various parts of the building into a single mesh with a single material, therefore enabling you to draw the entire building in 1 call, instead of many, Typically though, the original "window" material might be transparent and reflective, and therefore wouldn't necessarily be suitable to be merged down into a single material with the other textures, so you might end up with two texture atlases for the final building. One for the opaque, non-reflective parts, and one for the transparent reflective parts.
So is there a plugin that can do this within sketchup, export 1 texture file of many textures and export the new coordinates for the created texture, or can it be developed
I hope this makes sense but i have come across posts in the past where others have looked for texture atlas plugins too but so much has changed in the last year alone with advancements in texturing within sketchup so can it be done now.
I suppose another way of describing this is UV mapping done in reverse, you texture your model in sketchup with many textures and then a plugin unwraps your texture as 1 into 1 texture image
Thanks in advance for your replies
-
I once had started some code for this... But it is a lot of work and you probably get faster results by exporting to Vue (works even in the free PUEL version) and saving back to skp. Vue doesn't keep the textures in there orignal state but bakes a texture atlas.
For creating a plugin we need to:
β’ probably make all textures unique since we get otherwise problems with tiling textures
β’ copy all faces into a plane
β’ pack them efficiently into a square. This is the most time consuming because most heuristic algorithms don't pack so efficiently. We could allow the user to tweak the positions of faces.
β’ merge the textures into one, either with SketchUp's "combine textures" or an external image editing library
β’ calculate the UV coordinates that have changed because the new texture atlas has bigger boundaries
β’ map the new texture back to all faces. -
Thanks for the tip Aerilius, ill look into Vue later and see if it does what I need done, ill post here how I get on with this, it has being an issue asked by many members over time on these forums, I believe sketchup needs some sort of feature with generating a texture atlas but if Vue can do something similar then I'm happy, thanks again
-
And I think you might get problems if you wanted to export a model atlas textures - as SU tend to export faces with distorted textured into separate bitmaps.
-
Curiously, has anyone had any success using the proposed SU <-> Vue export/import "workaround" for creating a texture atlas and would care to share their experience?
Of course that's unless there is a better way how to do it...
Thanks
-
I forgot about this post, unfortunately i didn't succeed, but i only tried the once, i create my own texture atlas using gimp and SU, its a long process and very time consuming, im curious to know how its done using Vue and if there is any video tutorials demonstrating this...
-
When I imported a SketchUp model into Vue, it automatically merged all textures into one file. I needed nothing to do on my own. But I didn't find the map useful for transferring back to SketchUp because small face ended up only some pixels wide, and I couldn't use bigger (32kΓ32k) textures in SketchUp.
I have a "TextureCombinator" (soon to be released). It does however not resolve the UV distortion issue (it does not bake distortions into the atlas).
-
@aerilius said:
When I imported a SketchUp model into Vue, it automatically merged all textures into one file. I needed nothing to do on my own. But I didn't find the map useful for transferring back to SketchUp because small face ended up only some pixels wide, and I couldn't use bigger (32kΓ32k) textures in SketchUp.
I have a "TextureCombinator" (soon to be released). It does however not resolve the UV distortion issue (it does not bake distortions into the atlas).
So you decided to further develop the plugin you mentioned you started further up the post?
-
Its been well over a year since i posted this, so i said i would revisit this and see has there been any solution to this
-
Blender
-
lol, thanks again Rich, ha ha
Advertisement