<< 4/56 >>

Lightflow C API sample cloud

main5.cpp
#includeの両側に半角スペースが入っています。


#include < Lightflow/LfLocalSceneProxy.h >

void main()
{
LfLocalSceneProxy* s = new LfLocalSceneProxy();
LfArgList list;

list.Reset();
list << "direction" << LfVector3( 8.0, 5.0, -6.0 );
list << "color" << LfColor( 1.0, 1.0, 1.0 );
s->LightOn( s->NewLight( "directional", list ) );


list.Reset();
list << "value"
<< 0.3 << 1.0 << 1.0
<< 0.5 << 0.0 << 0.0;
list << "scale" << 1.0;
list << "turbulence.omega" << 0.55;
list << "turbulence.lambda" << 1.8;
list << "turbulence.octaves" << LfInt( 6 );
LfInt cloudpattern1 = s->NewPattern( "granite", list );

// Make a granite-like volumetric pattern.
// Note the keyword "value", followed by two rows of three parameters
// each.
// This is an example of value-gradient. A gradient is a function which
// interpolates many values, which may be numbers, colors, or entire
// patterns and materials.
// By convention numeric gradients are called value-gradients, color ones
// are named color-gradients and so on.
// As a function a gradient associates a value to a real variable.
// You can imagine it in cartesian coordinates, putting the variable on
// the abscissas and the associated value on the ordinates.
// Here the first expected argument is the abscissa at which the value
// of the function is specified, then the value follows. The value is
// specified both at the right and at the left of the abscissa in order
// to model discontinuities, so it is composed by two numbers.
// You can specify how many abscissas (and values) you want.
// This gradient is used to model the output of our fractal pattern,
// that we will use to describe the spatial density of the cloud.
// Here the gradient smoothly blends from the value of 1 at the point 0.3,
// to the value of 0 at the point 0.5.
// Normally the output would be a value between 0 and 1, but we
// make it droppoff rapidly from 1 to 0 to model masses of clouds that
// are denser at their center and that disappear at their boundaries.

list.Reset();
list << "value"
<< 0.8 << 1.0 << 1.0
<< 1.0 << 0.0 << 0.0;
list << "scale" << 1.2;
LfInt cloudpattern2 = s->NewPattern( "radial", list );

// Make a radial pattern, that is to say a spherical figure that is
// dense at its center and that has zero density at its border.
// This sphere has a radius of 1.2.

list.Reset();
list << "patterns" << cloudpattern1 << cloudpattern2;
LfInt cloudpattern = s->NewPattern( "compose", list );

// Compose the two patterns. Here the output of cloudpattern1 is used
// as the input of cloudpattern2. Since the radial pattern uses its
// input to scale its output, the result will be a sphere containing a
// granitic texture which diminishes its intensity near the border.

list.Reset();
list << "kr" << LfColor( 0.7, 0.85, 1.0 );
list << "kaf" << LfColor( 0.2, 0.35, 0.5 );
list << "density" << 1.0;
list << "density" << cloudpattern;
list << "sampling" << 20.0;
list << "shadow-caching" << LfPoint( -1.2, -1.2, -1.2 ) << LfPoint( 1.2, 1.2, 1.2 );
list << "density-caching" << LfInt( 2048 ) << LfPoint( -1.2, -1.2, -1.2 ) << LfPoint( 1.2, 1.2, 1.2 );
LfInt cloudinterior = s->NewInterior( "cloud", list );

// Here you should note how we described density.
// It has been specified with a single value of 1 and then with the
// pattern we modeled before. The value of 1 will be used as a input to
// cloudpattern1, which will scale its output by this factor. In
// this case there will be no scaling, and the output will go from 1 to
// 0, as we stated above.
// The "shadow-caching" and "density-caching" attributes specify the use of
// two different caching mechanisms that will be used to speed-up
// computations. They both require a bounding box where to work, and
// the density cache also requires the maximum allowed memory
// occupancy, which is expressed in Kb (here 2048, i.e. 2 Mb).
// The "sampling" value specifies how many samples will be taken into a
// segment long one.

s->InteriorBegin( cloudinterior );

list.Reset();
LfInt cloud = s->NewMaterial( "transparent", list );

s->InteriorEnd();


s->MaterialBegin( cloud );

list.Reset();
list << "radius" << 1.2;
s->AddObject( s->NewObject( "sphere", list ) );

s->MaterialEnd();


list.Reset();
list << "file" << "cloud.tga";
LfInt saver = s->NewImager( "tga-saver", list );

s->ImagerBegin( saver );

list.Reset();
list << "eye" << LfPoint( 0, -4, 0 );
list << "aim" << LfPoint( 0, 0, 0 );
LfInt camera = s->NewCamera( "pinhole", list );

s->ImagerEnd();

s->Render( camera, 300, 300 );

delete s;
}

$ /usr/local/gcc-2.95/bin/g++ -I ./include -lLightflow main5.cpp -o simplescene5
$ ./simplescene5
$ convert cloud.tga cloud.jpg
$ eog cloud.jpg
cloud.jpg
  • -
  • -

Lightflow C API sample lights

main4.cpp
#includeの両側に半角スペースが入っています。

#include < Lightflow/LfLocalSceneProxy.h >

int main()
{
LfLocalSceneProxy* s = new LfLocalSceneProxy();
LfArgList list;
LfTransform trs;

list.Reset();
list << "position" << LfPoint( 4.0, -6.0, -5.0 );
list << "color" << LfColor( 200.0, 200.0, 200.0 );
s->LightOn( s->NewLight( "point", list ) );

list.Reset();
list << "position" << LfPoint( -7.5, -6.0, 2.0 );
list << "color" << LfColor( 300.0, 150.0, 150.0 );
LfInt light1 = s->NewLight( "point", list );

list.Reset();
list << "position" << LfPoint( -2.0, 0.0, 8.0 );
list << "color" << LfColor( 150.0, 300.0, 150.0 );
LfInt light2 = s->NewLight( "point", list );

list.Reset();
list << "position" << LfPoint( 8.0, -6.0, 5.0 );
list << "color" << LfColor( 150.0, 150.0, 300.0 );
LfInt light3 = s->NewLight( "point", list );


s->LightBegin();
s->LightOn( light1 );

list.Reset();
list << "ka" << LfColor( 0.1, 0.1, 0.1 );
list << "kc" << LfColor( 1, 1, 1 );
list << "kd" << 0.5;
list << "km" << 0.1;
LfInt plastic1 = s->NewMaterial( "standard", list );

s->LightEnd();

s->LightBegin();
s->LightOn( light2 );

list.Reset();
list << "ka" << LfColor( 0.1, 0.1, 0.1 );
list << "kc" << LfColor( 1, 1, 1 );
list << "kd" << 0.5;
list << "km" << 0.1;
LfInt plastic2 = s->NewMaterial( "standard", list );

s->LightEnd();

s->LightBegin();
s->LightOn( light3 );

list.Reset();
list << "ka" << LfColor( 0.1, 0.1, 0.1 );
list << "kc" << LfColor( 1, 1, 1 );
list << "kd" << 0.5;
list << "km" << 0.1;
LfInt plastic3 = s->NewMaterial( "standard", list );

s->LightEnd();


s->TransformBegin( trs.Translation( LfVector3( -2.0, 0, 0 ) ) );

s->MaterialBegin( plastic1 );

list.Reset();
list << "radius" << 1.0;
s->AddObject( s->NewObject( "sphere", list ) );

s->MaterialEnd();

s->TransformEnd();


s->MaterialBegin( plastic2 );

list.Reset();
list << "radius" << 1.0;
s->AddObject( s->NewObject( "sphere", list ) );

s->MaterialEnd();


s->TransformBegin( trs.Translation( LfVector3( 2.0, 0, 0 ) ) );

s->MaterialBegin( plastic3 );

list.Reset();
list << "radius" << 1.0;
s->AddObject( s->NewObject( "sphere", list ) );

s->MaterialEnd();

s->TransformEnd();


list.Reset();
list << "file" << "lights.tga";
LfInt saver = s->NewImager( "tga-saver", list );

s->ImagerBegin( saver );

list.Reset();
list << "eye" << LfPoint( 0, -4, 0 );
list << "aim" << LfPoint( 0, 0, 0 );
list << "fov" << atan( 0.5 / 0.75 )*2.0;
LfInt camera = s->NewCamera( "pinhole", list );

s->ImagerEnd();

s->Render( camera, 300, 300 );

delete s;
}


$ /usr/local/gcc-2.95/bin/g++ -I ./include -lLightflow main4.cpp -o simplescene4
$ ./simplescene4
$ convert lights.tga lights.jpg
$ eog lights.jpg
lights.jpg
  • -
  • -

Lightflow C API sample ball3

main3.cpp
#includeの両側に半角スペースが入っています。

#include < Lightflow/LfLocalSceneProxy.h >

int main()
{
LfLocalSceneProxy* s = new LfLocalSceneProxy();
LfArgList list;

list.Reset();
list << "position" << LfPoint( 5.0, -5.0, 4.0 );
list << "color" << LfColor( 300.0, 300.0, 300.0 );
s->LightOn( s->NewLight( "point", list ) );


list.Reset();
list << "kr" << LfColor( 1.0, 0.9, 0.8 );
list << "kaf" << 0.3;
list << "density" << 0.3;
list << "sampling" << 40.0;
list << "shadow-caching" << LfPoint( -1.2, -1.2, -1.2 ) << LfPoint(
1.2, 1.2, 1.2 );
LfInt gas = s->NewInterior( "dust", list );

s->InteriorBegin( gas );

list.Reset();
LfInt cloud = s->NewMaterial( "transparent", list );

s->InteriorEnd();


s->MaterialBegin( cloud );

list.Reset();
list << "radius" << 1.2;
s->AddObject( s->NewObject( "sphere", list ) );

s->MaterialEnd();


list.Reset();
list << "ka" << LfColor( 0, 0, 0.5 );
list << "kc" << LfColor( 1, 0.5, 0.5 );
list << "kd" << 0.5;
list << "km" << 0.1;
LfInt plastic = s->NewMaterial( "standard", list );

s->MaterialBegin( plastic );

list.Reset();
list << "radius" << 0.5;
s->AddObject( s->NewObject( "sphere", list ) );

s->MaterialEnd();


list.Reset();
list << "file" << "ball3.tga";
LfInt saver = s->NewImager( "tga-saver", list );

s->ImagerBegin( saver );

list.Reset();
list << "eye" << LfPoint( 0, -4, 0 );
list << "aim" << LfPoint( 0, 0, 0 );
LfInt camera = s->NewCamera( "pinhole", list );

s->ImagerEnd();

s->Render( camera, 300, 300 );

delete s;
}


$ /usr/local/gcc-2.95/bin/g++ -I ./include -lLightflow main3.cpp -o simplescene3
$ ./simplescene3
$ convert ball3.tga ball3.jpg
$ eog ball3.jpg
ball3.jpg
  • -
  • -

Lightflow C API sample ball2

2018/10/22
sample ball2
main2.cpp
#includeの両側に半角スペースが入っています。

#include < Lightflow/LfLocalSceneProxy.h >

int main()
{
LfLocalSceneProxy* s = new LfLocalSceneProxy();
LfArgList list;

list.Reset();
list << "position" << LfPoint( 5.0, -5.0, 4.0 );
list << "color" << LfColor( 300.0, 300.0, 300.0 );
s->LightOn( s->NewLight( "point", list ) );

list.Reset();
list << "basis" << "sin";
list << "scale" << 0.6;
list << "depth" << 0.2;
list << "turbulence.omega" << 0.5 << 0.7;
list << "turbulence.octaves" << LfInt( 6 );
LfInt bump = s->NewPattern( "multifractal", list );

list.Reset();
list << "ka" << LfColor( 0, 0, 0.05 );
list << "kc" << LfColor( 1, 1, 1 );
list << "kd" << 0.5;
list << "km" << 0.1;
list << "displacement" << bump;
LfInt plastic = s->NewMaterial( "standard", list );


s->MaterialBegin( plastic );

list.Reset();
list << "radius" << 1.0;
LfInt sphere = s->NewObject( "sphere", list );

list.Reset();
list << "surfaces" << sphere;
list << "tolerance" << 0.02 << 0.1 << 0.05;
s->AddObject( s->NewObject( "surface-engine", list ) );

s->MaterialEnd();


list.Reset();
list << "file" << "ball2.tga";
LfInt saver = s->NewImager( "tga-saver", list );

s->ImagerBegin( saver );

list.Reset();
list << "eye" << LfPoint( 0, -4, 0 );
list << "aim" << LfPoint( 0, 0, 0 );
LfInt camera = s->NewCamera( "pinhole", list );

s->ImagerEnd();

s->Render( camera, 300, 300 );

delete s;
}

$ /usr/local/gcc-2.95/bin/g++ -I ./include -lLightflow main2.cpp -o simplescene2
$ ./simplescene2
$ convert ball2.tga ball2.jpg
$ eog ball2.jpg
ball2.jpg
main22.cpp
#includeの不等号両側に半角スペースが入っています。

#include < Lightflow/LfLocalSceneProxy.h >
int main()
{
LfLocalSceneProxy* s = new LfLocalSceneProxy();
LfArgList list;

list.Reset();
list << "position" << LfPoint( 5.0, -5.0, 4.0 );
list << "color" << LfColor( 300.0, 300.0, 300.0 );
s->LightOn( s->NewLight( "point", list ) );

list.Reset();
list << "basis" << "sin";
list << "scale" << 0.6;
list << "depth" << 0.2;
list << "turbulence.omega" << 0.5 << 0.7;
list << "turbulence.octaves" << LfInt( 6 );
LfInt bump = s->NewPattern( "multifractal", list );

list.Reset();
list << "kr" << LfVector3(0.3,0.3,0.5);
list << "kd" << 0.3;
list << "km" << 0.3;
list << "shinyness" << 0.8;
list << "fresnel" << LfInt(1) << LfFloat(0.5) << LfFloat(0.5);
list << "caustics" << LfInt(1) << LfInt(1);
list << "displacement" << bump;
LfInt bumpmetal = s->NewMaterial( "physical", list );

s->MaterialBegin( bumpmetal );

list.Reset();
list << "radius" << 1.0;
LfInt sphere = s->NewObject( "sphere", list );

list.Reset();
list << "surfaces" << sphere;
list << "tolerance" << 0.02 << 0.1 << 0.05;
s->AddObject( s->NewObject( "surface-engine", list ) );

s->MaterialEnd();

list.Reset();
list << "file" << "ball2.tga";
LfInt saver = s->NewImager( "tga-saver", list );

s->ImagerBegin( saver );

list.Reset();
list << "eye" << LfPoint( 0, -4, 0 );
list << "aim" << LfPoint( 0, 0, 0 );
LfInt camera = s->NewCamera( "pinhole", list );

s->ImagerEnd();

s->Render( camera, 300, 300 );
delete s;
}

$ /usr/local/gcc-2.95/bin/g++ -I ./include -lLightflow main22.cpp -o simplescene22
$ ./simplescene22
$ convert ball2.tga ball2.jpg
$ eog ball2.jpg
ball2.jpg
  • -
  • -

Lightflow C++-Tutorial for beginners

C++でのやり方。参考になりました。
ありがとうございます。
http://www.knoerig.de/lightflow_en.html
Rudi's Homepage - Lightflow
  • -
  • -

cgkit2.0.0 works under Fedora28

Fedora28でcgkit2.0.0+python2.7でビルドできました。boost-develをインストール。他checkenv.py で確認する。 py_slot.h,43行目snameに空白スペースを入れる"_" sname " py_geoms1.cpp,145行166行boost::python::make_tupleにしてbuildできました。ありがとうございます。


[@localhost ~]$ pip install cgkit==2.0.0
Collecting cgkit==2.0.0
Could not find a version that satisfies the requirement cgkit==2.0.0 (from versions: )
No matching distribution found for cgkit==2.0.0

Python Computer Graphics Kit v2.0.0
https://sourceforge.net/projects/cgkit/files/cgkit/cgkit-2.0.0/cgkit-2.0.0-py2k.tar.gz/download

[@localhost ~]$ sudo pip install pygame
Collecting pygame
Installing collected packages: pygame
Successfully installed pygame-1.9.4

[@localhost ~]$ sudo pip install ode
Collecting ode
Successfully installed ode-0.2.0

[mac@localhost ~]$ sudo pip install pyserial
Collecting pyserial
Installing collected packages: pyserial
Successfully installed pyserial-3.4

http://www.pythonware.com/products/pil/
[@localhost Imaging-1.1.7]$ sudo python setup.py install
Writing /usr/lib64/python2.7/site-packages/PIL/PIL-1.1.7-py2.7.egg-info
creating /usr/lib64/python2.7/site-packages/PIL.pth

[@localhost utilities]$ python checkenv.py
----------------------------------------------------------------------
Python 2.7.15 (default, Sep 21 2018, 23:26:48)
[GCC 8.1.1 20180712 (Red Hat 8.1.1-5)]
Platform: linux2
----------------------------------------------------------------------
Python version: 2.7........... OK
PyProtocols................... is installed
PyOpenGL...................... is installed
PIL........................... is installed
pygame........................ pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
is installed
PyODE......................... is installed
PySerial...................... is installed
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

$ cd supportlib
$ # ...create & modify cpp_config.cpp if necessary...
$ scons
$ cd .. # if you were still in the supportlib directory
$ sudo python setup.py install

以下、error:
In file included from wrappers/py_arrayslots1.cpp:5:0:
wrappers/py_arrayslots1.cpp: In function ‘void class_ArraySlots()’:
wrappers/py_slot.h:43:75: error: unable to find string literal operator ‘operator""sname’ with ‘const char [11]’, ‘long unsigned int’ arguments
e ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
^
wrappers/py_slot.h:43:75: note: in definition of macro ‘ARRAYSLOT’
e ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
^~~~~~~~~~~
wrappers/py_slot.h:43:75: error: unable to find string literal operator ‘operator""sname’ with ‘const char [11]’, ‘long unsigned int’ arguments
e ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
^
wrappers/py_slot.h:43:75: note: in definition of macro ‘ARRAYSLOT’
e ARRAYSLOT(sname,stype) class_<_ArraySlotIterator >("_"sname"_Iterator", init&>()) \
^~~~~~~~~~~
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

[solved]
py_slot.h,43行目snameの両側に空白スペースを入れる "_" sname "
[solved]
py_geoms1.cpp,line:145行 and line:166行 boost::python::make_tuple にしてbuildできました。
Thank you(^.^)

$viewer.py demo3.py
out.jpg
  • -
  • -

64bit Windows10 install

とりいそぎ、メモ:
ありがとうございます。

Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

C:\Users\Downloads>python
Python 2.7.12 (v2.7.12:d33e0cf91556, Jun 27 2016, 15:24:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> ^Z


C:\Users\Downloads>pip install Pillow-3.4.2-cp27-cp27m-win_amd64.whl
Processing c:\users\sensei\downloads\pillow-3.4.2-cp27-cp27m-win_amd64.whl
Installing collected packages: Pillow
Successfully installed Pillow-3.4.2
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:\Users\Downloads>python -m pip install --upgrade pip
Collecting pip
Using cached pip-9.0.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 8.1.1
Uninstalling pip-8.1.1:
Successfully uninstalled pip-8.1.1
Successfully installed pip-9.0.1

C:\Users\Downloads>pip freeze
Pillow==3.4.2

C:\Users\Downloads>pip install pygame-1.9.2b1-cp27-cp27m-win_amd64.whl
Processing c:\users\sensei\downloads\pygame-1.9.2b1-cp27-cp27m-win_amd64.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.2b1

C:\Users\sensei\Downloads>pip freeze
Pillow==3.4.2
pygame==1.9.2b1

C:\Users\Downloads>pip install PyOpenGL-3.1.1-cp27-cp27m-win_amd64.whl
Processing c:\users\sensei\downloads\pyopengl-3.1.1-cp27-cp27m-win_amd64.whl
Installing collected packages: PyOpenGL
Successfully installed PyOpenGL-3.1.1

C:\Users\Downloads>pip install ode-0.13.1-cp27-cp27m-win_amd64.whl
Processing c:\users\sensei\downloads\ode-0.13.1-cp27-cp27m-win_amd64.whl
Installing collected packages: ode
Successfully installed ode-0.13.1

C:\Users\Downloads>pip install cgkit-2.0.0-cp27-none-win_amd64.whl
Processing c:\users\sensei\downloads\cgkit-2.0.0-cp27-none-win_amd64.whl
Installing collected packages: cgkit
Successfully installed cgkit-2.0.0

C:\Users\Downloads>python -m pip install --upgrade pip


Microsoft Windows [Version 10.0.10240]
(c) 2015 Microsoft Corporation. All rights reserved.

>viewer.py demo1.py

>viewer.py demo3.py

>render.py -rprman demo1.py
Exporting main.rib...
1 passes...
Compiling shaders...
gldistantlight: compiled.
glmaterial: compiled.
glpointlight: compiled.
glspotlight: compiled.
spotlight3ds: compiled.
Preprocessing time: 0s
Rendering "out.tif" (frame 0)...
Rendering time: 0s

>sho out.tif
  • -
  • -

Python27とcgkit install (Windows7 32bit)

Python2.7.10をインストールするとpipもインストールされました。とても便利になりました。
pythonのモジュールはwhlが多くなってきました。

>pip install hoge****.whl

のような感じで簡単にインストールできます。

■Python2.7.10をインストールした後、
Windowsの環境変数Pathに以下を追記します。
気をつけて行います。既存のパスの最後に付けます

;C:\Python27;C:\Python27\Scripts

■ここで再起動します。

■次に、以下からダウンロードします。

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Pillow-2.8.2-cp27-none-win32.whl
pygame-1.9.2a0-cp27-none-win32.whl
ode-0.13.1-cp27-none-win32.whl
PyOpenGL-3.1.1a1-cp27-none-win32.whl
cgkit-2.0.0-cp27-none-win32.whl

をダウンロードします。
またVpythonを使いたいならば
VPython-5.74-cp27-none-win32.whl

Microsoftから
VCForPython27.msiをダウンロードして
インストールします。

以下は、試したログです。
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

D:\Aplication>pip install Pillow-2.8.2-cp27-none-win32.whl
Processing d:\aplication\pillow-2.8.2-cp27-none-win32.whl
Installing collected packages: Pillow
Successfully installed Pillow-2.8.2

D:\Aplication>pip freeze
Pillow==2.8.2
pyglet==1.2.2
pyprocessing==0.1.3.22

D:\Aplication>pip install pygame-1.9.2a0-cp27-none-win32.whl
Processing d:\aplication\pygame-1.9.2a0-cp27-none-win32.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.2a0

D:\Aplication>pip install ode-0.13.1-cp27-none-win32.whl
Processing d:\aplication\ode-0.13.1-cp27-none-win32.whl
Installing collected packages: ode
Successfully installed ode-0.13.1

D:\Aplication>pip install cgkit-2.0.0-cp27-none-win32.whl
Processing d:\aplication\cgkit-2.0.0-cp27-none-win32.whl
Installing collected packages: cgkit
Successfully installed cgkit-2.0.0

D:\Aplication>pip install PyOpenGL-3.1.1a1-cp27-none-win32.whl
Processing d:\aplication\pyopengl-3.1.1a1-cp27-none-win32.whl
Installing collected packages: PyOpenGL
Successfully installed PyOpenGL-3.1.1a1
■ここは時間かかります。しばらく待ちます。


■ここからVpythonのインストールです。
最初、エラーでインストールできませんでした。

D:\Aplication>pip install VPython-5.74-cp27-none-win32.whl
Processing d:\aplication\vpython-5.74-cp27-none-win32.whl
Collecting fonttools (from VPython==5.74)
Downloading FontTools-2.4.tar.gz (323kB)
100% |################################| 327kB 369kB/s
Collecting TTFQuery (from VPython==5.74)
Downloading TTFQuery-1.0.5.tar.gz
Collecting Polygon2 (from VPython==5.74)
Downloading Polygon2-2.0.7.zip (73kB)
100% |################################| 77kB 561kB/s
Collecting numpy (from fonttools->VPython==5.74)
Downloading numpy-1.9.2.tar.gz (4.0MB)
100% |################################| 4.0MB 79kB/s
Installing collected packages: numpy, fonttools, TTFQuery, Polygon2, VPython
Running setup.py install for numpy
Complete output from command C:\Python27\python.exe -c "import setuptools, t
okenize;__file__='c:\\windows\\temp\\pip-build-2wkd41\\numpy\\setup.py';exec(com
pile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __f
ile__, 'exec'))" install --record c:\windows\temp\pip-hob8vx-record\install-reco
rd.txt --single-version-externally-managed --compile:
non-existing path in 'numpy\\distutils': 'site.cfg'
non-existing path in 'numpy\\f2py': 'docs'
non-existing path in 'numpy\\f2py': 'f2py.1'
F2PY Version 2
blas_opt_info:
blas_mkl_info:
libraries mkl,vml,guide not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Py
thon27\\libs']
NOT AVAILABLE

openblas_info:
libraries openblas not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Python2
7\\libs']
NOT AVAILABLE

atlas_3_10_blas_threads_info:
Setting PTATLAS=ATLAS
libraries tatlas not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Python27\
\libs']
NOT AVAILABLE

atlas_3_10_blas_info:
libraries satlas not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Python27\
\libs']
NOT AVAILABLE

atlas_blas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in ['C:\\Python27\\lib', 'C:\\
', 'C:\\Python27\\libs']
NOT AVAILABLE

atlas_blas_info:
libraries f77blas,cblas,atlas not found in ['C:\\Python27\\lib', 'C:\\', '
C:\\Python27\\libs']
NOT AVAILABLE

blas_info:
libraries blas not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Python27\\l
ibs']
NOT AVAILABLE

blas_src_info:
NOT AVAILABLE

NOT AVAILABLE

non-existing path in 'numpy\\lib': 'benchmarks'
lapack_opt_info:
openblas_lapack_info:
libraries openblas not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Python2
7\\libs']
NOT AVAILABLE

lapack_mkl_info:
mkl_info:
libraries mkl,vml,guide not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Py
thon27\\libs']
NOT AVAILABLE

NOT AVAILABLE

atlas_3_10_threads_info:
Setting PTATLAS=ATLAS
libraries tatlas,tatlas not found in C:\Python27\lib
libraries lapack_atlas not found in C:\Python27\lib
libraries tatlas,tatlas not found in C:\
libraries lapack_atlas not found in C:\
libraries tatlas,tatlas not found in C:\Python27\libs
libraries lapack_atlas not found in C:\Python27\libs
numpy.distutils.system_info.atlas_3_10_threads_info
NOT AVAILABLE

atlas_3_10_info:
libraries satlas,satlas not found in C:\Python27\lib
libraries lapack_atlas not found in C:\Python27\lib
libraries satlas,satlas not found in C:\
libraries lapack_atlas not found in C:\
libraries satlas,satlas not found in C:\Python27\libs
libraries lapack_atlas not found in C:\Python27\libs
numpy.distutils.system_info.atlas_3_10_info
NOT AVAILABLE

atlas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in C:\Python27\lib
libraries lapack_atlas not found in C:\Python27\lib
libraries ptf77blas,ptcblas,atlas not found in C:\
libraries lapack_atlas not found in C:\
libraries ptf77blas,ptcblas,atlas not found in C:\Python27\libs
libraries lapack_atlas not found in C:\Python27\libs
numpy.distutils.system_info.atlas_threads_info
NOT AVAILABLE

atlas_info:
libraries f77blas,cblas,atlas not found in C:\Python27\lib
libraries lapack_atlas not found in C:\Python27\lib
libraries f77blas,cblas,atlas not found in C:\
libraries lapack_atlas not found in C:\
libraries f77blas,cblas,atlas not found in C:\Python27\libs
libraries lapack_atlas not found in C:\Python27\libs
numpy.distutils.system_info.atlas_info
NOT AVAILABLE

lapack_info:
libraries lapack not found in ['C:\\Python27\\lib', 'C:\\', 'C:\\Python27\
\libs']
NOT AVAILABLE

lapack_src_info:
NOT AVAILABLE

NOT AVAILABLE

running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler
options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler
options
running build_src
build_src
building py_modules sources
creating build
creating build\src.win32-2.7
creating build\src.win32-2.7\numpy
creating build\src.win32-2.7\numpy\distutils
building library "npymath" sources
No module named msvccompiler in numpy.distutils; trying from distutils
Running from numpy source directory.
c:\windows\temp\pip-build-2wkd41\numpy\numpy\distutils\system_info.py:1603:
UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
warnings.warn(AtlasNotFoundError.__doc__)
c:\windows\temp\pip-build-2wkd41\numpy\numpy\distutils\system_info.py:1612:
UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
warnings.warn(BlasNotFoundError.__doc__)
c:\windows\temp\pip-build-2wkd41\numpy\numpy\distutils\system_info.py:1615:
UserWarning:
Blas (http://www.netlib.org/blas/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [blas_src]) or by setting
the BLAS_SRC environment variable.
warnings.warn(BlasSrcNotFoundError.__doc__)
c:\windows\temp\pip-build-2wkd41\numpy\numpy\distutils\system_info.py:1505:
UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
warnings.warn(AtlasNotFoundError.__doc__)
c:\windows\temp\pip-build-2wkd41\numpy\numpy\distutils\system_info.py:1516:
UserWarning:
Lapack (http://www.netlib.org/lapack/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [lapack]) or by setting
the LAPACK environment variable.
warnings.warn(LapackNotFoundError.__doc__)
c:\windows\temp\pip-build-2wkd41\numpy\numpy\distutils\system_info.py:1519:
UserWarning:
Lapack (http://www.netlib.org/lapack/) sources not found.
Directories to search for the sources can be specified in the
numpy/distutils/site.cfg file (section [lapack_src]) or by setting
the LAPACK_SRC environment variable.
warnings.warn(LapackSrcNotFoundError.__doc__)
C:\Python27\lib\distutils\dist.py:267: UserWarning: Unknown distribution opt
ion: 'define_macros'
warnings.warn(msg)
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat).
Get it from http://aka.ms/vcpython27

----------------------------------------
Command "C:\Python27\python.exe -c "import setuptools, tokenize;__file__='c:\\wi
ndows\\temp\\pip-build-2wkd41\\numpy\\setup.py';exec(compile(getattr(tokenize, '
open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install
--record c:\windows\temp\pip-hob8vx-record\install-record.txt --single-version-
externally-managed --compile" failed with error code 1 in c:\windows\temp\pip-bu
ild-2wkd41\numpy

■エラーが出ました!!!
MicrosoftがPython 2.7用のコンパクトなVC++ 9.0コンパイラMicrosoft Visual C++ Compiler for Python 2.7を配布しています。
Microsoftから
VCForPython27.msiをダウンロードして
インストールします。
■ここを参考にしました。ありがとうございます。
http://www.regentechlog.com/2014/04/13/build-python-package-on-windows/




仕切りなおします。再度チャレンジ!
D:\Aplication>pip install VPython-5.74-cp27-none-win32.whl
Processing d:\aplication\vpython-5.74-cp27-none-win32.whl
Collecting fonttools (from VPython==5.74)
Using cached FontTools-2.4.tar.gz
Collecting TTFQuery (from VPython==5.74)
Using cached TTFQuery-1.0.5.tar.gz
Collecting Polygon2 (from VPython==5.74)
Using cached Polygon2-2.0.7.zip
Collecting numpy (from fonttools->VPython==5.74)
Using cached numpy-1.9.2.tar.gz
Installing collected packages: numpy, fonttools, TTFQuery, Polygon2, VPython
Running setup.py install for numpy
Running setup.py install for fonttools
Running setup.py install for TTFQuery
Running setup.py install for Polygon2
Successfully installed Polygon2-2.0.7 TTFQuery-1.0.5 VPython-5.74 fonttools nump
y-1.9.2

■内容を確認します
D:\Aplication>pip freeze
cgkit==2.0.0
FontTools==2.4
numpy==1.9.2
ode==0.13.1
Pillow==2.8.2
Polygon2==2.0.7
pygame==1.9.2a0
pyglet==1.2.2
PyOpenGL==3.1.1a1
pyprocessing==0.1.3.22
TTFQuery==1.0.5
VPython==5.74

●ありがとうございます。
  • -
  • -

python cgkit install under Windows7

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.

W:\python_cg_programing\pythoncgkitinstall>pip install Pillow-2.8.2-cp27-none-wi
n32.whl
Processing w:\python_cg_programing\pythoncgkitinstall\pillow-2.8.2-cp27-none-win
32.whl
Installing collected packages: Pillow
Successfully installed Pillow-2.8.2

W:\python_cg_programing\pythoncgkitinstall>pip freeze
Pillow==2.8.2
pyglet==1.2.2
pyprocessing==0.1.3.22

W:\python_cg_programing\pythoncgkitinstall>pip install pygame-1.9.2a0-cp27-none-
win32.whl
Processing w:\python_cg_programing\pythoncgkitinstall\pygame-1.9.2a0-cp27-none-w
in32.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.2a0

W:\python_cg_programing\pythoncgkitinstall>pip install ode-0.13.1-cp27-none-win3
2.whl
Processing w:\python_cg_programing\pythoncgkitinstall\ode-0.13.1-cp27-none-win32
.whl
Installing collected packages: ode
Successfully installed ode-0.13.1

W:\python_cg_programing\pythoncgkitinstall>pip install cgkit-2.0.0-cp27-none-win
32.whl
Processing w:\python_cg_programing\pythoncgkitinstall\cgkit-2.0.0-cp27-none-win3
2.whl
Installing collected packages: cgkit
Successfully installed cgkit-2.0.0

W:\python_cg_programing\pythoncgkitinstall>pip install PyOpenGL-3.1.1a1-cp27-non
e-win32.whl
Processing w:\python_cg_programing\pythoncgkitinstall\pyopengl-3.1.1a1-cp27-none
-win32.whl
Installing collected packages: PyOpenGL
Successfully installed PyOpenGL-3.1.1a1

W:\python_cg_programing\pythoncgkitinstall>pip freeze
cgkit==2.0.0
ode==0.13.1
Pillow==2.8.2
pygame==1.9.2a0
pyglet==1.2.2
PyOpenGL==3.1.1a1
pyprocessing==0.1.3.22

W:\python_cg_programing\pythoncgkitinstall>
  • -
  • -

Metasequoia PythonでPxrDisneyマテリアル設定

Metasequoia Pythonを使って、RenderMan RIS用のマテリアルPxrDisneyを設定してみました。ありがとうございます。
boxesrnd.jpg


import random

def p(*args):
"""
プリント関数
複数の引数を渡せる。
"""
if len(args)==0:
# 改行させる
MQSystem.println("")
return

for arg in args:
MQSystem.println(str(arg))


# 基本図形、新規オブジェクトで立方体複数つくる
#meta_cube_def_rndc.py
doc = MQSystem.getDocument()
out = MQSystem.println


#
def unitcube(L=50,x=0,y=0,z=0):
obj = MQSystem.newObject() #新規オブジェクト
num=doc.numObject
a=num
obj.name="cube_%d" % a #オブジェクト名をつける

obj.addVertex(x-L/2.0,y-L/2.0,z+L/2.0) #0 頂点番号
obj.addVertex(x+L/2.0,y-L/2.0,z+L/2.0) #1
obj.addVertex(x+L/2.0,y+L/2.0,z+L/2.0) #2
obj.addVertex(x-L/2.0,y+L/2.0,z+L/2.0) #3
obj.addVertex(x-L/2.0,y-L/2.0,z-L/2.0) #4
obj.addVertex(x-L/2.0,y+L/2.0,z-L/2.0) #5
obj.addVertex(x+L/2.0,y+L/2.0,z-L/2.0) #6
obj.addVertex(x+L/2.0,y-L/2.0,z-L/2.0) #7

obj.addFace([0,3,2,1])
obj.addFace([1,2,6,7])
obj.addFace([4,7,6,5])
obj.addFace([0,4,5,3])
obj.addFace([3,5,6,2])
obj.addFace([0,1,7,4])
doc.addObject( obj )

mat1=MQSystem.newMaterial()
doc.addMaterial(mat1) #マテリアルをドキュメントに追加
num0 = doc.numMaterial #現在の材質数を数える
numm=num0-1 #マテリアル番号は一つ少ない
doc.material[numm].shader=5
doc.material[numm].shaderFilename="PxrDisney"
doc.material[numm].color=MQSystem.newColor(random.random(),random.random(),random.random())
doc.material[numm].specular=0.5
doc.material[numm].reflection=0.75

for face in obj.face:
face.material=numm #マテリアルnumm番を面に割り当てる


import traceback
import sys
#dist=0
try:
for dist in range(0,600,200):
for dist2 in range(0,600,200):
#out(str(i))
out(str(dist))
unitcube(100,50+dist,50,dist2)



except:
info=sys.exc_info()
p(info[0])
p(info[1])
p(*traceback.extract_tb(info[2]))

num = doc.numObject #オブジェクトの数
out("オブジェクトの数 %d" % num) #オブジェクトの数を表示


  • -
  • -

<< 4/56 >>