1/1

Python cgkit2.0 has been installed under CentOS6.10

out.jpg

# yum groupinstall "Development Tools"

# uname -a
Linux localhost.localdomain 2.6.32-754.28.1.el6.x86_64 #1 SMP Wed Mar 11 18:38:45 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

python-devel


# yum install python-devel

freeglut


# yum install freeglut
# yum install freeglut-devel
Installed:
freeglut-devel.x86_64 0:2.6.0-1.el6
Dependency Installed:
libX11-devel.x86_64 0:1.6.4-3.el6
libXau-devel.x86_64 0:1.0.6-4.el6
libXdamage-devel.x86_64 0:1.1.3-4.el6
libXext-devel.x86_64 0:1.3.3-1.el6
libXfixes-devel.x86_64 0:5.0.3-1.el6
libXxf86vm-devel.x86_64 0:1.1.3-2.1.el6
libdrm-devel.x86_64 0:2.4.65-2.el6
libxcb-devel.x86_64 0:1.12-4.el6
mesa-libGL-devel.x86_64 0:11.0.7-4.el6
mesa-libGLU-devel.x86_64 0:11.0.7-4.el6
xorg-x11-proto-devel.noarch 0:7.7-14.el6

PIL1.17, PyOpenGL, scons, ..etc..


# yum install python-imaging
# yum install PyOpenGL
# yum install scons
# yum install glibc-static
Installed:
glibc-static.x86_64 0:2.12-1.212.el6_10.3
# yum install compat-libstdc++-33-3.2.3-69.el6.x86_64

pygame


https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/p/pygame-1.9.1-4.el6.x86_64.rpm
# rpm -Uvh pygame-1.9.1-4.el6.x86_64.rpm
warning: pygame-1.9.1-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
error: Failed dependencies:
libSDL_image-1.2.so.0()(64bit) is needed by pygame-1.9.1-4.el6.x86_64
libSDL_mixer-1.2.so.0()(64bit) is needed by pygame-1.9.1-4.el6.x86_64
libSDL_ttf-2.0.so.0()(64bit) is needed by pygame-1.9.1-4.el6.x86_64
libportmidi.so.0()(64bit) is needed by pygame-1.9.1-4.el6.x86_6

https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/s/SDL_image-1.2.12-9.el6.x86_64.rpm
# rpm -Uvh SDL_image-1.2.12-9.el6.x86_64.rpm
warning: SDL_image-1.2.12-9.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:SDL_image ########################################### [100%]

https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/s/SDL_mixer-1.2.12-1.el6.x86_64.rpm
# rpm -Uvh SDL_mixer-1.2.12-1.el6.x86_64.rpm
warning: SDL_mixer-1.2.12-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:SDL_mixer ########################################### [100%]

https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/s/SDL_ttf-2.0.11-6.el6.x86_64.rpm
# rpm -Uvh SDL_ttf-2.0.11-6.el6.x86_64.rpm
warning: SDL_ttf-2.0.11-6.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:SDL_ttf ########################################### [100%]

https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/p/portmidi-217-3.el6.x86_64.rpm
rpm -Uvh portmidi-217-3.el6.x86_64.rpm
warning: portmidi-217-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:portmidi ########################################### [100%]

# rpm -Uvh pygame-1.9.1-4.el6.x86_64.rpm
warning: pygame-1.9.1-4.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:pygame ########################################### [100%]

PyProtocols-0.9.3


# python setup.py --without-speedups install

boost-devel


# yum install boost-devel-1.41.0-28.el6.x86_64
Installed:
boost-devel.x86_64 0:1.41.0-28.el6
Dependency Installed:
boost.x86_64 0:1.41.0-28.el6
boost-date-time.x86_64 0:1.41.0-28.el6
boost-graph.x86_64 0:1.41.0-28.el6
boost-iostreams.x86_64 0:1.41.0-28.el6
boost-math.x86_64 0:1.41.0-28.el6
boost-python.x86_64 0:1.41.0-28.el6
boost-regex.x86_64 0:1.41.0-28.el6
boost-serialization.x86_64 0:1.41.0-28.el6
boost-signals.x86_64 0:1.41.0-28.el6
boost-test.x86_64 0:1.41.0-28.el6
boost-thread.x86_64 0:1.41.0-28.el6
boost-wave.x86_64 0:1.41.0-28.el6

ode ode-devel


not ode.i686 but ode.x86_64.
http://rpm.pbone.net/index.php3/stat/3/srodzaj/1/search/ode-devel
ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/epel/5/x86_64/ode-0.11.1-4.el5.x86_64.rpm
ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/epel/5/x86_64/ode-devel-0.11.1-4.el5.x86_64.rpm

Pyrex


http://mirror.centos.org/centos/6/os/i386/Packages/Pyrex-0.9.8.4-4.1.el6.noarch.rpm
# rpm -Uvh Pyrex-0.9.8.4-4.1.el6.noarch.rpm
Preparing... ########################################### [100%]
1:Pyrex ########################################### [100%]

Download:PyODE


http://pyode.sourceforge.net/#download
# python setup.py build
# python setup.py install

Download:Pyserials


http://pypi.python.org/pypi/pyserial
pyserial-2.6.tar.gz

https://files.pythonhosted.org/packages/fb/93/e350757db177234e77037dbbbf8551c0a6e43b634f375590399fef920fde/pyserial-2.6.tar.gz

# python setup.py install

Download:cgkit



$ python checkenv.py
----------------------------------------------------------------------
Python 2.6.6 (r266:84292, Jun 20 2019, 14:14:55)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)]
Platform: linux2
----------------------------------------------------------------------
Python version: 2.6........... OK
PyProtocols................... is installed
PyOpenGL...................... is installed
PIL........................... is installed
pygame........................ is installed
PyODE......................... missing

The Python bindings of the Open Dynamics Engine (ODE) are not installed.
You will not be able to use the ODEDynamics component to do rigid body
simulations. You can get PyODE at http://pyode.sourceforge.net/

PySerial...................... missing

PySerial is not installed. This module is only required for accessing
an Ascension Flock Of Bird motion tracker. You can get the module at
http://pyserial.sourceforge.net/

cgkit (base).................. missing
cgkit (C++ lib)............... failed

The cgkit supportlib could not be imported. One possible reason for that
is that shared libraries (such as the boost_python runtime or OpenGL)
could not be found.

cgkit (all)................... failed


lib3ds lib3ds-devel


https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/l/lib3ds-1.3.0-9.el6.x86_64.rpm
http://rpmfind.net/linux/RPM/dag/redhat/el6/x86_64/lib3ds-1.2.0-1.el6.rf.x86_64.html
-------------------------
https://download-ib01.fedoraproject.org/pub/epel/6/x86_64/Packages/l/lib3ds-devel-1.3.0-9.el6.x86_64.rpm
-------------------------

# rpm -Uvh lib3ds-1.3.0-9.el6.x86_64.rpm
warning: lib3ds-1.3.0-9.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:lib3ds ########################################### [100%]
[root@localhost Downloads]# rpm -Uvh lib3ds-devel-1.3.0-9.el6.x86_64.rpm
warning: lib3ds-devel-1.3.0-9.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
Preparing... ########################################### [100%]
1:lib3ds-devel ########################################### [100%]


config.cfg


config_template.cfg in cgkit2.0.0 folder
rename config.cfg

####### Libd3DS #######

LIB3DS_AVAILABLE = True
LIB3DS_PATH = r"/usr/lib64"
LIB3DS_LIBNAME = "lib3ds"

Error case1: cgkit 3ds import plugin


following are: build error
/usr/bin/ld: cannot find -llib3ds
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1


g++ -pthread -shared build/temp.linux-x86_64-2.6/wrappers/py_wrapper.o build/temp.linux-x86_64-2.6/wrappers/py_noise.o build/temp.linux-x86_64-2.6/wrappers/py_vec3.o build/temp.linux-x86_64-2.6/wrappers/py_vec4.o build/temp.linux-x86_64-2.6/wrappers/py_mat3.o build/temp.linux-x86_64-2.6/wrappers/py_mat4.o build/temp.linux-x86_64-2.6/wrappers/py_quat.o build/temp.linux-x86_64-2.6/wrappers/py_slots1.o build/temp.linux-x86_64-2.6/wrappers/py_slots2.o build/temp.linux-x86_64-2.6/wrappers/py_slots3.o build/temp.linux-x86_64-2.6/wrappers/py_slots4.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslots1.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslots2.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslot_mat3.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslot_mat4.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslots4.o build/temp.linux-x86_64-2.6/wrappers/py_component.o build/temp.linux-x86_64-2.6/wrappers/py_boundingbox.o build/temp.linux-x86_64-2.6/wrappers/py_worldobject.o build/temp.linux-x86_64-2.6/wrappers/py_worldobject2.o build/temp.linux-x86_64-2.6/wrappers/py_worldobject3.o build/temp.linux-x86_64-2.6/wrappers/py_material.o build/temp.linux-x86_64-2.6/wrappers/py_glmaterial.o build/temp.linux-x86_64-2.6/wrappers/py_geoms1.o build/temp.linux-x86_64-2.6/wrappers/py_spheregeom.o build/temp.linux-x86_64-2.6/wrappers/py_ccylindergeom.o build/temp.linux-x86_64-2.6/wrappers/py_torusgeom.o build/temp.linux-x86_64-2.6/wrappers/py_boxgeom.o build/temp.linux-x86_64-2.6/wrappers/py_planegeom.o build/temp.linux-x86_64-2.6/wrappers/py_trimeshgeom.o build/temp.linux-x86_64-2.6/wrappers/py_polyhedrongeom.o build/temp.linux-x86_64-2.6/wrappers/py_drawgeom.o build/temp.linux-x86_64-2.6/wrappers/py_lightsource.o build/temp.linux-x86_64-2.6/wrappers/py_glpointlight.o build/temp.linux-x86_64-2.6/wrappers/py_glspotlight.o build/temp.linux-x86_64-2.6/wrappers/py_gldistantlight.o build/temp.linux-x86_64-2.6/wrappers/py_glrenderer.o build/temp.linux-x86_64-2.6/wrappers/py_massproperties.o build/temp.linux-x86_64-2.6/wrappers/rply/rply/rply.o build/temp.linux-x86_64-2.6/wrappers/rply/py_rply_read.o build/temp.linux-x86_64-2.6/wrappers/rply/py_rply_write.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/common_funcs.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/nodedata.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/light.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/mesh.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/material.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/lib3ds.o -Lsupportlib/lib -L/usr/lib64 -lboost_python -lcore /usr/lib64/lib3ds.a -lGL -lGLU -lpython2.6 -o build/lib.linux-x86_64-2.6/cgkit/_core.so

/usr/bin/ld: /usr/lib64/lib3ds.a(file.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/lib3ds.a: could not read symbols: Bad value
collect2: ld returned 1 exit status

Error case2: cgkit 3ds import plugin



####### Libd3DS #######

LIB3DS_AVAILABLE = True
LIB3DS_PATH = r"/usr/lib64"
LIB3DS_LIBNAME = "lib3ds"

# ldconfig

lib64]# ls -l lib3ds*
lrwxrwxrwx. 1 root root 17 May 1 20:14 lib3ds-1.so.3 -> lib3ds-1.so.3.0.0
-rwxr-xr-x. 1 root root 123688 Sep 15 2010 lib3ds-1.so.3.0.0
lrwxrwxrwx. 1 root root 17 May 1 20:14 lib3ds.so -> lib3ds-1.so.3.0.0

# ldconfig -p | grep lib3ds
lib3ds-1.so.3 (libc6,x86-64) => /usr/lib64/lib3ds-1.so.3

# ln -s /usr/lib64/lib3ds-1.so.3 /usr/lib64/lib3ds.so

[root@localhost cgkit-2.0.0]# ldconfig -p | grep lib3ds
lib3ds-1.so.3 (libc6,x86-64) => /usr/lib64/lib3ds-1.so.3
[root@localhost cgkit-2.0.0]# ln -s /usr/lib64/lib3ds-1.so.3 /usr/lib64/lib3ds.so
ln: creating symbolic link `/usr/lib64/lib3ds.so': File exists

cgkit 3ds import plugin


changed config.cfg

---------------------------
####### Libd3DS #######
LIB3DS_AVAILABLE = True
LIB3DS_PATH = r"/usr/lib64/lib3ds.so"
#LIB3DS_LIBNAME = "3ds"
----------------------------
# python setup.py build

g++ -pthread -shared build/temp.linux-x86_64-2.6/wrappers/py_wrapper.o build/temp.linux-x86_64-2.6/wrappers/py_noise.o build/temp.linux-x86_64-2.6/wrappers/py_vec3.o build/temp.linux-x86_64-2.6/wrappers/py_vec4.o build/temp.linux-x86_64-2.6/wrappers/py_mat3.o build/temp.linux-x86_64-2.6/wrappers/py_mat4.o build/temp.linux-x86_64-2.6/wrappers/py_quat.o build/temp.linux-x86_64-2.6/wrappers/py_slots1.o build/temp.linux-x86_64-2.6/wrappers/py_slots2.o build/temp.linux-x86_64-2.6/wrappers/py_slots3.o build/temp.linux-x86_64-2.6/wrappers/py_slots4.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslots1.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslots2.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslot_mat3.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslot_mat4.o build/temp.linux-x86_64-2.6/wrappers/py_arrayslots4.o build/temp.linux-x86_64-2.6/wrappers/py_component.o build/temp.linux-x86_64-2.6/wrappers/py_boundingbox.o build/temp.linux-x86_64-2.6/wrappers/py_worldobject.o build/temp.linux-x86_64-2.6/wrappers/py_worldobject2.o build/temp.linux-x86_64-2.6/wrappers/py_worldobject3.o build/temp.linux-x86_64-2.6/wrappers/py_material.o build/temp.linux-x86_64-2.6/wrappers/py_glmaterial.o build/temp.linux-x86_64-2.6/wrappers/py_geoms1.o build/temp.linux-x86_64-2.6/wrappers/py_spheregeom.o build/temp.linux-x86_64-2.6/wrappers/py_ccylindergeom.o build/temp.linux-x86_64-2.6/wrappers/py_torusgeom.o build/temp.linux-x86_64-2.6/wrappers/py_boxgeom.o build/temp.linux-x86_64-2.6/wrappers/py_planegeom.o build/temp.linux-x86_64-2.6/wrappers/py_trimeshgeom.o build/temp.linux-x86_64-2.6/wrappers/py_polyhedrongeom.o build/temp.linux-x86_64-2.6/wrappers/py_drawgeom.o build/temp.linux-x86_64-2.6/wrappers/py_lightsource.o build/temp.linux-x86_64-2.6/wrappers/py_glpointlight.o build/temp.linux-x86_64-2.6/wrappers/py_glspotlight.o build/temp.linux-x86_64-2.6/wrappers/py_gldistantlight.o build/temp.linux-x86_64-2.6/wrappers/py_glrenderer.o build/temp.linux-x86_64-2.6/wrappers/py_massproperties.o build/temp.linux-x86_64-2.6/wrappers/rply/rply/rply.o build/temp.linux-x86_64-2.6/wrappers/rply/py_rply_read.o build/temp.linux-x86_64-2.6/wrappers/rply/py_rply_write.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/common_funcs.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/nodedata.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/light.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/mesh.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/material.o build/temp.linux-x86_64-2.6/wrappers/lib3ds/lib3ds.o -Lsupportlib/lib -L/usr/lib64 -lboost_python -lcore -l3ds -lGL -lGLU -lpython2.6 -o build/lib.linux-x86_64-2.6/cgkit/_core.so

# python setup.py install

[@localhost utilities]$ python checkenv.py
----------------------------------------------------------------------
Python 2.6.6 (r266:84292, Jun 20 2019, 14:14:55)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-23)]
Platform: linux2
----------------------------------------------------------------------
Python version: 2.6........... OK
PyProtocols................... is installed
PyOpenGL...................... is installed
PIL........................... is installed
pygame........................ is installed
PyODE......................... is installed
PySerial...................... is installed
cgkit (base).................. 2.0.0 (Apr 30 2020)
cgkit (C++ lib)............... OK
cgkit (all)................... OK

viewer.py bunny.3ds



$ render.py -rair bunny.3ds
  • -
  • -

Fedora 32 Black screen with no cursor after install or upgrade

Fedora 32 upgrade now.
after reboot.
but black screen.
for a while.

My laptop let power off.

power on.

GRUB bootloader to appear (the boot selection screen).
press the “e” key to edit.

Scroll down
The line should finally end with “rhgb” and “quiet”.
Remove “rhgb” and “quiet”, and then add “nomodeset=0”
Press “CTRL+x” to boot the system.
The system should now boot.

Installing starts.

Thank you.
https://www.stephenwagner.com/2018/08/25/fedora-core-black-screen-with-cursor-after-install-upgrade/
  • -
  • -

Fedora 32 boost python & python cgkit install under Fedora 32.

How to change default Python version on Linux/Fedora 32

under Fedora32

# alternatives --install /usr/bin/python python /usr/bin/python3.8 2
# alternatives --install /usr/bin/python python /usr/bin/python2.7 1

$ sudo alternatives --config python

2 プログラムがあり 'python' を提供します。

選択 コマンド
-----------------------------------------------
* 1 /usr/bin/python3.8
+ 2 /usr/bin/python2.7

Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:1

$ alternatives --list | grep -i python
python manual /usr/bin/python3.8

boost python


can not find -lboost_python

-----------------------------------------------
Install boost
Install boost-devel
Install python2-devel
Install python3-devel
Install boost-python2
Install boost-python3

-----------------------------------------------

-Lsupportlib/lib -L/usr/lib64 -lboost_python -lcore -l3ds -lGL -lGLU -lpython2.7 -o build/lib.linux-x86_64-2.7/cgkit/_core.so
/usr/bin/ld: -lboost_python が見つかりません
collect2: エラー: ld はステータス 1 で終了しました

$ sudo ldconfig -p | grep boost_python3
libboost_python38.so.1.69.0 (libc6,x86-64) => /lib64/libboost_python38.so.1.69.0

$ sudo ldconfig -p | grep boost_python2
libboost_python27.so.1.69.0 (libc6,x86-64) => /lib64/libboost_python27.so.1.69.0

/usr/lib64
$ sudo ln -s libboost_python27.so.1.69.0 libboost_python2.so

/usr/lib64 $ sudo ldconfig
-lboost_python2 is OK.

Boost.Python の機能をざっと紹介してみる
http://moriyoshi.hatenablog.com/entry/20091214/1260779899

export CPLUS_INCLUDE_PATH=/usr/include/python2.7

$ python
Python 2.7.18 (default, Apr 20 2020, 00:00:00)
[GCC 10.0.1 20200328 (Red Hat 10.0.1-0.11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
$ export CPLUS_INCLUDE_PATH=/usr/include/python2.7
$ g++ -I`python -c 'from distutils.sysconfig import *; get_python_inc()'` -DPIC -shared -fPIC -o basic.so basic.cpp -lboost_python-py27
/usr/bin/ld: -lboost_python-py27 が見つかりません
collect2: エラー: ld はステータス 1 で終了しました

g++ -I`python -c 'from distutils.sysconfig import *; get_python_inc()'` -DPIC -shared -fPIC -o basic.so basic.cpp -lboost_python2

python cgkit install under fedora 32


switch python2.7
$ sudo alternatives --config python
[sudo] のパスワード:

3 プログラムがあり 'python' を提供します。

選択 コマンド
-----------------------------------------------
1 /usr/bin/python3.7
+ 2 /usr/bin/python2.7
* 3 /usr/bin/python3.8

Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:
$ alternatives --list | grep -i python
python manual /usr/bin/python2.7
------------------------------------------------

/usr/lib64
$ sudo ln -s libboost_python27.so.1.69.0 libboost_python2.so
------------------------------------------------

python cgkit folder config.cfg
######################################################################
# Boost.Python settings
######################################################################

# Name of the Boost.Python library to link with
BOOST_LIB = "boost_python2"

######################################################################
# Optional libraries
######################################################################

Install lib3ds-devel

####### Libd3DS #######

LIB3DS_AVAILABLE = True
LIB3DS_PATH = r"/lib64/"
LIB3DS_LIBNAME = "3ds"
------------------------------------------------
$ sudo python setup.py build
.....
.....
.....
$ sudo python setup.py install
python cgkit is OK.

alternatives --remove python


$ sudo alternatives --config python
[sudo] のパスワード:

3 プログラムがあり 'python' を提供します。

選択 コマンド
-----------------------------------------------
1 /usr/bin/python3.7
+ 2 /usr/bin/python2.7
* 3 /usr/bin/python3.8

Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:

$ sudo alternatives --remove python /usr/bin/python3.7

$ sudo alternatives --config python

2 プログラムがあり 'python' を提供します。

選択 コマンド
-----------------------------------------------
* 1 /usr/bin/python3.8
+ 2 /usr/bin/python2.7

Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:
-----------------------------------------------------------
$ sudo alternatives --config python

2 プログラムがあり 'python' を提供します。

選択 コマンド
-----------------------------------------------
* 1 /usr/bin/python3.8
+ 2 /usr/bin/python2.7

Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:1
~]$ python
Python 3.8.2 (default, Feb 28 2020, 00:00:00)
[GCC 10.0.1 20200216 (Red Hat 10.0.1-0.8)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
~]$ sudo alternatives --config python

2 プログラムがあり 'python' を提供します。

選択 コマンド
-----------------------------------------------
*+ 1 /usr/bin/python3.8
2 /usr/bin/python2.7

Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:2
~]$ python
Python 2.7.18 (default, Apr 20 2020, 00:00:00)
[GCC 10.0.1 20200328 (Red Hat 10.0.1-0.11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

Thank you.
  • -
  • -

Fujiyama-Renderer-0.3.6 has installed under Fedora 32

Download Fujiyama-Renderer-0.3.6.tar.gz
Rename Fujiyama-Renderer folder

Edit.
# nano .bash_profile

#Fujiyama-Renderer
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/Fujiyama-Renderer/lib
export PATH=$PATH:/home/yourname/Fujiyama-Renderer/bin
export FJ_LIBRARY_PATH=/home/yourname/Fujiyama-Renderer/lib

creat mesh folder and ply folder and hdr folder.
copy fujiyama.py to bin folder.
$ export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/site-packages/:$HOME/Fujiyama-Renderer/bin/

not python3.8.
Python 3 is not supported.
$ python teapot2.py

thank you.

si.SetProperty2('ren1', 'resolution', 320, 240)
si.SetProperty2('ren1', 'pixelsamples', 32, 32)
rendering time: 14m by my laptop 8 years ago
fujipath

Resolution: 640 x 480
rendering time: 0h 12m 8s
pyro01
  • -
  • -

Primitive group in Fujiyama Renderer

feature since v0.2.9
-------------------------------------------------
* Mesh primitive group has been supported. Different shaders can be assigned to each primitive group. Shading group tagged by 'g' in wavefront obj file is converted to primitive group in Fujiyama.
twoboxes

OBJ export from blender


open obj file with text editor.
change o Cube.001 -----> g Cube.001
change o Cube -----> g Cube
following are: test01.obj

# Blender v2.79 (sub 0) OBJ File: ''
# www.blender.org
mtllib test01.mtl
g Cube.001
v 2.320780 -0.989213 -3.512618
v 2.320780 -0.989213 -1.512618
v 0.320780 -0.989213 -1.512618
v 0.320780 -0.989213 -3.512618
v 2.320780 1.010787 -3.512617
v 2.320779 1.010787 -1.512617
v 0.320780 1.010787 -1.512618
v 0.320780 1.010787 -3.512618
vn 0.0000 -1.0000 -0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
usemtl Material.001
s off
f 1//1 2//1 3//1 4//1
f 5//2 8//2 7//2 6//2
f 1//3 5//3 6//3 2//3
f 2//4 6//4 7//4 3//4
f 3//5 7//5 8//5 4//5
f 5//6 1//6 4//6 8//6
g Cube
v 1.000000 -1.000000 -1.000000
v 1.000000 -1.000000 1.000000
v -1.000000 -1.000000 1.000000
v -1.000000 -1.000000 -1.000000
v 1.000000 1.000000 -0.999999
v 0.999999 1.000000 1.000001
v -1.000000 1.000000 1.000000
v -1.000000 1.000000 -1.000000
vn 0.0000 -1.0000 0.0000
vn 0.0000 1.0000 0.0000
vn 1.0000 0.0000 0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn 0.0000 0.0000 -1.0000
usemtl Material
s off
f 9//7 10//7 11//7 12//7
f 13//8 16//8 15//8 14//8
f 9//9 13//9 14//9 10//9
f 10//10 14//10 15//10 11//10
f 11//11 15//11 16//11 12//11
f 13//12 9//12 12//12 16//12

Material: test01.mtl



# Blender MTL File: 'None'
# Material Count: 2
newmtl Material
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.800000 0.000000 0.000000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

newmtl Material.001
Ns 96.078431
Ka 1.000000 1.000000 1.000000
Kd 0.008794 0.005152 0.640000
Ks 0.500000 0.500000 0.500000
Ke 0.000000 0.000000 0.000000
Ni 1.000000
d 1.000000
illum 2

Use wavefrontobj.py


open terminal.
$ export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/site-packages/:$HOME/Fujiyama-Renderer/bin/

$ python wavefrontobj.py test01.obj


# Setting up environment variable
# FJ_LIBRARY_PATH = /home/mac/Fujiyama-Renderer/lib
reading test01.obj
reading test01.mtl

si.NewShader(Material, PlasticShader)
si.SetProperty3(Material, ambient, 1.0, 1.0, 1.0)
si.SetProperty3(Material, diffuse, 0.8, 0.0, 0.0)
si.SetProperty3(Material, reflection, 0.5, 0.5, 0.5)

si.NewShader(Material.001, PlasticShader)
si.SetProperty3(Material.001, ambient, 1.0, 1.0, 1.0)
si.SetProperty3(Material.001, diffuse, 0.008794, 0.005152, 0.64)
si.SetProperty3(Material.001, reflection, 0.5, 0.5, 0.5)

si.AssignShader(myobj, Cube.001, Material.001)
si.AssignShader(myobj, Cube, Material)

Rendering with Fujiyama Renderer


following are : two_boxes. Thank You.

import fujiyama
si = fujiyama.SceneInterface()

#plugins
si.OpenPlugin('plastic_shader', 'PlasticShader')
si.OpenPlugin('glass_shader', 'GlassShader')
si.OpenPlugin('constant_shader', 'ConstantShader')
si.OpenPlugin('stanfordply_procedure', 'StanfordPlyProcedure')
si.OpenPlugin('wavefrontobj_procedure', 'WavefrontObjProcedure')

#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetProperty3('cam1', 'translate', 0, 2, 7)
#si.SetProperty3('cam1', 'rotate', -5.710593137499643, 0, 0)
si.SetProperty3('cam1', 'rotate', -8, 0, 0)

#Light
si.NewLight('light0', 'PointLight')
si.SetProperty3('light0', 'translate', 0.900771, 12, 4.09137)
si.SetProperty1('light0', 'intensity', 0.03125)
si.NewLight('light1', 'PointLight')
si.SetProperty3('light1', 'translate', 2.02315, 12, 5.28021)
si.SetProperty1('light1', 'intensity', 0.03125)
si.NewLight('light2', 'PointLight')
si.SetProperty3('light2', 'translate', 10.69, 12, 13.918)
si.SetProperty1('light2', 'intensity', 0.03125)
si.NewLight('light3', 'PointLight')
si.SetProperty3('light3', 'translate', 4.28027, 12, 7.58462)
si.SetProperty1('light3', 'intensity', 0.03125)
si.NewLight('light4', 'PointLight')
si.SetProperty3('light4', 'translate', 12.9548, 12, 1.19914)
si.SetProperty1('light4', 'intensity', 0.03125)
si.NewLight('light5', 'PointLight')
si.SetProperty3('light5', 'translate', 6.55808, 12, 2.31772)
si.SetProperty1('light5', 'intensity', 0.03125)
si.NewLight('light6', 'PointLight')
si.SetProperty3('light6', 'translate', 0.169064, 12, 10.9623)
si.SetProperty1('light6', 'intensity', 0.03125)
si.NewLight('light7', 'PointLight')
si.SetProperty3('light7', 'translate', 1.25002, 12, 4.51314)
si.SetProperty1('light7', 'intensity', 0.03125)
si.NewLight('light8', 'PointLight')
si.SetProperty3('light8', 'translate', 2.46758, 12, 5.73382)
si.SetProperty1('light8', 'intensity', 0.03125)
si.NewLight('light9', 'PointLight')
si.SetProperty3('light9', 'translate', 3.55644, 12, 6.84334)
si.SetProperty1('light9', 'intensity', 0.03125)
si.NewLight('light10', 'PointLight')
si.SetProperty3('light10', 'translate', 4.76112, 12, 8.00264)
si.SetProperty1('light10', 'intensity', 0.03125)
si.NewLight('light11', 'PointLight')
si.SetProperty3('light11', 'translate', 13.3267, 12, 9.10333)
si.SetProperty1('light11', 'intensity', 0.03125)
si.NewLight('light12', 'PointLight')
si.SetProperty3('light12', 'translate', 14.4155, 12, 2.68084)
si.SetProperty1('light12', 'intensity', 0.03125)
si.NewLight('light13', 'PointLight')
si.SetProperty3('light13', 'translate', 8.10755, 12, 3.79629)
si.SetProperty1('light13', 'intensity', 0.03125)
si.NewLight('light14', 'PointLight')
si.SetProperty3('light14', 'translate', 9.21103, 12, 4.9484)
si.SetProperty1('light14', 'intensity', 0.03125)
si.NewLight('light15', 'PointLight')
si.SetProperty3('light15', 'translate', 2.83469, 12, 6.09221)
si.SetProperty1('light15', 'intensity', 0.03125)
si.NewLight('light16', 'PointLight')
si.SetProperty3('light16', 'translate', 4.00945, 12, 7.18302)
si.SetProperty1('light16', 'intensity', 0.03125)
si.NewLight('light17', 'PointLight')
si.SetProperty3('light17', 'translate', 12.6072, 12, 0.832089)
si.SetProperty1('light17', 'intensity', 0.03125)
si.NewLight('light18', 'PointLight')
si.SetProperty3('light18', 'translate', 6.21169, 12, 1.98055)
si.SetProperty1('light18', 'intensity', 0.03125)
si.NewLight('light19', 'PointLight')
si.SetProperty3('light19', 'translate', 7.39599, 12, 10.5563)
si.SetProperty1('light19', 'intensity', 0.03125)
si.NewLight('light20', 'PointLight')
si.SetProperty3('light20', 'translate', 8.52421, 12, 4.15086)
si.SetProperty1('light20', 'intensity', 0.03125)
si.NewLight('light21', 'PointLight')
si.SetProperty3('light21', 'translate', 9.5891, 12, 5.39715)
si.SetProperty1('light21', 'intensity', 0.03125)
si.NewLight('light22', 'PointLight')
si.SetProperty3('light22', 'translate', 3.18967, 12, 13.9542)
si.SetProperty1('light22', 'intensity', 0.03125)
si.NewLight('light23', 'PointLight')
si.SetProperty3('light23', 'translate', 4.41432, 12, 0.082813)
si.SetProperty1('light23', 'intensity', 0.03125)
si.NewLight('light24', 'PointLight')
si.SetProperty3('light24', 'translate', 5.48803, 12, 1.21856)
si.SetProperty1('light24', 'intensity', 0.03125)
si.NewLight('light25', 'PointLight')
si.SetProperty3('light25', 'translate', 6.57647, 12, 2.31432)
si.SetProperty1('light25', 'intensity', 0.03125)
si.NewLight('light26', 'PointLight')
si.SetProperty3('light26', 'translate', 0.265098, 12, 10.9453)
si.SetProperty1('light26', 'intensity', 0.03125)
si.NewLight('light27', 'PointLight')
si.SetProperty3('light27', 'translate', 8.84422, 12, 12.1117)
si.SetProperty1('light27', 'intensity', 0.03125)
si.NewLight('light28', 'PointLight')
si.SetProperty3('light28', 'translate', 10.0154, 12, 5.67625)
si.SetProperty1('light28', 'intensity', 0.03125)
si.NewLight('light29', 'PointLight')
si.SetProperty3('light29', 'translate', 11.0907, 12, 14.4043)
si.SetProperty1('light29', 'intensity', 0.03125)
si.NewLight('light30', 'PointLight')
si.SetProperty3('light30', 'translate', 4.71726, 12, 7.98851)
si.SetProperty1('light30', 'intensity', 0.03125)
si.NewLight('light31', 'PointLight')
si.SetProperty3('light31', 'translate', 13.3907, 12, 9.08986)
si.SetProperty1('light31', 'intensity', 0.03125)

#Texture
# You can specify file paths to *.hdr/*.jpg file via python API
si.NewTexture('tex1', '../hdr/grace-new.hdr')

#Shader
si.NewShader('floor_shader', 'plastic_shader')
si.NewShader('dome_shader', 'constant_shader')

si.NewShader("Material", 'plastic_shader')
si.SetProperty3("Material", 'ambient', 1.0, 1.0, 1.0)
si.SetProperty3("Material", 'diffuse', 0.8, 0.0, 0.0)
si.SetProperty3("Material", 'reflect', 0.5, 0.5, 0.5)

si.NewShader("Material.001", 'plastic_shader')
si.SetProperty3("Material.001", 'ambient', 1.0, 1.0, 1.0)
si.SetProperty3("Material.001", 'diffuse', 0.008794, 0.005152, 0.64)
si.SetProperty3("Material.001", 'reflect', 0.5, 0.5, 0.5)

#Mesh
si.NewMesh('boxes_mesh')
si.NewMesh('floor_mesh')
si.NewMesh('dome_mesh')

#Procedure
si.NewProcedure('boxes_proc', 'wavefrontobj_procedure')
si.AssignMesh('boxes_proc', 'mesh', 'boxes_mesh')
si.SetStringProperty('boxes_proc', 'filepath', '../ply/test01.obj')
si.RunProcedure('boxes_proc')

si.NewProcedure('floor_proc', 'stanfordply_procedure')
si.AssignMesh('floor_proc', 'mesh', 'floor_mesh')
si.SetStringProperty('floor_proc', 'filepath', '../ply/floor.ply')
si.SetStringProperty('floor_proc', 'io_mode', 'r')
si.RunProcedure('floor_proc')

si.NewProcedure('dome_proc', 'stanfordply_procedure')
si.AssignMesh('dome_proc', 'mesh', 'dome_mesh')
si.SetStringProperty('dome_proc', 'filepath', '../ply/dome.ply')
si.SetStringProperty('dome_proc', 'io_mode', 'r')
si.RunProcedure('dome_proc')

#ObjectInstance
si.NewObjectInstance('boxes1', 'boxes_mesh')
#si.AssignShader('boxes1', 'DEFAULT_SHADING_GROUP', "Material")
si.AssignShader('boxes1', "Cube.001", "Material.001")
si.AssignShader('boxes1', "Cube", "Material")

si.NewObjectInstance('floor1', 'floor_mesh')
si.SetProperty3('floor1', 'translate', 0, -1, 0)
si.AssignShader('floor1', 'DEFAULT_SHADING_GROUP', 'floor_shader')

si.NewObjectInstance('dome1', 'dome_mesh')
si.SetProperty3('dome1', 'scale', .5, .5, .5)
si.SetProperty3('dome1', 'rotate', 0, 30, 0)
si.AssignShader('dome1', 'DEFAULT_SHADING_GROUP', 'dome_shader')
si.AssignTexture('dome_shader', 'texture', 'tex1')

#ObjectGroup
si.NewObjectGroup('group1')
si.AddObjectToGroup('group1', 'boxes1')
si.AssignObjectGroup('boxes1', 'shadow_target', 'group1')
si.AssignObjectGroup('floor1', 'shadow_target', 'group1')

#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')

#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 640, 480)
#si.SetProperty2('ren1', 'resolution', 160, 120)

#Rendering
si.RenderScene('ren1')

#Output
# You can specify file paths to *.exr file via python API
si.SaveFrameBuffer('fb1', '../two_boxes.fb')

#Run commands
si.Run()
#si.Print()
  • -
  • -

Furry_bunny by Fujiyama Renderer 0.3.6

解像度160*120で何度もレンダリングしました。
8年前、5万6千円で購入したノートpc、Linux Fedora 32を入れて、fujiyama Renderer 0.3.6で、stay home, うさぎモデルfurry_bunny、52分41秒かかりました。HDR素材は@cgphysical_i
さんサイトを利用しました。
DomeLightのintensityを2.0にしました。
ありがとうございます。
furrey_bunny


#!/usr/bin/env python
# 1 furry_bunny with 32 point lights
# NOTE curvegen generates different curve color
# since noise functions have been changed since v0.0.5.
# The sample image was rendered by v0.0.2.
# Copyright (c) 2011-2019 Hiroshi Tsubokawa

# NOTE How to make bunny.crv
# $ ply2mesh bunny.ply bunny.mesh
# $ curvegen bunny.mesh bunny.crv

import fujiyama
si = fujiyama.SceneInterface()

#plugins
si.OpenPlugin('plastic_shader', 'PlasticShader')
si.OpenPlugin('constant_shader', 'ConstantShader')
si.OpenPlugin('hair_shader', 'HairShader')
si.OpenPlugin('curve_generator_procedure', 'CurveGeneratorProcedure')
si.OpenPlugin('stanfordply_procedure', 'StanfordPlyProcedure')

#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetProperty3('cam1', 'translate', 1.6, 0.8, 1.8)
si.SetProperty3('cam1', 'rotate', -8.04946697553, 45, 0)

rot = 180

#Light
si.NewLight('light1', 'DomeLight')
si.SetProperty3('light1', 'rotate', 0, rot, 0)
#si.SetProperty1('light1', 'intensity', 0.0004)
si.SetProperty1('light1', 'intensity', 2.0)
si.SetProperty1('light1', 'sample_count', 256)

#Texture
si.NewTexture('tex1', '../hdr/HDR_tatami.hdr')
#si.NewTexture('tex1', '../hdr/hdrfree068.hdr')
si.AssignTexture('light1', 'environment_map', 'tex1');

#Shader
si.NewShader('curve_shader', 'hair_shader')
si.SetProperty3('curve_shader', 'diffuse', 1, 0, 0)
si.SetProperty3('curve_shader', 'specular', 1, 0.0, 0.0)
si.SetProperty3('curve_shader', 'reflect', 1, 0, 0)

si.NewShader('bunny_shader', 'plastic_shader')
#si.SetProperty3('bunny_shader', 'diffuse', 0.8, 0.5, 0.3)
si.SetProperty3('bunny_shader', 'diffuse', 1, 0, 0)
si.SetProperty3('bunny_shader', 'reflect', 1, 0.1, 0.1)

si.NewShader('floor_shader', 'plastic_shader')
si.SetProperty3('floor_shader', 'diffuse', 0.6, 0.65, 0.8)
si.SetProperty3('floor_shader', 'reflect', 0.4, 0.4, 0.4)

si.NewShader('dome_shader', 'constant_shader')

#Curve
si.NewCurve('curve_data')

#Mesh
si.NewMesh('bunny_mesh')
si.NewMesh('floor_mesh')
si.NewMesh('dome_mesh')

#Procedure
si.NewProcedure('bunny_proc', 'stanfordply_procedure')
si.AssignMesh('bunny_proc', 'mesh', 'bunny_mesh')
si.SetStringProperty('bunny_proc', 'filepath', '../ply/bunny.ply')
si.SetStringProperty('bunny_proc', 'io_mode', 'r')
si.RunProcedure('bunny_proc')

si.NewProcedure('dome_proc', 'stanfordply_procedure')
si.AssignMesh('dome_proc', 'mesh', 'dome_mesh')
si.SetStringProperty('dome_proc', 'filepath', '../ply/dome.ply')
si.SetStringProperty('dome_proc', 'io_mode', 'r')
si.RunProcedure('dome_proc')

si.NewProcedure('floor_proc', 'stanfordply_procedure')
si.AssignMesh('floor_proc', 'mesh', 'floor_mesh')
si.SetStringProperty('floor_proc', 'filepath', '../ply/floor.ply')
si.SetStringProperty('floor_proc', 'io_mode', 'r')
si.RunProcedure('floor_proc')

si.NewProcedure('bunny_hair_gen', 'curve_generator_procedure')
si.AssignMesh('bunny_hair_gen', 'mesh', 'bunny_mesh')
si.AssignCurve('bunny_hair_gen', 'curve', 'curve_data')
si.RunProcedure('bunny_hair_gen')

#ObjectInstance
si.NewObjectInstance('bunny1', 'bunny_mesh')
si.AssignShader('bunny1', 'DEFAULT_SHADING_GROUP', 'bunny_shader')

si.NewObjectInstance('floor1', 'floor_mesh')
si.SetProperty3('floor1', 'translate', 3, 0, 3)
si.AssignShader('floor1', 'DEFAULT_SHADING_GROUP', 'floor_shader')

si.NewObjectInstance('dome1', 'dome_mesh')
si.SetProperty3('dome1', 'scale', 0.5, 0.5, 0.5)
si.SetProperty3('dome1', 'rotate', 0, rot, 0)
si.AssignShader('dome1', 'DEFAULT_SHADING_GROUP', 'dome_shader')
si.AssignTexture('dome_shader', 'texture', 'tex1')

si.NewObjectInstance('curve1', 'curve_data')
si.AssignShader('curve1', 'DEFAULT_SHADING_GROUP', 'curve_shader')

#ObjectGroup
si.NewObjectGroup('group1')
si.AddObjectToGroup('group1', 'bunny1')
si.AddObjectToGroup('group1', 'curve1')
si.AssignObjectGroup('bunny1', 'shadow_target', 'group1')
si.AssignObjectGroup('curve1', 'shadow_target', 'group1')
si.AssignObjectGroup('floor1', 'shadow_target', 'group1')

#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')

si.ShowPropertyList('HairShader')
si.ShowPropertyList('CurveGeneratorProcedure')


#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 640, 480)
#si.SetProperty2('ren1', 'resolution', 160, 120)

#Rendering
si.RenderScene('ren1')

#Output
si.SaveFrameBuffer('fb1', '../furry_bunny_domelight.fb')

#Run commands
si.Run()
#si.Print()
  • -
  • -

Furry_Amabie by Fujiyama Renderer 0.3.6

アマビエ、
HDRは、サンフランシスコの教会。
furは、Building Acceleratorsに46分。
レンダリングは1分。
grid_amabie005.jpg
モデルだけ移動させたら、毛が抜けた。毛にも
SetProperty3 curve1 translate -1 0 0
が必要でした。一歩一歩、確認です。
毛の長さ0.12、CurveGeneratorProcedure2をmakeする。
grid_amabie006.jpg
Building Accelerators 4m 19s. Rendering time 43s.
毛の長さ0.04、色変更、CurveGeneratorProcedure3をmakeする。
grid_amabie4.jpg

#!/usr/bin/env python
# 1 amabie with 1 grid light Grace Cathedral, San Francisco
# Copyright (c) 2011-2019 Hiroshi Tsubokawa
import fujiyama
si = fujiyama.SceneInterface()

#plugins
#si.OpenPlugin('sss_shader', 'SSSShader')
si.OpenPlugin('constant_shader', 'ConstantShader')
si.OpenPlugin('plastic_shader', 'PlasticShader')
si.OpenPlugin('hair_shader', 'HairShader')
si.OpenPlugin('stanfordply_procedure', 'StanfordPlyProcedure')
si.OpenPlugin('wavefrontobj_procedure', 'WavefrontObjProcedure')
si.OpenPlugin('curve_generator2_procedure', 'CurveGeneratorProcedure2')

#Camera
si.NewCamera('cam1', 'PerspectiveCamera')
si.SetSampleProperty3('cam1', 'translate', 0, 1.5, 8, 0)

#Light
si.NewLight('light1', 'GridLight')
si.SetProperty1('light1', 'intensity', 2)
si.SetProperty3('light1', 'translate', 0, 10, 0)
si.SetProperty3('light1', 'rotate', 0, 0, 180)
scale = 7
si.SetProperty3('light1', 'scale', scale, scale, scale)

si.SetProperty1('light1', 'sample_count', 8)

#Texture
si.NewTexture('tex1', '../hdr/grace-new.hdr')

#Shader
si.NewShader('armadillo_shader', 'plastic_shader')
si.SetProperty3('armadillo_shader', 'diffuse', 1, 0, 0)
si.SetProperty3('armadillo_shader', 'reflect', 1, 0.1, 0.1)

si.NewShader('curve_shader', 'hair_shader')
si.SetProperty3('curve_shader', 'diffuse', 1, 1, 1)
si.SetProperty3('curve_shader', 'specular', 1, 1, 1)
si.SetProperty3('curve_shader', 'reflect', 0.5, 0.5, 0.5)
"""
si.NewShader('head_shader2', 'sss_shader')
si.SetProperty3('head_shader2', 'reflect', 0, 0, 0)
si.SetProperty1('head_shader2', 'enable_single_scattering', 1)
si.SetProperty1('head_shader2', 'enable_multiple_scattering', 0)
si.SetProperty1('head_shader2', 'single_scattering_samples', 1)
si.SetProperty1('head_shader2', 'multiple_scattering_samples', 1)
si.SetProperty3('head_shader2', 'scattering_coefficient', .07, .122, .19)
si.SetProperty3('head_shader2', 'absorption_coefficient', .00014, .00025, .00142)
si.SetProperty3('head_shader2', 'specular', .01, .01, .01)
"""

si.NewShader('floor_shader', 'plastic_shader')
si.SetProperty3('floor_shader', 'diffuse', .2, .25, .3)
si.SetProperty3('floor_shader', 'reflect', 0.95, 0.95, 0.95)

si.NewShader('dome_shader', 'constant_shader')
si.AssignTexture('dome_shader', 'texture', 'tex1')

#Curve
si.NewCurve('curve_data')

#Mesh
si.NewMesh('armadillo_mesh')
si.NewMesh('floor_mesh')
si.NewMesh('dome_mesh')

#Procedure
si.NewProcedure('armadillo_proc', 'stanfordply_procedure')
si.AssignMesh('armadillo_proc', 'mesh', 'armadillo_mesh')
si.SetStringProperty('armadillo_proc', 'filepath', '../ply/amabied.ply')
si.SetStringProperty('armadillo_proc', 'io_mode', 'r')
si.RunProcedure('armadillo_proc')

si.NewProcedure('floor_proc', 'stanfordply_procedure')
si.AssignMesh('floor_proc', 'mesh', 'floor_mesh')
si.SetStringProperty('floor_proc', 'filepath', '../ply/floor.ply')
si.SetStringProperty('floor_proc', 'io_mode', 'r')
si.RunProcedure('floor_proc')

si.NewProcedure('dome_proc', 'stanfordply_procedure')
si.AssignMesh('dome_proc', 'mesh', 'dome_mesh')
si.SetStringProperty('dome_proc', 'filepath', '../ply/dome.ply')
si.SetStringProperty('dome_proc', 'io_mode', 'r')
si.RunProcedure('dome_proc')

si.NewProcedure('bunny_hair_gen', 'curve_generator2_procedure')
si.AssignMesh('bunny_hair_gen', 'mesh', 'armadillo_mesh')
si.AssignCurve('bunny_hair_gen', 'curve', 'curve_data')
#si.SetProperty1('bunny_hair_gen', 'is_hair', 2)
si.RunProcedure('bunny_hair_gen')

#ObjectInstance
si.NewObjectInstance('armadillo1', 'armadillo_mesh')
si.SetProperty3('armadillo1', 'rotate', -90, 0, 0)
si.SetProperty3('armadillo1', 'scale', 2.2, 2.2, 2.2)
si.SetProperty3('armadillo1', 'translate', 0.3, 0, 0)
#si.SetProperty3('armadillo1', 'scale', 4.5, 4.5, 4.5)
#si.SetProperty3('armadillo1', 'translate', 1, -0.1, 0)
#si.SetProperty3('armadillo1', 'rotate', 0, 120, 0)
si.AssignShader('armadillo1', 'DEFAULT_SHADING_GROUP', 'armadillo_shader')

si.NewObjectInstance('floor1', 'floor_mesh')
si.AssignShader('floor1', 'DEFAULT_SHADING_GROUP', 'floor_shader')

si.NewObjectInstance('dome1', 'dome_mesh')
si.SetProperty3('dome1', 'rotate', 0, -90, 0)
si.AssignShader('dome1', 'DEFAULT_SHADING_GROUP', 'dome_shader')

si.NewObjectInstance('curve1', 'curve_data')
si.SetProperty3('curve1', 'rotate', -90, 0, 0)
si.SetProperty3('curve1', 'scale', 2.2, 2.2, 2.2)
si.SetProperty3('curve1', 'translate', 0.3, 0, 0)
si.AssignShader('curve1', 'DEFAULT_SHADING_GROUP', 'curve_shader')
#ObjectGroup
si.NewObjectGroup('group1')
si.AddObjectToGroup('group1', 'armadillo1')
si.AddObjectToGroup('group1', 'curve1')
si.AssignObjectGroup('armadillo1', 'shadow_target', 'group1')
si.AssignObjectGroup('curve1', 'shadow_target', 'group1')
si.AssignObjectGroup('floor1', 'shadow_target', 'group1')

#FrameBuffer
si.NewFrameBuffer('fb1', 'rgba')

#Renderer
si.NewRenderer('ren1')
si.AssignCamera('ren1', 'cam1')
si.AssignFrameBuffer('ren1', 'fb1')
si.SetProperty2('ren1', 'resolution', 640, 480)
#si.SetProperty2('ren1', 'resolution', 160, 120)
#si.SetProperty2('ren1', 'pixelsamples', 12, 12)

#Rendering
si.RenderScene('ren1')

#Output
si.SaveFrameBuffer('fb1', '../grid_amabie3.fb')

#Run commands
si.Run()
#si.Print()
  • -
  • -

wine-3.6 (Ubuntu 3.6-1) install under Linux Lite. 2020/5

Wineのインストール


Linux Lite4.2 64bitにwineをいれました。
Windows10では動かない、Lightflowやmetalight2が動くか確認した見ました。インストールは64bitですが、32bitのwinアプリが動きました。
■参考
下記を参考にしました。ありがとうございます。
ガラクタプログラム

■設定
Linux Liteを,virtualbox上で動かしています。

$ apt-file search winehq
たくさん、出てきます。
$ sudo apt-get update

$ sudo apt install wine-development

$ wine
Usage: wine PROGRAM [ARGUMENTS...] Run the specified program
wine --help Display this help and exit
wine --version Output version information and exit

$ wine --version
wine-3.6 (Ubuntu 3.6-1)

■設定方法
まずwinecfgを起動します。しばらく時間がかかる。
$ winecfg
$ wine notepad メモ帳
$ wine regedit レジストリ・エディタ

■Winetricksを使って必要なライブラリやフォントなどをインストールします。
$ sudo apt install winetricks
$ winetricks
Direct3D9をいれてみました。

■VirtualBox共有フォルダ
ubuntu系
sudo nano /etc/modules
cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
vboxsf
--------------

ゲストOSに$mkdir <マウントポイント名>
フォルダを作る。

$sudo mount.vboxsf <設定したホストOSでの共有ファイル名> /home/<ログインに使う名前>/<マウントポイント名>

例: ~$ sudo mount.vboxsf kyouyu /home/mac/litekyouyu/


■バージョン確認
$ cat .wine/system.reg | grep -m 1 '#arch' | cut -d '=' -f2
win64

■古いプログラムが起動する。ありがとうございます。
インストーラーも、起動してCドライブに入ります。Python1.5.2をインストールしました。
$ wine py152.exe
Python1.5.2 for windows のインストール。

$ wine cmd
コマンドプロンプト

$ wine explorer
Windows のコマンドプロンプトからエクスプローラを開く
Windows のファイルマネージャーはエクスプローラ (explorer.exe)
コピー、貼り付けがゆっくりですが、できました。



■Wine上の環境変数の設定
Wine上の環境変数の扱いについて(後半)」を参考にしました。
$ wine regedit
を使います。
ユーザごとの環境変数はHKEY_CURRENT_USER/Environment、(仮想Windows環境における)システム環境変数はHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment以下に「[環境変数名]=[値]」形式の文字列としてレジストリ項目が存在する場合にこれを読み込む形となっている。
screen_2020-05-12_13-58-42.jpg

保存し、再起動して、確認、PATHが追加されました。
c:\Lightflow\PM\Examples>path
PATH=C:\windows\system32;C:\windows;C:\windows\system32\wbem;C:\Program Files (x86)\Python

これで、64bit環境で、windows 32bitプログラム、Lightflow Rendering Toolが動きました。
Lightflowのインストールはこちら。

>python mechanic.py

Lightflow Rendering Tools
Copyright (c) 1995-2000 by Jacopo Pantaleoni. All rights reserved


Pinhole Camera On
Objects : 3
00:00:00 - CSEADS 100/100 - boxes 26 - depth 1 - objects 18
00:00:00 - CSEADS 100/100 - boxes 26 - depth 1 - objects 6
LfSoftLight::Init()
00:00:02 - cell 418176 / 418176
LfSoftLight::Init()
00:00:02 - cell 418176 / 418176

Rendering 400 x 400 pixels
00:00:45 - 93.0%

LfDOFImager():
row 400 / 400

mechanic.py 45秒でした。

metalight2も動いてます。仮想画面を1024*768にしました。
sc05-12.png
レンダリング、radiocity
kumafur.jpg
ありがとうございます。
  • -
  • -

Lightflow Rendering Tool C API for Linux 2018/10

2018/10/22記述
2020/5/12更新

LightflowのC APIについて、動いたLinux distributionを調べました。

Fedora28(64bit)をインストールしたノートパソコン(2012年 W255HPW)にVirtualBox5.2.20をインストール。

32bitのLinuxをいくつかインストールしました。
Lightflow C APIが動いたのは、
VineLinux2.6(include python1.5, gcc2.95)
VineLinux3.2
VineLinux4.0
VineLinux4.2
VineLinux5.2
CentOS5.11
ここまで、画面が800*600で狭いのが難点。

Fedora32(64bit)にGnome Boxesを入れ、
Fedora-8-i386をインストール。
python1.5,gcc2.95,Lightflow動きました。
Lightflow C APIも動きました。
Linuxは、gccが4.1.2のディトりビューションが良いみたいです。
2020/5/12追記

動かなかったのは、
Scientific Linux6 i386
Fedora28 32bit

//** インストール方法
http://www.python.org/download/releases/1.5/
Python 1.5.2 sources (2.5 MB)をダウンロード
■python1.5.2をインストール。
$ ./configure
$ make
# make altinstall

■さらに次のファイルをダウンロードします。
compat-libstdc++-6.2-2.9.0.14.i386.rpm
http://rpm.pbone.net/index.php3/stat/4/idpl/14760/com/compat-libstdc++-6.2-2.9.0.14.i386.rpm.html

■gcc-2.95.3をインストール。
インストール先のディレクトリを作成しておく。
# mkdir /usr/local/gcc-2.95
$ ./configure --prefix=/usr/local/gcc-2.95 --enable-languages=c,c++
$ make
# make install
確認
$ /usr/local/gcc-2.95/bin/g++ --version
2.95.3

■Lightflowのダウンロード
Lightflowのサイトから
http://www.lightflowtech.com/

Linux RedHat 6.1 Version (1608 Kb)
lf_redhat.tgzをダウンロードします。
/home/ユーザ/Lightflow
で解凍します。

.bash_profileまたは.bashrcに記入
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/Lightflow
PYTHONPATH=$PYTHONPATH:$HOME/Lightflow
LIGHTFLOWPATH=$HOME/Lightflow
LIGHTFLOW_SE_MEMORY=32000
LIGHTFLOW_VE_MEMORY=32000

export LD_LIBRARY_PATH PYTHONPATH LIGHTFLOWPATH LIGHTFLOW_SE_MEMORY LIGHTFLOW_VE_MEMORY

以下を実行するとpython1.5でレンダリングできました。
Examples]$ python1.5 ball1.py


■C APIの設定。
http://www.knoerig.de/lightflow_en.html
「Rudi's Homepage - Lightflow」を参考にincludeファイルをダウンロードします。

$ mkdir simplescene
includeファイルを置きます。

C++-libraryをシンボリックリンクします。
# ln -s /home/ユーザ/Lightflow/libLightflow.so /usr/lib

以下Makefile


CC = /usr/local/gcc-2.95/bin/g++
INCLUDE=-I ./include
LNK = -lLightflow
CNV = convert

all: ball.jpg

ball.jpg: ball.tga
$(CNV) ball.tga ball.jpg

ball.tga: simplescene
simplescene

simplescene: main.cpp
$(CC) $(INCLUDE) $(LNK) main.cpp -o simplescene





main.cpp


#include < Lightflow/LfLocalSceneProxy.h >
#include

int main()
{
// create a new proxy
LfLocalSceneProxy *s = new LfLocalSceneProxy();
// this is a container object for storing the arguments passed to
// the renderer via the proxy
LfArgList list;

// define a light
list.Reset();
list << "position" << LfVector3(-4,-7,6);
list << "color" << LfVector3(450*1.0,450*1.0,450*0.8);
LfInt light = s->NewLight("soft",list);
s->LightOn(light);

// define a material (standard material, there are others)
list.Reset();
// ambient color
list << "ka" << LfColor(0,0,0.5);
// reflection color
list << "kc" << LfColor(1,0.5,0.5);
// diffuse reflection factor
list << "kd" << 0.5;
// specular reflection smoothness (0-polished,1-plastic)
list << "km" << 0.1;
// surface displacement
// LfInt is a long int representing a handle
LfInt plastic = s->NewMaterial("standard",list);

// define a sphere object
s->MaterialBegin(plastic);
list.Reset();
list << "radius" << 1.0;
LfInt ball = s->NewObject("sphere",list);
s->AddObject(ball);
s->MaterialEnd();

// specify the output object
list.Reset();
list << "file" << "ball.tga";
LfInt saver = s->NewImager("tga-saver",list);

// specify the rendering context
s->ImagerBegin(saver);
list.Reset();
// camera position
list << "eye" << LfPoint(0,-4,0);
// point to aim at
list << "aim" << LfPoint(0,0,0);
LfInt camera = s->NewCamera("pinhole",list);
s->ImagerEnd();

// start rendering
s->Render(camera,300,300);

delete s;
return 0;
}

一時的にPATHを通しても良いです。
$ export PATH=/usr/local/gcc-2.95/bin:$PATH

makeします。
$ make simplescene
$ ./simplescene
Lightflow Rendering Tools
Copyright (c) 1995-2000 by Jacopo Pantaleoni. All rights reserved

Pinhole Camera On
Objects : 1
LfSoftLight::Init()
00:00:00 - cell 418176 / 418176

Rendering 300 x 300 pixels
00:00:00 - 87.1%

$ convert ball.tga ball.jpg
$ eog ball.jpg
ball.jpg

Lightflowを設定していくことで、Linuxの勉強になりました。
ありがとうございます。
  • -
  • -

1/1