Friday, December 31, 2010
Monday, November 22, 2010
Diagram of the Day #5
Monday, November 08, 2010
Diagram of the Day #4
Tuesday, September 21, 2010
iomanip
C++ std iomanip is super handy!
e.g.
"setw(4) << setfill('0')"
http://www.cplusplus.com/reference/iostream/manipulators/
e.g.
"setw(4) << setfill('0')"
http://www.cplusplus.com/reference/iostream/manipulators/
Thursday, September 16, 2010
Thursday, September 09, 2010
Wednesday, September 01, 2010
RSL shadeop plugin memory
So there are 5 ways to manage memory allocation in an RSL shadeop.
1. per plugin init - lifetime from first call to end of frame, not threadsafe, no access to args
2. per function init - lifetime from first call to end of frame, not threadsafe, access to args
3. Set / GetGlobalStorate - lifetime from first call to end of frame, not threadsafe
4. Set / GetThreadData - lifetime of thread, threadsafe
5. Set / GetLocalData - lifetime of current shaded grid, threadsafe
1. per plugin init - lifetime from first call to end of frame, not threadsafe, no access to args
RSLEXPORT RslFunctionTable RslPublicFunctions(myFunctions,
initStringBuffer,
deleteStringBuffer);
2. per function init - lifetime from first call to end of frame, not threadsafe, access to args
static RslFunction myFunctions[] = {
{ "string appendTx(string)", appendTx, initStringBuffer, deleteStringBuffer },
{ NULL }
3. Set / GetGlobalStorate - lifetime from first call to end of frame, not threadsafe
4. Set / GetThreadData - lifetime of thread, threadsafe
5. Set / GetLocalData - lifetime of current shaded grid, threadsafe
Tuesday, August 24, 2010
Not bloody makefiles again ?
Replacing symlinks at compile time, so that republished shadeop DSOs don't fuck with existing shaders:
Makefile :
# here's the symlink path
MY_SO = $(PRMAN_PLUGDIR)MY.so
# resolve that to what the symlink points at
_MY_SOA := $(shell readlink $(MY_SO))
# double slashes in the path will mess up my shader macro's, so remove them
_MY_SO := $(subst //,/,$(_MY_SOA))
#now we can pass that into SL file scope using the pre-processor define flag, -D
shader .... -D_MYSO=$(_MY_SO)
Eat it, Makey - in your face, ha!
Makefile :
# here's the symlink path
MY_SO = $(PRMAN_PLUGDIR)MY.so
# resolve that to what the symlink points at
_MY_SOA := $(shell readlink $(MY_SO))
# double slashes in the path will mess up my shader macro's, so remove them
_MY_SO := $(subst //,/,$(_MY_SOA))
#now we can pass that into SL file scope using the pre-processor define flag, -D
shader .... -D_MYSO=$(_MY_SO)
Eat it, Makey - in your face, ha!
Friday, July 23, 2010
SIGGRAPH 2010
I am flying off to LA to attend my first ever SIGGRAPH conference tomorrow. I couldn't be more excited - its something i've always wanted to do since discovering SIGGRAPH papers existed when I was studying computer graphics at UMIST. ( 15+ yrs ago ! ).
I'm not sure why exactly but i've always been a fan of Jim Blinn's articles and work, and always thought it would be quite cool to attend a talk of his or meet him at Siggraph perhaps.
Any road up I am also due to give a short presentation at Pixar's exhibition booth about rendering the Olympus Map room clouds for Clash of the Titans. I am experiencing terror and excitement in equal measure. This is a new experience, usually its just the terror on its own. Fingers crossed it all goes to plan.
I'm not sure why exactly but i've always been a fan of Jim Blinn's articles and work, and always thought it would be quite cool to attend a talk of his or meet him at Siggraph perhaps.
Any road up I am also due to give a short presentation at Pixar's exhibition booth about rendering the Olympus Map room clouds for Clash of the Titans. I am experiencing terror and excitement in equal measure. This is a new experience, usually its just the terror on its own. Fingers crossed it all goes to plan.
Tuesday, July 13, 2010
Diagram of the Day 2
Todays winner comes from the cutting edge of towel research.
( again, page 3 seems a popular choice ) :
http://reference.kfupm.edu.sa/content/a/b/abstract_a_layered_method_for_realistic__76571.pdf
( again, page 3 seems a popular choice ) :
http://reference.kfupm.edu.sa/content/a/b/abstract_a_layered_method_for_realistic__76571.pdf
Diagram of the Day 1
Wednesday, July 07, 2010
Makefile and GLSL
So it turns out, as cool as GLSL is, there's no support for #include directives.
Arse.
Includes are quite handy so they are.
Right, so what we need now is some existing pre-processor to expand the includes in-place.
What about gcc -E ( or g++ -E ) ? Weeelll, they are ok, but they leave place markers everywhere, it doesn't read very nicely. Also you'd have to name all your glsl shader files .c or .cpp or something icky like that.
Turns out you can run "cpp -P" and that will pre-process the includes nicely. It works on any old file name too - so no problem calling them .glsl
How do I automate it though ? A script ? A makefile ?
Well, since you're preprocessing code, its near enough to a compile to use a makefile.
This is where the (un)fun begins... actually lets cut a long story short, i'm already sick of makefiles without recounting blow by blow details.
basically you'd do this:
and then run
Which would expect the glsl files to be one directory below the makefile in a dir called hwshaders.
Also I found out that if you are using a makefile conditional if, then the @ thingy to silence command echo doesn't really work. What did work for me was using the .SILENT rule.
so let that be a lesson to ye.
Arse.
Includes are quite handy so they are.
Right, so what we need now is some existing pre-processor to expand the includes in-place.
What about gcc -E ( or g++ -E ) ? Weeelll, they are ok, but they leave place markers everywhere, it doesn't read very nicely. Also you'd have to name all your glsl shader files .c or .cpp or something icky like that.
Turns out you can run "cpp -P" and that will pre-process the includes nicely. It works on any old file name too - so no problem calling them .glsl
How do I automate it though ? A script ? A makefile ?
Well, since you're preprocessing code, its near enough to a compile to use a makefile.
This is where the (un)fun begins... actually lets cut a long story short, i'm already sick of makefiles without recounting blow by blow details.
basically you'd do this:
GLSL_SHADERS := $(wildcard hwshaders/*.glsl)
GLSL_SHADERSOUT:= $(GLSL_SHADERS:.glsl=.glslo)
%.glslo : %.glsl
@echo $< $@
@rm -rf $@ ; cpp -P $< $@
glsl : $(GLSL_SHADERSOUT)
and then run
make glsl
Which would expect the glsl files to be one directory below the makefile in a dir called hwshaders.
Also I found out that if you are using a makefile conditional if, then the @ thingy to silence command echo doesn't really work. What did work for me was using the .SILENT rule.
.SILENT: safepub
safepub:
make clean
make
echo
if test -e /some/path/or/other/my.file; \
then \
echo File Exists \
else \
echo Doesn't Exist \
fi
so let that be a lesson to ye.
Tuesday, June 15, 2010
dPds works !
This was posted on the renderman forums, so i'm pretty sure its common knowledge.
Basically if you are in need of a consistent local basis transform for the usual stuff like normal maps and mapped anisotropic direction, you'll need a reliable tangent vector, sometimes referred to (by me, mainly) as dPds.
The RSL code is as follows:
Basically if you are in need of a consistent local basis transform for the usual stuff like normal maps and mapped anisotropic direction, you'll need a reliable tangent vector, sometimes referred to (by me, mainly) as dPds.
The RSL code is as follows:
void dPdst( float ss,tt; point PP;
output varying vector dPds;
output varying vector dPdt; )
{
float Dus = Du(ss);
float Dut = Du(tt);
float Dvs = Dv(ss);
float Dvt = Dv(tt);
vector DuP = Du(PP);
vector DvP = Dv(PP);
float det = (Dus*Dvt-Dvs*Dut);
dPds = (DuP*Dvt - DvP*Dut) / det;
dPdt = (DvP*Dus - DuP*Dvs) / det;
}
Tuesday, June 01, 2010
9 things i hate about my iPhone
These are the 10 9 most irritating things about my iPhone that stop at 'quite good' where it could have been truly great.
1 - Battery Life : shocking.
2 - Its expensive. Very very expensive.
3 - It can't bluetooth photos to non-iPhones. Basic stuff, and it can't even do that.
4 - You can't use your own sound files for ring tones. You have to buy them
5 - You can't copy files, such as pdfs, to it for offline reading. That's rubbish!!
5 - The calendar can't repeat on useful intervals such as 'last working day of month' or 'first tuesday in month'. Basic, basic, *basic* functionality that it can't even do.
6 - The pin number screen-lock is so irritating. If I want my data secure, I have to keep unlocking it all the time, even with the least annoying unlock option. Its so annoying when you are in a hurry.
7 - Touch sensitive keypad and predictive text frequently cause typos. The more of a hurry you are in, the worse it gets since it is so over-sensitive to mis-keying (or not adding the letter even when you hit a button with your finger).
8 - You can't write your own software for it unless you have a mac. Why should that be? Its not even running OSX !
9 - The sim card slot is like a chinese maths puzzle.
And that ladies and gentlemen, is why I think Apple are such smug bastards.
1 - Battery Life : shocking.
2 - Its expensive. Very very expensive.
3 - It can't bluetooth photos to non-iPhones. Basic stuff, and it can't even do that.
4 - You can't use your own sound files for ring tones. You have to buy them
5 - The calendar can't repeat on useful intervals such as 'last working day of month' or 'first tuesday in month'. Basic, basic, *basic* functionality that it can't even do.
6 - The pin number screen-lock is so irritating. If I want my data secure, I have to keep unlocking it all the time, even with the least annoying unlock option. Its so annoying when you are in a hurry.
7 - Touch sensitive keypad and predictive text frequently cause typos. The more of a hurry you are in, the worse it gets since it is so over-sensitive to mis-keying (or not adding the letter even when you hit a button with your finger).
8 - You can't write your own software for it unless you have a mac. Why should that be? Its not even running OSX !
9 - The sim card slot is like a chinese maths puzzle.
And that ladies and gentlemen, is why I think Apple are such smug bastards.
Monday, April 12, 2010
handy shell alias
pf is a wildcard running task search :
rmane set prman env :
rmanv queries prman env :
ribgrep :
where ribgrepext is a bash script like so:
ribgrepext :
alias pf "ps -ef | grep \!* | egrep -v 'grep |bin/pf'"
rmane set prman env :
alias rmane 'setenv RMANTREE /opt/pixar/RenderManProServer-\!:1 ; setenv PRMANVER \!:1_64 ; setenv PRMAN_SHADER_PATH ${BUILDROOT}prman-${PRMANVER}/shaders ; setenv PRMAN_DSO_PATH ${BUILDROOT}prman-${PRMANVER} ; echo RMANTREE set to $RMANTREE ; echo PRMANVER set to $PRMANVER ; echo PRMAN_SHADER_PATH set to $PRMAN_SHADER_PATH ; echo PRMAN_DSO_PATH set to $PRMAN_DSO_PATH '
rmanv queries prman env :
alias rmanv 'env | grep RMAN'
ribgrep :
alias ribgrep '~/ribgrepext \!*'
where ribgrepext is a bash script like so:
ribgrepext :
#!/bin/bash
if [ ! $# == 2 ]; then
$RMANTREE/bin/catrib $1 | grep -o -e '[^\"]*\.exr\|[^\"]*\.dsh\|[^\"]*\.shd\|[^\"]*\.ptc\|[^\"]*\.optc\|[^\"]*\.bkm\|[^\"]*\.tex\|[^\"]*\.unk' | sort | uniq
else
$RMANTREE/bin/catrib $1 | grep -o -e [^\"]*\.${2} | sort | uniq
fi
Subscribe to:
Posts (Atom)