Quicktip: Maya 2015 crashes at startup

Check the Output Window. If it says

Invalid Python Environment: Python is unable to find Maya’s Python modules

make sure you do not have any Python environment variables set. To check, just open a command line (cmd.exe) and type

set

If you see any variables like PYTHONHOME, remove those by typing

set PYTHONHOME=

Note that this removes the variables only for this particular session, so if you open another cmd.exe, it’ll still be there.
Now that the variables are removed, start maya from this command line. If it now starts correctly it means that maya is clashing with your Python installation. The easiest way to work around this without breaking your install is to run maya from a small batch file instead of the .exe

set PYTHONHOME=
maya.exe

and drop this as maya.bat or something into the maya bin folder and run maya this way.

Cinema 4D Quicktip: Lighting for Reflectance Channel

As you can see I find out new stuff about the reflectance channel every day… again about the lighting this time.

An interesting little find: if your material is only using reflectance, and its Roughness is set to 0% (fully reflective with no blur), a regular light will NOT show up at all! And it won’t light the scene either! Turn Roughness to 1% and voila, light’s back. But you may not want even 1%. Then…

here’s a workaround: make your light an Area light. Doesn’t matter whether Diffuse/Specular/GI is turned on or off, makes no difference! Then go to Details tab and turn on Show in Reflection. And now, there’s your light again.

I’m still trying to work out the details and whether this is as it should be or whether it is a bug.

Cinema 4D Quicktip: Alembic Caches, TP and Krakatoa (or Turbulence FD, or…)

Previously I posted a PRT ROP for Houdini, so that point clouds could be exported as PRT files to be then rendered in Cinema 4D via Krakatoa (or anything else that accepts PRT files of course). This is still a very valid workflow. You can stop reading now if you want :)

Now, I’m a big fan of the Alembic format. It’s just super convenient. And if you’re not dealing with a 100 million particles (actually… maybe even then? Haven’t tested it yet) it is very nice to have your entire particle sim sequence in one file instead of hundreds of single files.

Here are a few facts in advance:

  • Cinema lets you open Alembic files with points as either Polygon geometry or Particle Geometry (aka TP)
  • Krakatoa offers offers a PRT load for its own format
  • Krakatoa also offers a TP Source object to use Thinking Particles groups as render sources

First approach:
first approach
As straight forward as it can be. Drag in the Alembic file, select Particle Geometry as the Point format and add a Krakatoa TP Source object. You don’t even have to change any option, it’ll just work. However: the big advantage of using an Alembic Cache is that you can position, scale and rotate it to your hearts content. That is not only very useful for correct positioning, but you can also put multiple instances in your scene at different positions in time and a single sim will give you a bunch of different splashes or whatever. Unfortunately when you import Alembic Points as Particle Geometry, you’re out of luck here. It’ll takes its default PSR and stay there, no matter what. Annoying!

The fix:
the fix
First of all, import you Alembic cached points as Polygon geometry, not particles. This is important, because now you have the full range of options to transform the cache as described above. Then use a Matrix object like so to generate Thinking Particles out of your cache:

Again I did not configure much here. Obviously you could use multiple caches writing to multiple TP groups and use multiple Krakatoa TP Source objects to render with different settings etc. Make sure to turn the visiblity of the Matrix object off! Because otherwise your viewport will be clogged with Matrix cubes. And for the TP generation part the object does not care whether it’s visible or not.

And that is it. Now you can transform your caches and even animate them and still end up with nice and clean TP that can be read by other plugins like Krakatoa, Turbulence FD, X-Particles etc. pp.

Cinema 4D: Default Lights

Today I invested some time into understanding how and when the Default Light influences an image. I did this because it bit me in the arse earlier today, when lighting with an HDRI image… but more about that later.

First of all, the setting can be found under Render Settings > Options > Default Light. It’s on by default.

Here are various combinations and how and if the Default Light plays into them.

Default Light

No lights in the scene causes the camera to emit a straight forward light (spot I assume) into the scene when Default Light is turned on. With it turned off, it’s just a black image.

Default Light only

Area Light + Default Light

First interesting thing: when Cinema finds another regular Light object in the scene, it automatically turns off the default light and uses the scene lights instead, which is what you would expect it to do. Thumbs up for that.

Area Light + Default Light

Physical Sky

A physical sky object with default settings. Default Light: OFF.

Physical Sky only

Physical Sky + Default Light

A physical sky object with default settings. Default Light: ON. No difference. The default light is correctly overridden by the physical sky.

Physical Sky + Default Light

Sky Object no Material

A Sky object with default settings and no material attached. Default Light: OFF.

Sky Object no Material

Sky Object no Material + Default Light

Now a Sky object with default settings and no material attached, but Default Light: ON. Notice something? Unlike the physical sky object, the sky object does not disable the default light!

Sky Object no Material + Default Light

Sky Object with HDRI

Our Sky Object now has an HDRI material attached. Default Light: OFF. All is well.
Sky Object w/ HDRI

Sky Object with HDRI + Default Light

Same, but Default Light: ON. And do you notice something? Suddenly the default light is back on! Causing a specular where you would not expect it and which will cause you to fiddle with your HDRI to no end…
Sky Object /w HDRI + Default Light

Sky Object with HDRI + Default Light + Regular Light

… and then when you managed to get your light to look right somehow (incorporating that unexpected specular somehow), you add another light. And behold: the Default Light disappears again! Causing your image to look different again.

Conclusion

I can’t help but feel like this is a bug, but it is one that’s been there for a while I think. Until something changes, make absolutely sure to always, always turn off Default Light unless you really do not want to use any lights at all. Otherwise you are just opening yourself up for all kinds of headache when the default light starts interfering with your light setup.

tl;dr:

  • Light objects in the scene will turn Default Light off
  • Physical Sky objects in the scene will turn Default Light off
  • Sky objects in the scene will leave Default Light on (unless manually turned off in Options)

Who’s that monkey and why is it flipping switches?

Since there has been some confusion as to what the hell the name of the blog means and what is the deal with monkeys and switches anyway, here’s where it all comes from:

While a mediocre film otherwise, I somehow found Matt LeBlanc’s line here absolutely hilarious. Maybe I’m just simple.

Basically what it boils down to (yes, I’m explaining the joke now) is: you’re getting trained for years in all kinds of ways to blow shit up and then they put you in front of a console where, literally, your only job is to flip a switch.

This, btw., should ring familiar to anyone who studied computer science (or, actually, anything at all) and ended up in customer support.

PRT Export from Houdini

Houdini, unfortunately, has no native support for the PRT file format used by Krakatoa. There’s an old plugin from Thinkbox that comes in as a Python module. It compiles, but I never got it to actually do anything. If you get it to work, please let me know!

Luckily the good people from Robotika and Fiction released their own exporter for Houdini 12 some while back.

I forked this and modified it slightly to compile with HDK14 and VS.

These were compiled and tested with the Indie version on Windows 7. I’d assume they work with the full version and maybe Apprentice too, but I don’t know.

Here are the DLLs for a few builds. I’ll update this post if new versions come along. No warranty or anything of course. It’ll either work or it won’t…

Download

Houdini 13.0.547: PRTRop_13.0.547.rar

Houdini 13.0.582: PRTRop_13.0.547.rar

Houdini 14.0.201.13: PRTRop_14.0.201.13.rar

The empire strikes back

Here’s what I wrote previously under “Episode whatever – a new hope”:

With this rather witty title (well…) I shall once again endeavour to, you guessed it, blog. Yes, please do, I hear you (nay millions of voices suddenly!) cry out, it has worked out so well in the past! I shall obey, of course.

Which brings us to this blank slate of a blog (yes, there were old posts which may or may not eventually reappear, if there is a demand for it). It is now not using WordPress, but instead runs on Ghost, a new node.js based blogging system that as the name suggests, focuses on blogging. So, not so much a CMS. The initial impression is quite positive, a very nice editor with realtime preview and otherwise very basic (read: reduced to the essential) interface. I like it. Very clean. Let’s wait for the inevitable installation of a few hundred plugins…

Please note the image on the left. I rather like it. Done with the new reflectance shader in Cinema 4D as of R16. Which shall be the topic of my first real post. Which I could have written days ago, if I had not instead started fiddling with the website and aforementioned Ghost. But there you go. Nerds, eh?

Aaaaaand we’re back. To WordPress. Because, if I’m honest, the main thing convincing me to use Ghost was its nice, clean editor. Everything else was very, very limited. And then along came Gust, which implements just this editor for WordPress. Best of both worlds? We’ll see.

Flask and Teamwork Part 2

I wrote a little_helpers.py that will contain a bunch of functions that will make accessing Teamwork easier. The first step is always to authenticate against Teamwork with the user’s api key and thus, this is the first function making it in there too:

def validateApiKey(key):
    url = "https://authenticate.teamworkpm.net/authenticate.json"
    auth = HTTPBasicAuth(key, 'pass')
    r = requests.get(url, auth=auth)
    json_data = r.json()
    if "STATUS" in json_data and json_data["STATUS"] == "OK":
        return (r.status_code, json_data["account"])
    else:
        return (r.status_code, None)

Nothing fancy. I decided against using urllib2 and went with the requests module instead. The latter offers a much nice interface and it also has a very simple way to deal with return codes without necessarily having to deal with exceptions. It just writes the return code into r.status_code as an integer. I have not done the status code checking in here, because depending on the error code there will be a redirection to specific other routes (Error 401 for example with return to the login page with a specific message).

The authentication URL is thankfully generic and does not require to know the user’s company id, so this means all you really ever need is the api key, with which you can authenticate and get in return the complete user data for that user, including the correct company url for further requests. The interesting stuff is in under ["account"], so that’s all I’m returning. It is JSON encoded and can thus be plugged straight into the session variable as e.g. session["current_user"]. Note that the response does not contain the api key itself, so that has to be stored separately.

With this it is very easy to create further functions like to get all projects:

def getProjects(key, user):
    baseurl = user["URL"]
    url = baseurl + "projects.json"
    auth = HTTPBasicAuth(key, 'pass')
    r = requests.get(url, auth=auth)
    json_data = r.json()
    if "STATUS" in json_data and json_data["STATUS"] == "OK":
        return (r.status_code, json_data["projects"])
    else:
        return (r.status_code, None)

Pretty much the same, except now we can use the user’s own URL. And this is basically how I plan to implement most of the API, at least for the read-only functions.

As an initial test I displayed all project’s start and end dates on a timeline, using the visjs library’s Timeline object. Works like a charm.

The next step will be to incorporate user’s holidays and other blocked times into the timeline to easily spot potential conflicts. This kind of reporting is unfortunately still missing from Teamwork (January ’15), but I hear they are working on it. Until then we’ll build our own. I am still working out the details on how to display all the infos, though…

Oh and at first I tried to somehow get a counter (integer) going within a Jinja2 loop in the templates and of course that didn’t work. Turns out it is very easy though:

  var data = new vis.DataSet([
    {% for project in projects %}
        {id: {{ loop.index }}, content: '{{ project.name }}', start: '{{ project.startDate }}', end: '{{ project.endDate }}'},
    {% endfor %}
  ]);

loop.index does just that.

And finally, another extension

pip install flask-wtf

to create web forms easily. Only used it for the login dialog so far, but it is very straight forward to use.

Next is creating more Teamwork API wrappers and working out a good way to display the kind of reports mentioned above.

Houdini 13 / 14 icons

As great as certain applications are – there is often one little thing that really gets on my nerves and could be avoided so easily: same icons. Yes, if you only ever use the latest version of a software, this really does not matter a whole lot. But Sidefx (to their credit!) release a lot of daily builds, and like with e.g. Cinema 4D as well, you often need to use multiple versions of the software at the same time, be it for the reliance on certain plugins only available for that version, or because you were exploiting a bug only existing in that one build. Anyway, you end up with a bunch of identical icons in your taskbar and more often than not, you’re opening the wrong version by accident.

Why am I even explaining this? I hope someone takes this to heart and incorporates versioned icons in their build process…

Until then, I’ve made my own icons and maybe some of you out there can find some use for them as well. Here you go.

Download (.ico and .icns files)