TextureAtlas creation and packed Texture handling in SDK

Home Forum Troubleshooting jMonkeyEngine SDK TextureAtlas creation and packed Texture handling in SDK

This topic contains 14 replies, has 7 voices, and was last updated by  Empire Phoenix 12 months ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #201439
    +7

    Normen Hansen
    2778p
    Keymaster

    Hey,

    another set of new features for the SDK, I already briefly mentioned one of them, you can now batch geometry and create a TextureAtlas at the same time:


    The resulting single geometry is very efficient to render, so you can combine models in the SDK SceneComposer and create one geometry with one texture atlas for all models.

    Note that the TextureAtlas tool (which is part of the engine and usable from code as well btw) has some limitations which are:

    – Repeating textures will not work properly due to how texture atlases work generally
    – The diffuse and other maps (normal etc.) have to be the same size for each model or there will be mapping issues

    But theres even more.. :D The TextureAtlas is a packed texture and these cannot really be handled via j3m files and paths and are generally impractical as they easily cause multiple instances of the same texture. This is why I now added texture unpacking to PNG files for materials as well :) When you create a j3m file for your model, you will be asked for paths to export your textures to and these will be used in the new material.


    Of course this also allows you to unpack other packed textures, like those from procedural blender textures which are supported by @Kaelthas awesome importer.

    Oh and btw Undo now also works for these batching operations ;)

    Cheers,
    Normen

    #201440

    Skye Book
    367p
    Keymaster

    … look at this guy over here :D

    #201441

    Laurent
    83p
    Participant

    Nice one. A much desired tool.
    Thanks Normen.

    #201444

    Wesley Shillingford
    833p
    Participant

    sweet :) is this only for static scenes?

    #201446

    Normen Hansen
    2778p
    Keymaster

    @wezrule said:
    sweet :) is this only for static scenes?

    Well your scene is static once you made it a single geometry.. but! You should be able to reuse existing AnimControls as the anim indices of the mesh are kept… Ofc this could cause some confusion with overlapping indices etc. Also I am not sure if I added copy-pasing of AnimControls or Controls in general yet.. Gotta add that if not ^^

    #201448

    Wesley Shillingford
    833p
    Participant

    ah sorry i missed the “the resulting single geometry” part ^_^. I wasn’t sure if we were able to create BatchNodes from the JMEDK yet or not, and cool :)

    #201477

    haze
    64p
    Participant

    Great !

    How many news in our favorite sdk the last few days :)
    Thanks Normen.

    #211646

    Simon Heinen
    14p
    Participant

    It would be awesome (especially for mobile games) if setting the atlas size would also rescale the textures to fit. That woul allow to shrink the textures automatically and create models with reduced memory consumption automatically correct? Currently im using the texture atlas tool because often the j3o files which look correct in the desktop app do not look correct anymore in the Android app. So this might also be a good usage scenario for that tool (maybe even a rightclick on j3o file -> tools -> merge textures ?;)

    #248835

    Simon Heinen
    14p
    Participant

    I wrote some code to test the TextureAtlas but it seems to have problems with all of the models I use for testing. This is the code I use:

    For some geometries in the passed node is applies the correct texture coordinates but for most it does not. Can someone please tell me what I am doing wrong? I wrote this method because the default TextureAtlas.makeAtlasBatch(..) method did not handle models with not fully textured models.

    #248841

    Empire Phoenix
    611p
    Participant

    are all texcoords between 0 and 1 ? And no repeating used?

    #248948

    Simon Heinen
    14p
    Participant

    @Empire Phoenix said:
    are all texcoords between 0 and 1 ? And no repeating used?

    Well when I display the model without calling this method before the model looks quite fine and I don’t modify it I just use the asset manager to load it

    #248949

    Normen Hansen
    2778p
    Keymaster

    @simon.heinen said:
    Well when I display the model without calling this method before the model looks quite fine and I don’t modify it I just use the asset manager to load it

    That doesn’t answer the question.

    #248951

    Simon Heinen
    14p
    Participant

    @normen said:
    That doesn’t answer the question.

    I generate the colada model with sketchup and in the one model I have a window texture for example which i use for multiple walls. If the tex coords of the original model were not between 0 and 1 wouldnt it be displayed incorrect? How can i check the tex coords in a generated colada model other then displaying it?

    #248952

    Normen Hansen
    2778p
    Keymaster

    @simon.heinen said:
    I generate the colada model with sketchup and in the one model I have a window texture for example which i use for multiple walls. If the tex coords of the original model were not between 0 and 1 wouldnt it be displayed incorrect? How can i check the tex coords in a generated colada model other then displaying it?

    If some texture repeats then the coords go over 0-1 and you cannot atlas it this way.

    #248953

    Empire Phoenix
    611p
    Participant

    Hm well you could go trough the xml by hand for a low level solution.

    Basically outside 0-1 means that the texture is repeated, this creates obviously some problems with an atlas, as there are other textures next to it, instead of the border.

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.