Showing posts with label mental mill. Show all posts
Showing posts with label mental mill. Show all posts

2011-03-21

MetaSL.org - MetaSL Tutorial and Reference Book/Website

Hello everybody!

Today we release MetaSL.org which is a companion website to the work-in-progress book about MetaSL programming by Andy Kopra and Lutz Kettner.


This site/book is a walkthrough of the concepts behind MetaSL and will show you how to write shaders in the MetaSL language.

Now, let it be clear that this is intended as a living "work in progress site", so these are the initial chapters of the book, available online.

I quote from the page: "Chapters of the MetaSL book will be posted on the website in both HTML and PDF formats as they are written. The structure and contents of earlier chapters may change as required by the development of later chapters. The reference pages, based as they are on the MetaSL specification, will not change between MetaSL specification versions, though improvements may be made in the way the content is hyperlinked and cross-referenced."

What is available so far is the first four chapters explaining topics such as basic language concept and layout, and some of the most basic shading- and raytracing concepts.





The book also has an accompanying forum on the mental images website, where questions and feedback can be posted. You will get an unprecedented front-row seat to the evolution of this book. Enjoy the ride!

/Z

2010-05-27

mental mill 1.1 Standard Edition public beta 2

Notice: There is a new public beta of mental mill 1.1 Standard Edition


One particular neat feature with this beta is an exporter I built for it that exports MetaSL shaders to 3ds Max 2011 directly from inside the mill.

The workflow is basically this:

  • Build your shader tree in mental mill
  • Select the root node
  • Go to File->Export
  • Choose the "Autodesk 3ds Max 2011 (Slate Extension)" exporter
  • (First time only: Select your 3ds max installation directory)
  • Hit "Export" button.
  • Start Max

Now you will see the shader in the Slate material editor "MetaSL" category.
These shaders now...

  • ...work in the 3ds Max viewport
  • ...render in mental ray
  • ...render in Quicksilver
  • ...and any other MetaSL compatible renderer!
And the coolest part is that it works even with your own custom made MetaSL shaders, in all above renderers! This is different than the MetaSL support in Max 2010 that was locked to the shader set shipping with it. Not so in Max 2011, you can build your own shaders. They compile automatically in the back and "just work". Even raytracing calls in the shaders get converted to the automatically generate cube reflection maps for Quicksliver, which is quite neat :)





Expect lots and lots of posts on this topic coming soon - for those that are curious about this workflow and want to see it up close, and see me debug some shaders live, pop up in Utrecht, Netherlands, next week (June 3-4, 2010) at www.EndUserEvent.com (see previous post)


Known Issues:

  • There are some known issues with the Lookup_Texture_2d node not showing in the viewport with gamma correction enabled, but I hear this should be fixed in a 3ds Max service pack (hopefully). It still works in mental ray / Quicksilver.
  • If Texture2d inputs exist inside a phenomena in your mill graph but are not exposed to the interface of the Phoneomenon, they will not get properly filled in when loaded into 3ds Max. To fix this, simply expose the "Texture2d" to the interface of the Phenomenon.
Find the download for mental mill 1.1 Standard Edition here

Have fun!

/Z

2009-05-15

3ds Max 2010, MetaSL and mental mill

Wouldn't it be fun if....



While working in the viewport wouldn't it be nice if the thing you rendered was faithfully represented in the viewport? At least as faithfully as technically possible?

Wouldn't it be neat if the left part of the below was the final render and the right part would be what you saw in the viewport, while working with it?




(click to enlarge)


Oh wait - that is exactly how it looks in 3ds Max 2010! Oh no, how can this be? Is it magic? Is it elves? No, it's MetaSL, and mental images mental mill technology.

What happens in 3ds Max 2010 is that several of the shaders has been given an implementation in the MetaSL shading language. MetaSL is mental images renderer agnostic shading language. When this shading language is taken through the mental mill compiler, out the other end drops something that can fit multiple different graphics hardware, as well as several different renderers!

This way, no matter if the graphics hardware is NVidia or ATI, you will see the same thing (or as close as the card can afford to render) using only a single MetaSL source shader.

Viewport accuracy



Look at this image, which is the difference between the render (on the left) and the viewport in the previous version, 3ds Max 2009:




(click to enlarge)


Notice how horrible the viewport (on the right) looks, how harshly lit, unrealistic, and oversaturated it looks? The thing to take home from this is that the main reason that this looks massively different is that the image on the right is neither gamma corrected, nor tone mapped.

I mention this to illustrate the importance, nay, imperativeness of using a proper linear workflow, with a gamma corrected and tone-mapped image pipeline.

So while the lighting and shading itself is much more accurate in 2010 than 2009, the key feature that really causes the similarity between the render and the viewport is the tone mapping and gamma correction.

But naturally, the additional accuracy of the shading and lighting drives this home even more: See below a couple of different lighting scenarios, and see how well they match the render (again, render on the left, viewport on the right):




(click to enlarge)


After playing around a bit (tip; use the 3ds Max "light lister", you can get:



(click to enlarge)


So, using this feature, with the help of the MetaSL technology, you can make a decent set of lighting decisions and "look development" in realtime in the viewport. That's pretty neat, if I may say so myself ;)

So what about mental mill



Now nothing of the above is the end-user using mental mill. It is still using the mental mill compiler "under the hood"; MetaSL versions of 3ds Max shaders are compiled for the hardware, and used in the viewport.

But in 3ds Max 2010, the end user can also use MetaSL and mental mill directly. And yes, not only for hardware rendering in the viewport, but for mental ray rendering as well!!

First, please note that this is a 1st step integration of mental mill into 3ds Max. It has some issues (we know some quite well), and even a couple of bugs snuck into the final release (we are also very aware of these). But the general workflow is that you:

  • Create a shade tree inside the mental mill Artist Edition that ships with 3ds Max
  • Save this as an .xmsl file
  • Insert a "DirectX material" (yes, this makes you think this is only for HW rendering, since in the past "DirectX material" was only used for such things)
  • Load the .xmsl file into it
  • See the material in the viewport and render it with mental ray!


Now, as I mentioned above, there are some known issues in this 1st integration, to be aware of:


  • In mental mill you always have to build a Phenomena, not just a free standing shade tree. So your workspace in the mill should contain a single Phenomena representing your new material.
  • The last node must have a single output. This is actually a bug, and it will be fied, but for now, if your root node has many outputs (like for example the Illumination_Phong does), just pipe it's main output through some other shader (like Color_Brighness or similar) to make sure the final output node only has a single output.
  • Due to a difference in texture coordinate handling in 3ds Max mental ray and MetaSL, UV coordinates must be connected explicitly. So if you include, say, a texture looup node, you must include a "State_uv_coordinate" node to feed it coordinates. Inside mental mill you will really not see any difference, since the built in "default UV's" work there, but without doing this mental ray will render it incorrectly.
  • There was recently discovered an issue with localization; it seems that if your Windows system is set to use "," rather than "." for the decimal separator, this causes an error in interpreting some MetaSL code. For now, the workaround is to change your windows decimal separator settings to "."; sorry for the inconvenience :(
  • While you can change the shader in the mill and re-load it into the DirectX material and see the viewport update, the mental ray loaded version of the shader will not update automatically; be careful about this. You can force an update by renaming the phenomena and the file so mental ray loads it as a "new" shader.


Having taken the above things into account, though, your MetaSL shader should render pretty much exactly the same in mental ray as they appear in the viewport!

Some really snazzy things can be rendered thusly.

mental mill Standard Edition



The "Artist Edition" of mental mill sipping with 3ds Max can only work with the shipping nodes, not custom MetaSL nodes. It can also only export hardware shaders. (While this may sound like a contraditction to what I said above, note that you are not exporting the shader from mental mill in the 3ds Max 2010 workflow, you are saving the mental mill project (.xmsl) itself, and it is 3ds Max that is able to load this and render it in mental ray.)

If, however, you are a shader developer that want to write custom MetaSL shaders and render these in both mental ray and see them in the viewport, you need the mental mill "Standard Edition". This product can be purchased over the newly snazzily updated www.mentalimages.com website.

Enjoy the fun!

/Z