Textures

Textures-Window

A texture is the technical name for some graphical data (be it from a image or video) that is being held on your computers graphics card.

PaintingWithLight can load most videos and images as textures so you can use them for painting.

The palette of thumbnails shows what images and videos have been loaded.  Click on one to select it (a border will appear around it), and click the Clear button to clear your selection.

Buttons:

  • Load… – load a new image or video
  • Remove – removes the selected texture from PWL
  • Clear – deselects the current texture
  • Rewind – for video textures, rewinds the selected video to the beginning
  • Pause – pauses the currently selected video
  • Play – resume playback of a paused video

Image Formats

PaintingWithLight will load most image formats including JPG, PNG, and BMP.

Images from digital cameras, even mobile phones, are generally too high a resolution for use with PaintingWithLight.  It will load them but it’s a waste of memory.

You should use a paint program such as Paint.NET (Windows), GIMP, or Adobe Photoshop to reduce the size of your images.

For small images, try shrinking them down to 128×128 or 256×256 pixels.  For larger images, 512×512 or 1024×1024 are good sizes.  If you’re working in high definition or zooming in on textures, try 2048×2048 or 4096×4096.

Even modern graphics cards have a limit on how big a texture size can be.  PWL will try to automatically detect the biggest size and will shrink the image when you load it.  Check the log file for details.

Video Formats

PaintingWithLight will load most video files including AVI, MP4, and MPG.

In addition to the video container format (AVI/MP4/etc) the actual video data inside the file is compressed using a video codec.  The video container format is actually less important than the the codec for our purposes.

There are many, many codecs currently in use.  Some codecs are suited for streaming video over the Internet, some codecs are good for use with video editing packages like Adobe Premier, some are good at only playing video forwards, some are good at jumping to any frame, some preserve the original quality of the source video, some compress it so it will play back on low-end devices.

In short, there is a bewildering amount of options when working with digital video.

The good news is that PWL should play just about any video you load into it, however, if you want to use multiple videos at the same time, you may need to pre-process your video to get the best performance out of your computer.

As with images, you should reduce the frame size of your video if you can.  The supplied video clip ‘snow_loop.mp4′ is 256×256 pixels in size, for example.

If you are comfortable working with video codecs, you might want to try encoding your video with MJPG, which seems to work well.

Further tests are being done and results will be reported back here.  If you have any suggestions or experiences (good or bad), you could let everyone know in the forums.

Weird Image Sizes?

If you’re wondering why the image sizes should be 128×128 or 1024×1024 when most images and videos are not square and don’t come in these resolutions it is because they are the most graphics card friendly sizes that will produce the best system and software performance, especially if you are using multiple video clips simultaneously.

The sizes are powers of two:

  • 2^1 = 2 = 2
  • 2^2 = 2×2 = 4
  • 2^3 = 2x2x2 = 8
  • 2^4 = 2x2x2x2 = 16
  • … etc
  • 2^8 = 2x2x2x2x2x2x2x2 = 256
  • 2^9 = 2x2x2x2x2x2x2x2x2 = 512
  • 2^10 = 2x2x2x2x2x2x2x2x2x2 = 1024
  • … etc

Earlier graphics cards were limited not just by how big an image they could use as a texture but that the texture had to be a power of two size in both directions (i.e. it was OK to have a texture that was 512×256).

Modern graphics cards have removed the power of two limitation, so your images can be any size, although they are still limited as two how big a texture can be (some cards support images as big as 16384×16384).

Leave a Reply