PDA

View Full Version : RSL Questions


JaredTaylor
11-10-2009, 02:43 AM
Hi all,

I'm starting to learn RSL so I can write 3delight shaders.

I've only just started, so far I can write a surface shader and that's it. But I was wondering exactly what the things I'm writing actually mean.

F.ex. Ci = Surface Color

Is there a list somewhere of all the definitions.

Fumetsu
11-10-2009, 05:11 AM
Found this while searching:

Ci - used to output color of the surface. Output!
Oi - used to output opacity of the surface. Output!
Cs - true surface color. Input! This variable is set by a renderer and tells default surface color
Os - true surface opacity. Input! This variable is set by a renderer and tells default surface opacity
N - Surface shading normal
s, t - Surface texture coordinates
P - Surface position. This is the actual 3D Space position of the point you are shading.
Ng - Surface geometric normal
u,v - Surface parameters, do not confuse with s, t
du, dv - change in u and v across the surface
dPdu, dPdv - change in position with u and v (delta)
L - direction from the surface to the light source
Cl - light color
I - direction of the light ray hitting the surface
E - point position of the camera

Direct link: http://www.vga.hr/resources/tutorials/3d/rsl/html/chapter_03.htm

Another very useful website: http://www.fundza.com/

Edit: Better formatting.

JaredTaylor
11-10-2009, 05:59 AM
Thanks! :)

Fundza is where I'm currently learning this stuff ;) awesome site.

ndeboar
11-10-2009, 09:53 AM
It's getting a tad old, but Advanced Renderman is a great book, covers all this stuff.

playmesumch00ns
11-10-2009, 07:17 PM
It's getting a tad old, but Advanced Renderman is a great book, covers all this stuff.

+1 for Advanced RenderMan. You absolutely must own a copy of that book.

Mauritius
11-10-2009, 09:02 PM
+1 for Advanced RenderMan. You absolutely must own a copy of that book.
I beg to differ. :)

I think the best book is still "The RenderMan Companion" (http://www.amazon.com/RenderMan-Companion-Programmers-Realistic-Computer/dp/0201508680/ref=sr_1_1?ie=UTF8&s=books&qid=1257887098&sr=1-1). It teaches the very 'spirit' of RenderMan.
As for an introduction covering many advanced topics, the book "Rendering for Beginners: Image synthesis using RenderMan" (http://www.amazon.com/Rendering-Beginners-Image-synthesis-RenderMan/dp/0240519353) imho is a much better buy.

All interesting chapters about RSL/shading in "Advanced RenderMan" that I can think of are actually cheeky reprints of SIGGRAPH course materials, all of which are available for free at renderman.org (http://renderman.org/RMR/Publications/index.html#Sig). No need to buy that book.
Most, if not all, remaining technical chapters cover approaches of solving problems that no longer exist or apply today. E.g. using BMRT as ray-server because PRMan didn't have ray-tracing, volume rendering hacks, etc.
And the rest is stuff that doesn't really have anything to do with RenderMan per se (I'm talking about the chapter on color & composition).

.mm

JaredTaylor
11-10-2009, 09:02 PM
Cheers guys, I'll look into it :) Will those books teach me more/better than fundza?

I've got another question though, this code here:


surface
texture_test1(float Kd = 1;
string texname = "")
{
normal n = normalize(N);
normal nf = faceforward(n, I);
color surfcolor = 1;

if(texname != "")
surfcolor = texture(texname);

Oi = Os;

color diffusecolor = Kd * diffuse(nf);
Ci = Oi * Cs * surfcolor * diffusecolor;
}

If I set a texture to texname, it renders fine and everything, but what I want to know is if the actual texture is stored inside the shader file, so I could send this shader to someone, without the textures, and it'd render the texture?

JaredTaylor
11-10-2009, 09:59 PM
Also, could someone do me a favor, and write up this shader here so I can copy/paste it? I want to test it out and see what effects I can get, but I don't understand how to write it up. There's nothing defining the shader name, it feels like somethings missing:

http://www.fundza.com/rman_shaders/subsurf_texture/index.html

elvis75k
11-10-2009, 10:07 PM
you must provide your texture set, the rib will give info about the path and the name of the texture you've set on the scene.

next: this piece of code that start with color are functions. You want to use these functions into bracesss { .. }

JaredTaylor
11-10-2009, 10:10 PM
I see, thanks :)

JaredTaylor
11-11-2009, 08:29 AM
Could anyone show me what an SSS shader looks like as code?

ndeboar
11-11-2009, 10:35 AM
Could anyone show me what an SSS shader looks like as code?

If your using 3Delight, there are example shaders provided, including an SSS shader.

And yes, you'll learn a ton from the above books, probably good to give at least one of them a browse before diving to deep into the RSL pool :)

playmesumch00ns
11-11-2009, 01:29 PM
I beg to differ. :)

Of course you do Moritz :)

Personally I found the RenderMan Companion very dry and far too much emphasis on the now defunct C API.

AR has one of the best explanations I've seen on the Reyes pipeline and serves as a nice introduction to the fundamentals of shader writing. Yes, some of it doesn't apply anymore and yes, much of the material is available for free but it's nice to have it all collected together :) And I wouldn't say that the volume rendering stuff is redundant now either.

Mauritius
11-11-2009, 01:58 PM
Personally I found the RenderMan Companion very dry and far too much emphasis on the now defunct C API.
Not sure what you mean by "defunct". :) Every RIB exporter uses the C API, every direct language binding does, the newer plugins like 3DfM or RfM allow using the C API only (no RIB) to get data to the renderer faster. Pixar, too, has turned the renderer into a dynamic lib finally, last year, to allow omitting RIB.

RIB was never intended as a format to bake things.
It was meant for final output only, like postscript w/o the
'programmability' of the latter. But today it is used more to glue together resources stored in custom binary containers or programs that generate them, on the fly.
And as a glue format it has severe constraints. Many things added to RIB in recent years show this (RIB conditionals, Ri filters etc).

Scripting language that parse equally fast are much better suited (not many do, Lua and Lisp are two -- didn't have MPC even a Lua binding to replace RIB, at some stage?). Pixar looked into Lua themselves. The reson they didn't commit to it was because they though it wasn't "fashionable" with the VFX/CG TD crowd (which unfortunately is true).

Now they went for Python, like everyone else. The problem with Python is that is doesn't really replace RIB. That has mainly to do with parsing speed and how Python stores numbers. Any Python scene description that contains actual heavy geometry definitions will make parsing time a considerable factor of the overall render time. :P

So I think the C API not only isn't far from defunct, it is more important today than ever before.
Reading and looking up the RC is suggested to anyone writing a binding -- many people are surprised when they compile their well working, assumed stable exporters/bindings for the 1st time on a 64bit platform and they crash in weird places because they terminated their calls with NULL instead of RI_NULL). ;)
AR has one of the best explanations I've seen on the Reyes pipeline
You mean "How PhotoREaliastic RenderMan works". That's one of the cheeky reprints of a SIGGRAPH course I mentioned. As such this is not from AR but from SIGGRAPH, really. A good read indeed. And available for free. :)

.mm

playmesumch00ns
11-11-2009, 05:14 PM
Sorry defunct was really the wrong choice of word. It's been a tough day :) What I mean is for people starting off with RenderMan they only really care about one thing - the shading language, and AR does a very good job of explaning that and enough about how Reyes works to enable you to use it effectively. The material might be available online, but how it is presented is just as important for someone learning (which is why we have teachers and don't just expect people to study at colleges using course notes alone).

Incidentally we still do have a lua binding for RI, but it's used (and has always been used) exclusively inside procedurals. We still use RIB for export, but really those RIBs are just a bunch of Procedural calls with a camera and global options.

rendermaniac
11-11-2009, 09:27 PM
Even though it's pretty old now I found Steve may's rman notes useful http://accad.osu.edu/~smay/RManNotes/, however "Rendering for Beginners" does surpass them. It also nice having a proper dead tree book to read from.

I'd also add a vote for Advanced Renderman. It does have several Siggraph papers, but it is nicely collated together.

Simon

Mauritius
11-12-2009, 10:05 AM
The material might be available online, but how it is presented is just as important for someone learning [...]
Yeah, that was my point: the reprints in AR are 1:1 reprints of the course notes. The text matches 100%, the images are the same there is no editing whatsoever.
The type used for typesetting is different. Not sure if I'd be prepped to lash out $$$ for someone switching a truetype font though. ;)

.mm

neuromancer1978
11-18-2009, 04:37 PM
There is more to Advanced Renderman than JUST the Siggraph papers, in fact there is a LOT more to the book, there are whole chapters not in the Siggragh papers.

Personally I own both Rendering for Beginners and Advanced Renderman, and while AR is considered "old" it is still invaluable to own, there is much that is explained in it. RfB is great if you are learning Renderman, though it does also help every now and then later on in your learning, or at the very least a nice quick brush up on skills in case you have lapsed in practice.

I have not read other books like The Renderman Companion or Renderman Shading Language (?? - by Rudy Cortez), though I am sure they would be nice to have as well.

Mauritius
11-18-2009, 05:00 PM
There is more to Advanced Renderman than JUST the Siggraph papers, in fact there is a LOT more to the book, there are whole chapters not in the Siggragh papers.
If you read this thread carefully, you'll realize that no one ever said AR consisted just of reprints.

But as far as this thread's topic goes, namely learning to write shaders in RSL, I'm very curious to know which chapters in AR, that are not reprints, you deem relevant to this subject matter, from a contemporary pov (as opposed to the pov of a person reading AR at the time it got published, initially).

.mm

neuromancer1978
11-20-2009, 12:05 AM
If you read this thread carefully, you'll realize that no one ever said AR consisted just of reprints.

But as far as this thread's topic goes, namely learning to write shaders in RSL, I'm very curious to know which chapters in AR, that are not reprints, you deem relevant to this subject matter, from a contemporary pov (as opposed to the pov of a person reading AR at the time it got published, initially).

.mm

Actually yes I did read each and every post. What is wrong with having SIGGRAPH material in a book when the authors are the ones presenting the material? Plus the book is at hand right there so if you dont have the actual paper copy of the SIGGRAPH material you need to get the pdf, if you happen to be somewhere without a computer and want to read up it - there you go...

Why are we fighting over a freaking book? The purpose of this thread has gone WAY off the subject of "Where can I get more info on how to write shaders?". The topic of the thread was not how much x book is better than y book, or the reasons why. You seem to have taken this subject WAY out of proportion, the topic starter was asking for help and we are giving that to him. To be honest this is actually very little info on Renderman out there, save for a few websites and a handfull of books. Who cares if AR has reprints of SIGGRAPH material?? At least it is out there.

If we feel that this book is helpfull for us or for anyone else and want to suggest that it would not be a bad investment to acquire such material then why keep up an argument over trivial things that do not matter to the thread starter at this time? He just wanted to know where to get more info on RSL. In my opinion any and ALL books, websites and papers are worthy of getting a hold of regarding RSL and Renderman. The bickering over the technicalities and personal preferences of publications is pointless.

Mauritius
11-20-2009, 12:53 AM
Why are we fighting over a freaking book?
I asked a question you carefully omitted answering in your reply.
When I was a beginner, I didn't have much money to spend on special interest books which are, lets face it, expensive.
AR is still between 50-60 US$ new. With all the better books out there for the topic the OP asked about and considering the points I made in my last posts to this thread, I think my objections are pretty well founded.

I regularly meet people who swear on AR, but I found that I never picked up this book in the last 5 years. And while lots of TDs have it sitting on their desk, I never ever saw anyone writing shaders in my vicinity pick it up in the last 4 years either.

That's why I like to ask the "why?" question. If you don't care spending 50-60 US$ on something that is mostly available for free and otherwise largely redundant -- fine, just say so thus the OP can understand why you suggest them buying this book.

If you, however, can make a valid point about why someone should still spend that money for some actual really useful information, for a beginner learning SL, that is only and only available in this book, lets please, by all means, share it so the OP can make an informed decision.

.mm


P.S.: And please don't tell me, again, "because it is nice to have it printed". Just print out the PDFs and staple them. On that note: I consider an e-book reader a really good investment. I own one since 18 months and I can't imagine my life w/o it any more -- also has a very useful 'search' function; which both books and printed PDFs somehow lack. ;)

rendermaniac
11-20-2009, 10:17 AM
I refer to part 3 (chapters 7-11) of Advanced RenderMan quite a lot. I have a couple of copies now where these chapters are falling out. prman's docs quick reference is good, but sometimes it is a little brief.

I'd love to see a RenderMan book written by you Moritz! ;)

Simon

neuromancer1978
11-21-2009, 07:14 PM
Just to make myself clear I am not trying to attack you on a personal level Moritz.... consider it a friendly debate ;)

My point is that the argument over a book that we "suggest" to buy, or even to browse through at a book store is pointless. You have a difference of opinion, that is fine, by all means voice it.

No I did not "carefully" omit a reply to the question of what chapters are deemed worthy of shelling out the $60 of AR, why should I reply to this when I have both the PDF's and the books? To justify myself and keep this train wreck of a topic going? No, I don't even care anymore. I am pretty sure by now the thread starter has ran away from this thread because of this back and forth bickering over specific chapters in a book.

However each reply you have written Moritz has been a detailed response as to why the RiSpec technologies are the way that they are, while I do not question your skill or expertise in the manner this is NOT the time and place to be explaining why RIB was never intended to be a bake format, or why the C API is still valid, nor the reasons for Python and so on and so forth.... These things do not matter to the thread starter, these are for advanced users of RiSpec. THESE are what I was talking about, not the specific chapters in a book that yes is OLD and lets face it - few people would really understand it without having an expressed and high drive to learn Renderman. However the people that would buy this book would buy it because they WANT TO. Your arguments are valid Moritz, I never said that they were NOT - I bought my copy because I WANTED IT. I already HAD the PDF's and KNEW that the papers were reprinted in this book, that did NOT stop me from buying the book. The people that have "suggested" that this book would be a good buy was simply that - a suggestion.

This is my last post on the matter, argument over a book - be it "helping" a person making an informed decision, or the validity of the book in modern times - is pointless. There is no reason to go in depth over things that do not matter to someone learning RSL.

CGTalk Moderation
11-21-2009, 07:14 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.