Krita View3D Plugin
The View3D plugin for Krita provides a "docker" for
rendering a mesh in JTF
or OBJ format using a document as a texture. In addition it
provides some very basic backprojection from the rendered
view to the texture which can be used to assist with painting on
3D models.
The functionality provided by the current version is:
- View the current document as a texture on a JTF or OBJ mesh
(note: OBJ support is currently very limited)
- Use the mouse buttons to rotate (left), pan (middle) and zoom
(right or wheel) the view
- Toggle filtering, shading, wireframe, backfaces, orthographic
projection and selection visualization for the model
- Use ctrl+left button on the model to rotate the light
- Use alt+left button on the model to draw "blobs" on the active
layer
- Align the canvas to the mouse position so that the down
direction in both the view and the canvas are the same in screen
space (helps for when the texture coordinates are rotated
instead of being aligned with the texture)
- Texture "modifiers" can modify the texture in realtime to see
how it would look when scaled down to 50%, 25% and 12.5%. In
addition an optional palette can be used to limit the texture's
colors to that palette (useful for retro 3D models)
- The "Images" menu contains commands to:
- Create a new image using the current 3D view with separate
layers for the render, background and a layer group to paint
into
- Create a new layer in the edited texture with the contents
of the layer group of the last created image using the
previously mentioned command
- Create a new layer with the texels visible from the view
set to opaque white color (the rest are transparent) which
can be used as a mask for various operations (e.g. creating
layers from multiple views and mixing them could be used to
colorize areas or do some simple ambient-occlusion-like
effect)
- Create a new layer with the geometry texture coordinate
triangles drawn either as solid triangles or as wireframe
(can be used to mask out specific islands in the texture -
assuming the texture coordinates are set up like that, of
course)
- Paste an image from the clipboard on the 3D model by
performing triplanar blending in 3D space
- Generate a gradient based on the distance from or a
direction towards a reference point (camera, top, front,
etc) to each texel/pixel in 3D space
- Experimental: Use and edit normal and bump maps via the
"Textures" menu. A command is also provided to combine a normal
map with a bump map into a new normal map. Please note that the
normal+bump functionality is a bit buggy at the moment.
- Remember recently opened meshes
Limitations:
- No undo/redo for image modifications (this is a Krita
limitation)
- Due to the way backprojection is done, there is little
precision and "gaps" can be created when the projected pixels
are too zoomed out
- To avoid this, zoom in to the area you want to edit on the
model as much as possible
- As this is uses native libraries to process the image faster,
only 64bit libraries for Windows and Linux are provided
- The OpenGL code needs support for GL_EXT_gpu_shader4 in
compatibility contexts
- This should not be a problem with modern AMD and Nvidia
cards but some Intel cards may not provide this
- Windows users: you must switch from
Direct3D 11 / ANGLE renderer to OpenGL
renderer in Krita's settings (Settings -> Configure
Krita -> Display -> Preferred
Renderer) otherwise the plugin will show an error
while starting up Krita!
- OBJ support is very limited: only triangular
faces, normals and texture coordinates are supported. If you are
using Blender i recommend to use JTF instead, OBJ support is
only provided for use with other 3D tools that do not have a JTF
exporter.
Some YouTube videos: The first one
made shows some basic use, this one
shows the new masking feature, this one shows the final UI
in version 20240218 and painting across seams, this one
shows the triplanar paste command (before a dialog to
configure it was added), this
one
shows the (final) triplanar paste and gradient generation
commands.
Download:
- Source code repository:
- Latest version (built for 64bit Windows and Linux):
- view3d20241110.zip
(192KB)
- Add basic OBJ support (only triangles, normals and texture
coordinates are loaded)
- Previous versions:
- view3d20241024.zip
(171KB)
- Add support for viewing and editing normal and bump
maps
- Allow rotating the light around the model with
ctrl+mouse drag
- Fix bug where the mouse wheel could be used to zoom
in/out during projection paint, thus breaking the
projection
- Use a ZIP file for the release so that it can be
installed from within Krita (hopefully, didn't test)
- view3d20240313.7z (134KB)
- Convert various CPU intensive tasks from Python to a
separate C library for a *huge* speedup
- Add an option to visualize the current selection on
the model
- Replace "snapshots" with "texture modifiers" that show
the texture scaled in realtime
- Add a "texture modifier" for forcing the colors of the
texture to adhere to a specified palette (even after
scaling)
- Add a "direction" gradient mode for generating
gradients based on a reference direction (the camera or
a cardinal direction)
- Add internal "cube" and "plane" meshes
- Do not "zoom past" the model
- Add mouse wheel support for zooming in/out
- Try to fail more gracefully when OpenGL initialization
fails
- Fix more potential Qt leaks
- view3d20240307.7z (10KB,
last pure Python version)
- Fixed a bug where the scene was rendering over the GUI
- view3d20240302.7z (10KB)
- Add a command to generate a gradient based on the
distance from a reference point (camera, top, front,
etc) to each texel/pixel in 3D space
- Fix the moat value in triplanar paste being ignored
- Fix potential Qt memory leak for the triplanar paste
dialog box
- view3d20240229.7z (9KB)
- Add a command to paste an image from the clipboard on
the 3D model using triplanar blending
- Add orthographic projection mode
- Allow the use of the current selection as an alpha
mask for all commands that create new layers
- Hide menu options that affect the camera in newly
created image to avoid glitches from wrong projections
- Bugfixes:
- Messageboxes appearing behind main window in
fullscreen mode
- Cancelling background color selection dialog now
works instead of making it black,
- view3d20240220.7z (7KB)
- Add command to align the canvas to the mouse position
so that the down direction in both the view and the
canvas are the same in screen space
- Add menu with snapshot preview commands to show how
the texture would look downscaled at 50%, 25% and 12.5%
(note that these stop the live updates)
- Add an "Update" button to explicitly update the
texture if live updates are enabled
- view3d20240218.7z (6KB)
- Rework the UI to use a popup menu instead of buttons
(avoids minimum docker size)
- Add wireframe and backface modes
- Add background color selection
- Add generation of a mask from view
- Add generation of layers for the texture coordinate
triangles (as a filled mask or wireframe)
- When making an "image from view" use the background
color and make a layer group to paint on instead of a
single layer (allows using multiple layers and layer
effects)
- Backprojecting (bringing the painted layer back to a
texture image from an image created with "image to
view") should be a bit more accurate across edges/seams
- Allow "locking" the texture to a specific document
instead of the active one
- Remember up to 10 last opened meshes (saved in Krita
settings file)
- view3d20240207.7z (4KB)
- Fixes Alt+Click and To Image/From Image
not working due to accidentally enabling multisampling
- view3d20240104.7z (4KB)
- Fixes crash with the Linux version due to not setting
the OpenGL version and profile at the time of widget
creation (Windows versions may not be affected)
- view3d20231102.7z (4KB)
To install put the view3d directory inside the pykrita
directory in your Krita resources (e.g. ~/.local/share/krita/pykrita).
If
you are not sure where that is, open the Settings menu,
select Manage Resources and then click the Open
Resource Folder button in the bottom right corner of the
window that will appear.