Category: TroubleShooting

A strange thickness of faces in Blender

This is trouble shooting in Blender. Actually it was a foolish mistake…

Problem

I found a strange thickness in my model in Blender. Though this is only one surface, it looks like a cube with thickness.

Cause and Solution

In my case, I’ve added “Solidify” modifier by mistake before.
So the solution was to check modifiers and remove unused one.

[Trouble Shooting] Where is “Shader to RGB” Node in Blender?

This is a problem I am stuck on, but it is easy to solve.

Problem

I was finding the shade node “Shader to RGB” that converts the output color of a shade into RGB. However I couldn’t find it in Blender 8.3.

Solution

“Shader to RGB” node is prepared for “EEVEE” renderer only. So we need to change the Render Engine into “EEVEE” and we can find “Shader to RGB” in Add > Converter.

[Tips] “Set Inverse” for “Child Of” Constraint using Blender Python

This is a trouble shooting for using bpy.ops.constraint.childof_set_inverse.

Trouble

When I tried to set “Set Inverse” for “Child Of” constraint in bone and executed bpy.ops.constraint.childof_set_inverse(constraint=”Child Of”, owner=’BONE’) on Blender, the following error occurred. How can we solve it?

>>> bpy.ops.constraint.childof_set_inverse(constraint="Child Of", owner='BONE')
Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
  File "C:\Program Files\Blender Foundation\Blender 2.83\2.83\scripts\modules\bpy\ops.py", line 201, in __call__
    ret = op_call(self.idname_py(), None, kw)
RuntimeError: Operator bpy.ops.constraint.childof_set_inverse.poll() Context missing 'constraint'

Environment

Windows 10
Blender 2.83

Solution

To execute this operation, we should pass the context that contains target constraint and activate the target bone in pose mode.

import bpy

bone_name = "foot.IK.L"
bpy.ops.object.mode_set(mode='POSE', toggle=False)
pose_bone = bpy.context.active_object.pose.bones[bone_name]

# set the target constraint to the context
context_py = bpy.context.copy()
context_py["constraint"] = pose_bone.constraints["Child Of"]

# activate target bone
bpy.context.active_object.data.bones.active = pose_bone.bone 
bpy.ops.constraint.childof_set_inverse(context_py, constraint="Child Of", owner='BONE')

Reference

bpy.ops.constraint.apply
Childof_set_inverse

[Trouble Shooting] NullFunctionError of glutInit in OpenGL

Problem

When trying to call “glutInit()” of PyOpenGL, I got the error “NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling”.

# python source code
from OpenGL.GL import *
from OpenGL.GLUT import *
from OpenGL.GLU import *

glutInit()
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB) 
 
Error Detail

---------------------------------------------------------------------------
NullFunctionError                         Traceback (most recent call last)
/tmp/ipykernel_14/3289264930.py in <module>
      3 from OpenGL.GLU import *
      4 
----> 5 glutInit()
      6 glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB)
      7 

/usr/local/lib/python3.9/site-packages/OpenGL/GLUT/special.py in glutInit(*args)
    331     try:
    332         # XXX need to check for error condition here...
--> 333         _base_glutInit( ctypes.byref(count), holder )
    334     finally:
    335         os.chdir( currentDirectory )

/usr/local/lib/python3.9/site-packages/OpenGL/platform/baseplatform.py in __call__(self, *args, **named)
    421                 pass
    422             else:
--> 423                 raise error.NullFunctionError(
    424                     """Attempt to call an undefined function %s, check for bool(%s) before calling"""%(
    425                         self.__name__, self.__name__,

NullFunctionError: Attempt to call an undefined function glutInit, check for bool(glutInit) before calling

Environment

Windows10
Python 3.9.7

Cause

There are some Recommended Enhancements for PyOpenGL. And some of them, such as GLUT or FreeGLUT, are not contained in PyOpenGL itself.

Solution

Solution1 use binary installer for windows.

The documentation says “Win32 and Win64 binary installers for PyOpenGL include a copy of GLUT”.
So uninstall current pyopengl first.
And download binary installer for windows. Put the downloaded file in some directory, then run the command “pip install <file name>” in the directory where the file is saved.

pip uninstall PyOpenGL
pip install PyOpenGL‑3.1.6‑cp39‑cp39‑win_amd64.whl

Solution2 install GLUT or FreeGLUT separately

Installing and adding GLUT or FreeGLUT to PATH solves this problem.

Build FreeGLUT from source code or download built FreeGLUT from “Download freeglut 3.0.0 for MSVC” in transmissionzero.co.uk/software/freeglut-devel.

Put freeglut\bin\x64\freeglut.dll into C:\Windows\System32.

Add “C:\Windows\System32” to environment variable “PATH” to enable python find the library.

If the error still occurred, check if your library name is in Win32Platform.GLUT() <python>\Lib\site-packages\OpenGL\platform\win32.py

    @baseplatform.lazy_property
    def GLUT( self ):
        for possible in ('freeglut%s.%s'%(size,vc,), 'freeglut', 'glut%s.%s'%(size,vc,)):  # Added 'freeglut' because the library name is freeglut.dll
            # Prefer FreeGLUT if the user has installed it, fallback to the included 
            # GLUT if it is installed
            try:
                return ctypesloader.loadLibrary(
                    ctypes.windll, possible, mode = ctypes.RTLD_GLOBAL
                )
            except WindowsError:
                pass
        return None

These links might help you.
python – Attempt to call an undefined function glutInit
#219 glutInit fails on windows 64-bit
Attempt to call an undefined function glutInit
Python and PyOpenGL Installation

Appendix: How to install GLUT or FreeGLUT on Linux

Use “sudo apt-get install python-opengl” command to install PyOpenGL with dependent library at once.

[Trouble Shooting] Human Fall Flat Workshop in Unity

An error “ArgumentException: Input Axis Joystick Look Horizontal is not setup.” occurred when Play button clicked.

Some people have the similar problem as I have.
ArgumentException: Input Axis Joystick Look Horizontal is not setup.
Error: Input Axis Not Set Up

It’s easy to solve. Put “<SteamLibrary>\steamapps\common\Human Fall Flat\WorkshopPackage\ProjectSettings” into <UnityProjects>\<Project directory>.

The following is the detail of this problem.

Problem

I followed the guide to start creating workshop of Human Fall Flat in Unity. When I start “Play” mode, I couldn’t control the Human and he was twisted!!

The following is the detail of the error.

ArgumentException: Input Axis Joystick Look Horizontal is not setup.
 To change the input settings use: Edit -> Project Settings -> Input
HumanControls.get_calc_joyLook ()
HumanControls.ReadInput (System.Single& walkForward, System.Single& walkRight, System.Single& cameraPitch, System.Single& cameraYaw, System.Single& leftExtend, System.Single& rightExtend, System.Boolean& jump, System.Boolean& playDead, System.Boolean& shooting)
Multiplayer.NetPlayer.PreFixedUpdate ()
Multiplayer.NetGame.PreFixedUpdate ()
Multiplayer.NetGamePre.FixedUpdate ()

Cause

“Input Axis <NAME> is not setup.” means that the input axis named “NAME” is not defined in Input Manager. Click “Edit” > “Project Settings” > “Input” and check the list of input axis. There is no axis named “Joystick Look Horizontal”.

The project settings, including the “Input Axis”, are defined in the “ProjectSettings” directory in steamapps. Therefore, you need to place this ProjectSettings directory in your own project directory. In my case, I placed a wrong one.

Solution

Close unity project. And put the “ProjectSettings” into the project directory.

Result

You can control the character with no error.

Error “Docker.ApiServices.WSL2.WslKernelUpdateNotInstalledException”

This is a trouble shooting log.

Problem

I downloaded the installer of Docker-Desktop from download page here. And executed the installer and start Docker. Then the error was displayed after starting Docker-Desktop.

Cause

Let’s see the window behind the exception window by Microsoft .NET Framework.

The WSL 2 Linux kernel is now installed using a separate MSI update package.
Please click the link and follow the instructions to install the kernel update:
http://aka.ms/wsl2kernel.

Press Restart after installing the Linux kernel.

That’s the cause of the error. We should install “WSL 2” by ourselves now.

Solution

Install WSL 2 Linux kernel whose installer is in http://aka.ms/wsl2kernel.

from wsl_update_x64.msi

After installing WSL 2, restart the Docker-Desktop.

The window displayed when started successfully

[Trouble Shooting] Cannot Use Library In Jupyter Notebook

Environment

Python 3.8.4
pip 20.1.1

Problem

I installed “matblotlib” by using pip3 command on the terminal as below. I can import matplotlib on the terminal.

% pip3 install matplotlib 
% python3
Python 3.8.4 (default, Jul 14 2020, 02:58:48) 
[Clang 11.0.3 (clang-1103.0.32.62)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>> 

In jupyter notebook,

import matplotlib
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-3-0484cd13f94d> in <module>
----> 1 import matplotlib

ModuleNotFoundError: No module named 'matplotlib'

Check the situation

The reference path for jupyter notebook might differ from the one of host python3.

Jupyter notebook refers the python 3.8 in jupyterlab/2.2.0/libexec/lib

import sys
print(sys.version)
print(sys.path)

3.8.4 (default, Jul 14 2020, 02:58:48) 
[Clang 11.0.3 (clang-1103.0.32.62)]
['/usr/local/Cellar/jupyterlab/2.2.0/libexec/lib/python38.zip', '/usr/local/Cellar/jupyterlab/2.2.0/libexec/lib/python3.8', '/usr/local/Cellar/jupyterlab/2.2.0/libexec/lib/python3.8/lib-dynload', '/usr/local/opt/python@3.8/Frameworks/Python.framework/Versions/3.8/lib/python3.8', '', '/usr/local/Cellar/jupyterlab/2.2.0/libexec/lib/python3.8/site-packages', '/usr/local/Cellar/jupyterlab/2.2.0/libexec/lib/python3.8/site-packages/IPython/extensions', '/Users/<username>/.ipython']

On terminal, Python3 is in /usr/local/Cellar.

>>> import sys
>>> print(sys.version)
>>> print(sys.path)

3.8.4 (default, Jul 14 2020, 02:58:48) 
[Clang 11.0.3 (clang-1103.0.32.62)]

['', '/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python38.zip', '/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8', '/usr/local/Cellar/python@3.8/3.8.4/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/site-packages']

Cause

In my case, the problem caused by homebrew. Installation of Jupyter Lab or Jupyter Notebook with brew command caused the different reference to python3 as above.

We can check the list of installed items with the following command on the terminal.

% brew list
autoconf	ipython		openssl@1.1	python@3.8	xz
flake8		jupyterlab	pandoc		readline	zeromq
gdbm		libyaml		perl		ruby
gettext		lua		pkg-config	sqlite
icu4c		node		pyenv		vim

Solution

My solutions is to uninstall jupyterlab with brew command and install it again with pip3.

% brew uninstall jupyterlab
Uninstalling /usr/local/Cellar/jupyterlab/2.2.0... (7,150 files, 106.8MB)

% python3 -m pip install jupyterlab
Collecting jupyterlab
  Downloading jupyterlab-3.1.7-py3-none-any.whl (8.5 MB)
     |████████████████████████████████| 8.5 MB 136 kB/s 
...

Start Jupyter Lab from the terminal.

% jupyter lab

I found another it could be a solution for similar problem to install ipykernel. Check ModuleNotFound Error for matplotlib for detail.

[Trouble Shooting] error “fatal: refusing to merge unrelated histories” in Git

Problem

When I tried to pull from remote repository, the error “fatal: refusing to merge unrelated histories” occurred. How can I solve it?

$ git pull origin main
warning: no common commits
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/s-nako/ColorSelector
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main
fatal: refusing to merge unrelated histories

Cause

This error occurs because “pull” command is targeted for 2 branches that has same root. In my case, remote main was generated on GItHub and local main was generated in local directory by “git init”.

Solution

Use “–allow-unrelated-histories” option for pull command as below.

$ git pull origin main --allow-unrelated-histories
From https://github.com/s-nako/ColorSelector
 * branch            main       -> FETCH_HEAD
Merge made by the 'recursive' strategy.
 README.md | 2 ++
 1 file changed, 2 insertions(+)
 create mode 100644 README.md

How To Fix Texture Colored Pink In Blender

Problem

When I open Blender file, the textured model is rendered with pink single-colored texture. How can I fix it?

Texture node on Node Editor

Environment

Blender 2.8.3(LTS)
Windows10

Cause

Pink means missing texture. Blender couldn’t find the specified texture.

Solution

References: You can find solutions in the followings in most cases.
Why are all the textures in my file pink?
Pink textures in Blender and how to avoid them

However, this sometimes occurred when the texture is just overwritten. In that case, I fixed by following steps below.

1. Disconnect Image Texture Node from Base Color socket of Shader Node.

2. Reset texture in Image Texture Node on Node Editor

3. Reconnect Nodes