Jump to content

Water animation texture


Josh
 Share

Recommended Posts

This is pretty cool. I used an AI upsampler to increase the size of my seed texture 2x. Then I generated water animation frames, loaded them all as pixmaps, and saved them as a single DDS volume texture like so:

    auto plg = LoadPlugin("Plugins/FITextureLoader");

    std::vector<shared_ptr<Pixmap> > mipchain;
    auto path = GetPath(PATH_DESKTOP) + "/watermaker/frames";
    for (int n = 0; n < 128; ++n)
    {
        auto pm = LoadPixmap(path+"/water1_" + String(n) + ".png");
        pm = pm->Convert(TEXTURE_BC5);
        mipchain.push_back(pm);
    }
    SaveTexture(GetPath(PATH_DESKTOP) + "/water.dds", TEXTURE_3D, mipchain, 128, SAVE_GENMIPMAPS);

In order to do this, I had to study Microsoft's documentation of the DDS file format layout here:

https://docs.microsoft.com/en-us/windows/win32/direct3ddds/dds-file-layout-for-volume-textures

The texture can be animated automatically just by setting the material texcoords animation on the z axis, so the shader smoothly blends in between the volume texture slices to show the animation. Very simple, in a single texture.

The resulting file is 36 MB, in BC5 format, with mipmaps and 128 layers:

https://github.com/Leadwerks/Documentation/blob/master/Assets/Materials/Animations/water1.dds

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

  • 2 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...