Archive for April 2008

cgkit over goldenweek

Had a bunch of troubles writing my dso for a pre prod.
I am using python as a ribgen recently.
Finally got 4 proposals ready for tomorrows meeting.
- It took me a week before THE epiphany.
The gentoo ebuild for cgkit sucks, leaves out the utils.
I have lots more mods but its Japanese holidays here and I haven't had an ounce of sleep in days so here is the minimum.
If you are using gentoo and cgkit I have a better ebuild:
cgkit-2.0.0_alpha8.ebuild
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-python/cgkit/cgkit-2.0.0_alpha8.ebuild,v 1.12 2008/04/30 04:18:14 bernard edlington $

inherit distutils flag-o-matic

MY_P=${P/_/}
DESCRIPTION="Python library for creating 3D images"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
HOMEPAGE="http://cgkit.sourceforge.net"
DEPEND="dev-lang/python
dev-python/pyrex
dev-util/scons
dev-libs/boost
dev-python/pyprotocols
dev-python/numarray
dev-python/pyopengl
dev-python/pygame
dev-python/imaging
3ds? ( media-libs/lib3ds )"
SLOT="0"
LICENSE="LGPL-2.1 MPL-1.1 GPL-2"
KEYWORDS="~ppc ~x86"
IUSE="3ds ogre utilities"

S=${WORKDIR}/${MY_P}
src_unpack() {
unpack ${A}
cd "${S}"

sed -i -e "s/fPIC/fPIC\",\"${CFLAGS// /\",\"}/" supportlib/SConstruct
cp config_template.cfg config.cfg
echo 'LIBS += ["GL", "GLU", "glut"]' >> config.cfg
if use 3ds; then
echo 'LIB3DS_AVAILABLE = True' >> config.cfg
fi

# Ogre viewer is no longer maintained by upstream
# bug 210731
if use ogre; then
echo 'OGRE_AVAILABLE = True' >> config.cfg
echo 'INC_DIRS += ["/usr/include/OGRE"]' >> config.cfg
echo 'MACROS += [("EXT_HASH", None),("GCC_3_1",None)]' >> config.cfg
sed -i -e "s/#include //" wrappers/ogre/OgreCore.h
fi

sed -i -e "s:INC_DIRS = \[\]:INC_DIRS = \['/usr/include'\]:" "${S}"/setup.py
}

src_compile() {
cd "${S}"/supportlib
scons ${MAKEOPTS}
cd "${S}"
distutils_src_compile
}

src_test() {
cd unittests
# Remove failing tests due to non-existing files
rm test_maimport.py test_mayaascii.py test_mayabinary.py test_ri.py \
test_slparams.py
PYTHONPATH=$(ls -d ../build/lib*) ${python} all.py ||�die "tests failed"
}

src_install() {
distutils_src_install
if use utilities; then
insinto /usr/share/${PN}/utilities
doins utilities/*
fi
}

DSO time

Just finished my meeting. Now I am going home finally. Going to be
researching todays topics tonight and over the weekend for some work I
am about to start.
The topics I need to cover are doing some calculations with a DSO over
subdivision surfaces on user selected points. I have done similar
things before, however this time the calculations we require are
inverse of the normal render pipeline. Sort of a chicken before the
egg problem with procedurals.

Promo

Been crazily working on a HD promo for the Asian market since the last 10 days straight. Looks bloody excellent if I do say so myself!

NAB

I was supposed to arrive in Las Vegas yesterday attending NAB, however I have been busy creating promotion for a car company -cant say any more. Last night I was re-writing shaders from FinalRender to Prman. Oh well, NAB maybe next year. The last time I attended was 2(3?) years ago.
I think I always end up busy this time of the year because everyone in Japan has done their tax, realizes they are not (yet) bankrupt.
Or maybe its the coming (Golden Week) holidays in Japan means nobody wants to be stuck rendering anything over the holidays.
Either way, busy time for me.

Corporate tax

Just finished doing the company tax for Japan. Oh man you do not know true pain unless you have done corporate tax - and in Japanese! aaaaaagh!
It has been a pain for the last 3 months.
Good thing - it is done.
Bad thing - I just finished and so is my weekend.

Meetings, meetings

Yesterday I finished the UML for a procedural modeling program I was working on. Later racing around the rest of the day in meetings. The last meeting was with Mr. Hayashi from Spice, a man who understands both the art and business of CG.
Anyway literally raced home on the last train getting home just after 2.30am. Ate and prepared my notes for todays meetings, eventually getting to bed by about 5am. Luckily my morning appointment had been changed from 9am to 10 so I could get an extra 1 hour sleep. It's 2pm now waiting in a cafe before my next meeting starts, hope the bags aren't showing. I have to explain the benefits of stochastic simplification on massive data sets in Japanese - I think I need another espresso.

plans for SIGGRAPH 2008 Los Angeles

In a few months it will be Siggraph, I always leave things till the last minute. This year I will be planning ahead.
I am planning to be staying in a different hotel than I normally do. I will be organizing a couple of get-togethers in LA. BTW the invitation is open to clients only, so if thats you and your gang give me a mail before the end of the month and lets party!
早いもので後数ヶ月でSiggraphですね。私は毎年いつも物事を後回しにしてしまいがちなのですが、今年は早めに予定をたてようとおもいます。
さて今回私はいつも宿泊するホテルではないホテルに宿泊予定です。LAではいくつかの顔合わせパーティーを開こうとおもっています。このパーティーへのご招待は申し訳ありませんがクライアントのみとなりますのでご了承ください。
ということで御対象で御興味のある方は、申し訳ないのですが今月末迄にメールいただければとおもいます。一緒に楽しみましょう!

A long weekend.

Its Tuesday morning and I was at the office since Friday last week. Last night when I got home I was so out of it I fell asleep on the couch -today my neck is really out.
I was updating our Japanese servers. New projects will be using subversion, so I wanted to use the certificates I have given clients so far for webdav and remote services.
Just before I left last night I gave Hypershot by Bunkspeed a shot - I was asked by Mr. Hyashi from spice. It has a very intuitive interface, nothing fancy just a nice way to render. It reminds me of a very simple tool brought out a long time ago by Pixar called Typestry. To be honest the real-time render interface is great and fast, however the actual render is not as fast and as good as Prman. but for the price it's great.
So far so good.

GI hair demo Pixar's Renderman

Someone asked me for a quick demo of the last shader.Here is a standard hairball from the shave & haircut package. Now as you can see none of the background color is brought into the calculation. It looks as if the hairball is just composited on the background.




Simply lighting with the background image gives us a little better looking hair. There are no scene lights in this image just a back plate.
To be honest the light position needs tweaking and there are no shadows etc. But its a quick way to get ambient occlusion and color bleeding effects on the fly. Looks even better when your hair moves from room to room and the colors change appropriately.

non diffuse and non specular component additions to my IBL loop for Pixar's Renderman

Yet another iteration by Jagger with non diffuse and non specular component of my IBL modification for Joe Alter's Shave and & Haircut

--- shader1.sl 2008-04-02 14:50:24.000000000 +0900
+++ shader2.sl 2008-04-02 20:07:42.000000000 +0900
@@ -24,13 +24,16 @@
float vt;
float tl;
float nondiff = 0;
+float nonspec = 0;
lightsource("__nondiffuse", nondiff);
-illuminance ("environment", P, Ns, 1.57,
+lightsource("__nonspecular", nonspec);
+illuminance ("environment", P, Ns, PI,
"lightcache", "refresh",
"send:light:__surfacearea", -10,
-"send:light:__coneangle", 1.57,
+"send:light:__coneangle", PI,
"send:light:__coneaxis", Ns,
"light:__nondiffuse", nondiff,
+"light:__nonspecular", nonspec,
"light:_indirectdiffuse", indiff,
"light:_occlusion", occl){
float sq2;
@@ -49,15 +52,19 @@
sq2=sqrt(sq2);
rawspec = df2* sqrt( 1.0- vt * vt ) - (normalize(L). T ) * vt; /* raw specular */
if (rawspec<0) rawspec="0;" diffterm="(1.0-SHAVEambdiff)+diffterm*SHAVEambdiff;" cl2="Cl*SHAVEselfshad+(1-SHAVEselfshad);" nondiff =" 0;" nonspec =" 0;" df2="(T.normalize(L));" rawspec="0;" diffterm="(1.0-SHAVEambdiff)+diffterm*SHAVEambdiff;" cl2="Cl*SHAVEselfshad+(1-SHAVEselfshad);" mixed =" mix(" oi =" Os*SHAVEopacity;

local additions to my GI loop for Pixar's Renderman

Here is a small modification to my last post by Jagger from the Renderman forums. It adds local lights to my GI loop.

--- shd1.sl 2008-04-02 08:55:28.270635187 +0900
+++ shd2.sl 2008-04-02 08:55:58.334048545 +0900
@@ -1,4 +1,4 @@
-surface be_shave (float Ka = 0, SHAVEambdiff = .6, SHAVEspec = .35, SHAVEgloss = .07,SHAVEopacity = 1.0,SHAVEselfshad=1;
+surface shave_total (float Ka = 0, SHAVEambdiff = .6, SHAVEspec = .35, SHAVEgloss = .07,SHAVEopacity = 1.0,SHAVEselfshad=1;
color SHAVEspec_color=1,rootcolor=1,tipcolor=1;)
{
normal pxslUtilShadingNormal(normal n;){
@@ -56,7 +56,31 @@
Cspec += Cl2*pow( rawspec, 1.0 / ( 3.0 * ( .101 - SHAVEgloss ) ) )*.5; /* specular exponent x illumination */
Cdiff += Cl2*diffterm; /* diffuse x illumination */
}
+illuminance ("-environment", P, "lightcache", "reuse")
+{
+float sq2;
+df2=(T.normalize(L));
+df2*=df2;
+df2=1.0-df2;
+if (df2<0) df2="0;">0)
+df2=sqrt(df2);
+diffterm=df2; /* diffuse */
+if (diffterm<0) diffterm="0;" vt =" V.T" sq2="1.0-vt*vt;" sq2="0;">0)
+sq2=sqrt(sq2);
+rawspec = df2* sqrt( 1.0- vt * vt ) - (normalize(L). T ) * vt; /* raw specular */
+if (rawspec<0) rawspec=0;

+diffterm=(1.0-SHAVEambdiff)+diffterm*SHAVEambdiff; /* limits gamut of diffuse term */
+
+Cl2=Cl*SHAVEselfshad+(1-SHAVEselfshad); /* limits the gamut of shadowing */
+Cspec += Cl2*pow( rawspec, 1.0 / ( 3.0 * ( .101 - SHAVEgloss ) ) )*.5; /* specular exponent x illumination */
+Cdiff += Cl2*diffterm; /* diffuse x illumination */
+}
mixed = mix( rootcolor, tipcolor, v );
Oi = Os*SHAVEopacity;
Ci = Oi * Cs * mixed* (Ka*ambient() + Cdiff) + ( Cspec * SHAVEspec_color *SHAVEspec); /*sum terms and premult color x opac */

Environment lights in Pixars Renderman with Shave and a Haircut

Joe alter had a post on the Renderman forum regarding calculating lights with his wonderful hair product. Shave and a Haircut. For those of you who want to know how to do an illuminance loop over each strand here is my modified code:
by the way it's not tested but from looking at it should work.


/*
Shave and a Haircut emulation shader (c) 2007 Joe Alter, Inc
by Joe Alter
Global Illumination loop modification by Bernard Edlington
*/

surface be_shave (float Ka = 0, SHAVEambdiff = .6, SHAVEspec = .35, SHAVEgloss = .07,SHAVEopacity = 1.0,SHAVEselfshad=1;
color SHAVEspec_color=1,rootcolor=1,tipcolor=1;)
{
normal pxslUtilShadingNormal(normal n;){
normal Ns = normalize(n);
extern vector I;
uniform float sides = 2;
uniform float raydepth;
attribute("Sides", sides);
rayinfo("depth", raydepth);
if (sides == 2 || raydepth > 0)Ns = faceforward(Ns, I, Ns);
return Ns;
}
normal Ns = pxslUtilShadingNormal(N);
float occl = 0;
color indiff = 0;
vector T = normalize (dPdv); /* tangent along length of hair */
vector V = -normalize(I); /* V is the view vector */
float df2 = 0,diffterm=0;
color Cspec = 0, Cdiff = 0; /* collect specular & diffuse light */
color mixed=1;
float rawspec;
color Cl2;
float vt;
float tl;
float nondiff = 0;
lightsource("__nondiffuse", nondiff);
illuminance ("environment", P, Ns, 1.57,
"lightcache", "refresh",
"send:light:__surfacearea", -10,
"send:light:__coneangle", 1.57,
"send:light:__coneaxis", Ns,
"light:__nondiffuse", nondiff,
"light:_indirectdiffuse", indiff,
"light:_occlusion", occl){
float sq2;
df2=(T.normalize(L));
df2*=df2;
df2=1.0-df2;
if (df2<0) df2="0;">0)
df2=sqrt(df2);
diffterm=df2; /* diffuse */
if (diffterm<0) diffterm="0;" vt =" V.T" sq2="1.0-vt*vt;" sq2="0;">0)
sq2=sqrt(sq2);
rawspec = df2* sqrt( 1.0- vt * vt ) - (normalize(L). T ) * vt; /* raw specular */
if (rawspec<0) rawspec=0;

diffterm=(1.0-SHAVEambdiff)+diffterm*SHAVEambdiff; /* limits gamut of diffuse term */

Cl2=Cl*SHAVEselfshad+(1-SHAVEselfshad); /* limits the gamut of shadowing */
Cspec += Cl2*pow( rawspec, 1.0 / ( 3.0 * ( .101 - SHAVEgloss ) ) )*.5; /* specular exponent x illumination */
Cdiff += Cl2*diffterm; /* diffuse x illumination */
}

mixed = mix( rootcolor, tipcolor, v );
Oi = Os*SHAVEopacity;
Ci = Oi * Cs * mixed* (Ka*ambient() + Cdiff) + ( Cspec * SHAVEspec_color *SHAVEspec); /*sum terms and premult color x opac */
}