shader writing tuts???


#1

I have been looking for as much information as possible on the topic of writing shaders for Mental Ray in (X)SI, but haven’t found very much as of yet (wiki shader tut & shading theory)

But somehow I feel there must be more available (next to the obvious “writing shaders”-section of Mental Ray User’s Guide) and I cannot really afford the Mental Ray Handbook vol. 3 at the moment, so any help in pointing me towards good, beginner-oriented, preferably free (yes: I’m cheap! :rolleyes: ), resources on shader writing would be much appreciated… :applause:


#2

Can we assume you’re already familiar with C++ or C? If you’re not the first step would be to come to terms with at least the basics of that, since it’s what you’ll have to use to write the shaders.

Also I’d suggest you post this in the programming forums, as it isn’t that xsi specific (other than maybe the spdl bundling), and you could get plenty help from people who’ve written shaders that use other platforms and don’t read these forums.


#3

Well, I do have some familiarity with C/C++ (not extremely much I must confess). I will think about reposting this in the Programming-section, although I somehow mistakenly assumed, a Softimage-Programming-forum was a good place to start with questions concerning (X)SI-shader Programming…
Ah well, live and learn… :wink:


#4

What kind of info are you looking for? I have been writing a bunch of shaders, and have not used anything else other than the mental ray manual included with XSI. Between that, the XSI shader wizard, and the base mental ray shaders source code (from the mental images FTP site), you should have everything you need. Happy to answer any specific questions…


#5

Thanks for the offer… As they say: I’ll get back to you…
At the moment I’m just dreading to do the obviously quite necessary deep study of the MR-docs, as I find them “not quite written with the beginner in mind”, to put it mildly. My plea for tutorials doesn’t come from the unwillingness to do that kind of hard work, but merely from the wish to “ease into it” a little…

To be continued… :thumbsup:


#6

Understood. I think you will find its actually pretty easy to get started. If it were me, I would do the following:

  1. Use the shader wizard in XSI to build a blank project for your shader.

  2. Download the mi base shader source code from here: ftp://ftp.mentalimages.com/pub/shaders/public-shaders-3.6.50.20.zip

  3. Pick a base shader that is similar to what you want to do (e.g., if you want to do an illumination shader, pick baseblinn.cpp. If you want a light shader, pick mib_light_point in baselight.cpp). Then copy the code into the blank project you created earlier.

  4. Look at the shader source and see how it works. It is actually pretty straightforward once you get into it. For example, the blinn code is only about 70 lines long and is not hard to figure out. Mib_point_light is about half that. Then modify the code to do whatever you want it to do, recompile, and see if what you did works. Rinse, repeat.

  5. If you want to do something you either you cannot find an example of in the example source, or you do not understand something in the source, only then refer to mental ray manual.

Just my 2c. Good luck!


#7

Those are very useful 2 cents… :thumbsup:
You really helped me a lot already!
Just downloaded the mi base shader source code. Let’s see where it gets me… :wink:


#8

It isn’t a bad place, and I’m in no way trying to dissuade you from posting here :slight_smile: but you have to remember MRay is used in max and maya too, and shader writing is the same on all platforms that use it, just the interface wrapping can change slightly (spdl vs mi). With that in mind, posting in the programming forums could get you help and insights from mray shader writers who’ve never used xsi, and there’s quite a few of those.


#9

No problem…
I couldn’t resist posting a slightly cynical remark, though :wink:
BTW, is it just me, or is there something amiss at said programming section, as the “main page” only shows 14 threads?

PS - Come to think of it: just like this subforum…


#10

it’s a low traffic forum.
If your showthreads is set to the default (one month), then you will only see the traffic of that month.
At the bottom of the page set it to show last year or show all and you’ll find quite a few more :slight_smile:


#11

http://www.nanomation.co.uk/Programming-101.html
http://www.nanomation.co.uk/Programming-102.html


#12

Thanks, I obviously should have mentioned those two above also…
The Wiki-Tut I link to in my first post actually is an updated version of Nanomation’s “101”…
@ThE_JacO - Another mystery solved! Thanks
:wink:


#13

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.