Converting Assets from Max VRay to Maya VRay

We’re producing a film at work in Maya, rather than our normal 3ds Max. We’re trying to get a *ton* of assets from Max Vray over to Maya Vray and it’s proving to be difficult! More so than you’d think.

We’re using .vrscene’s to get the shaders over, but the mesh doesn’t come in as “normal” mesh (I asked one of our Maya chaps about this – I have very little experience with it myself!) and has some limitations. So we’re shunting the mesh over via FBX and the shaders over via .vrscene.

HOWEVER something funky was happening to the shader names which meant we couldn’t script it to automatically apply the appropriate shaders from the .vrscene to the mesh from the FBX. As such, we now have a custom exporter for Max which renames all the materials with a specific prefix in the material name (after smashing apart mesh with multi-subs and applying individual materials to each object), exports the vrscene, then applies Standard materials with the same name to the mesh’s and exports the FBX. With this, we can use the shader from the .vrscene (With the specific prefix’s) and link them up with the Blinn’s on the FBX (with the same prefix’s).

But the fun doesn’t end there! We had to write a few special exceptions in the prefix naming function to allow for VRayBlend materials, 2-Sided materials etc because they don’t convert over properly in the .vrscene converter, so then the Maya script that matches it all up sorts that out too.

Then you have some maps that don’t work with the .vrscene converter, even though they *do* work with VRay, such as the Composite map. It’s functionality cannot be duplicated with daisy-chained VrayCompTex maps due to the lack of opacity for each layer, so now the custom exporter has to manually move those maps over (because the vrscene converter doesn’t) and writes out a text file to the directory that allows a human to at least see how it was all put together. We could probably automate this into a MayaLayeredTexture but we haven’t got there yet.

I could go on! The upshot is that this is way harder than I thought (because I thought “export as .vrscene” was the extent of it!)

Are we missing an obvious trick here? Or is it actually just a slog?

Nuke PointCloud to Max Python Script

Here it is:

Click here to download!

It should be pretty self explanatory – select a relevant BakedPointCloud node, run the script, tell it where to save the .csv file and you’re good to go. You’ll then have a .csv file that can be loaded into Max using Thinkbox/Krakatoa’s PRT Loader, and it’ll store all the colour information as well as location. The only thing you’ll need to do is rotate the PRT Loader 90 degrees, since Max is Z-Up. When you do that, any cameras or geometry you move between Nuke and Max will align perfectly (since the FBX exporter – as well as the great Max Script Nuke’em – automatically re-orient).

Let me know if you have any questions, comments, or otherwise enjoy it!


Some Progress!

Well, I’ve made some progress of sorts.

In my last post I mentioned wanting to get a point cloud from NukeX (generated from a camera track) into Max’s new(ish) point cloud system. Well, the good news is that I’ve not got the point cloud – including colour data – from Nuke and into Max. The bad news is that it’s not using Max’s own point cloud system, as this requires a very particular format, the exact structure of which eludes me.

What I have done, courtesy of a smart idea from Dave Wortley, was to bring it into Max using Thinkbox’s PRT Loader, which can be grabbed as part of the Krakatoa demo. Krakatoa’s great and I advise you all take a look, but if you don’t want to make the investment in buying it just yet, the demo supports all the PRT Loading your body (and RAM) can handle, including what we need.

The actual process involves running a Python script inside NukeX with the required Point Cloud node selected. It’ll spit out a .csv file which can be loaded into the PRT Loader (and if you create the PRT Loader at the origin, its location will match up perfectly with any cameras you WriteGeo out from Nuke using .fbx format, as long as you ensure the scale is 1.0 when you import it in). At that point, you have the camera and a great point cloud from which to build up a proxy model of the scene, safe in the knowledge that the point cloud was generated using the same camera you’ll be projecting from.

Once I tidy up the code, I’ll release it on here – at the moment it has no UI and it just spits files out to your desktop (Y-Up, no less) but I’ll try and clean it up ASAP and get it on here.

In the mean time, please take a quick look at the video below showing how it’s working so far:

NukeX Pointcloud in 3ds Max from Dan Grover on Vimeo.



Nuke and Max with Point Clouds

Does anyone know how to get Nuke’s point clouds into Max 2015 onwards?

Max 2015 onwards supports point cache’s in both the viewport and when rendering (with MR at least) but only specific file formats – Reality Capture Scan Files, .rcs and .rcp files – where as Nuke simply pokes out an .FBX file. You *can* pull this into Max but it just slaps in a load of “Point” objects – ie dummys, for all intents and purposes. Whilst better than nothing, it’s pretty close to useless really.

I’m making it my mission to find out how to do this, and I can’t believe there’s no way already. But, in the likely event that it remains hidden from me, I’m taking a crack at it. It might require either some Python on the Nuke side or some MaxScript on the Max side, but I’ll get there!



Short Film

Alright, today is the day!! July 23rd, 2014 – The day I decided I’m going to make a short film!

As a tiny bit of background, I made two fully animated short films at university, and I work for a film company that – predominantly – makes short films of various sorts. So I’m familiar with the process. I just want a record here so that, in a few months when I haven’t done anything, I face self-shame and feel bad about it.


Quick Bit of Python Stuff

My Python journey is just beginning, but I’ve gotten to the point where I’m beginning to get up to speed with the basic syntax which makes doing a lot of thinking about a lot easier! If’s, Loops, all that jazz.

But the biggest two changes compared to maxscript that I’ve found so far are as follows:

1 – You have to “import” modules to get additional functions. This is good and bad – on the one hand, there are a bunch built in and you can download or make more, which means that the possible functions around to use are not only larger, but also expandable (Again, compared to MaxScript). For company-wide distributed scripts, this means that I need to make sure everyone has the correct plugins installed but that’s easy enough.

2 – You can do Ifs, Elif’s and Else’s – this might not be anything unusual to other coders, but MaxScript only had the first and last of those – there’s no else-if. Basically it allows you to completely control the flow of a set of if conditionals in a way that you can’t with MaxScript. It doesn’t strictly allow you to do anything new, because you can repeatedly do sequential if-statements with flagged variables and stuff, but sod all that – this makes it so much easier. I likey!

Python Adventure

My Raspberry Pi arrives tomorrow, and I have my book all about coding in Python which I’ve started to read through. I also started looking at the Max SDK documentation for the Python stuff – It’s going to be a long road, but I’m excited about it!

I have a MxS currently that remaps assets from wherever they are currently to another, single folder by copying all the assets there and then remapping, including XRefs (and nested XRefs). This is a key part of our cloud based rendering system, but the problem is that some of the XRef Max files are very large, and whilst they zip up nice and tiny, it’s not possible to remotely request a local unzip on the server they get uploaded to. So what I’m hoping to do with Python (the server also runs a WAMP stack) is to have a standalone Python script up there that listens on a port and unzips files on request. Or perhaps I can do it by making a small text file in a given folder that the Py script will check, unzip the file in that text file, then delete the text file? I’ll need to experiment…


Rasberry Pi and Python fun!

I’ve been so, so lazy about learning Python. I’ve long since wanted to actually write standalone or web apps (And we have a WAMP stack running in the cloud courtesy of Amazon, so there’s definitely somewhere to use it – in fact, I know exactly what I want to do with it!) but I’m starting with something else – A Rasberry Pi and a book teaching Python for beginners with a Rasberry Pi in mind! So I’m adding a new tag, and hope you update this blog on how I do.


How to Train Your Dragon 2 Review

Warning: The below contains significant spoilers for How to Train Your Dragon 2 from the very start. If you haven’t seen the film yet, turn back!

I know the internet doesn’t need another How To Train Your Dragon 2 review, but I consider the volume of critical response a testament to both how much people enjoyed the first (and, actually, second) film, as well as how much they care about it as a possible franchise. Furthermore, I’d like to state that How to Train Your Dragon 2 is an excellent film and I implore everyone to see it; It’s fun, it looks (and is animated) beautifully and it’s all sewn together with another excellent sound track from John Powell. If you’re worried because you haven’t seen the first one, don’t be worried – be excited, because you have the opportunity to experience, for the first time, the joy of some of the greatest bits of animation-meets-music ever rendered to pixels (that doesn’t sound quite as good as “committed to celluloid” but digital can’t have it all). In fact, it’s because it’s a great film that the flaws (Which largely escaped the first film) are all the more disappointing. I’ll jump straight in.

The mum. I know, I know. This has been the major source of ire within the community, though I think perhaps a lot of people are, if not actually misdiagnosing the problems with her character, perhaps prioritising the wrong elements. Her major flaw as a character is thus: She is presented as an incredibly capable (moreso than the main protagonist), complicated (at least as complex as the protagonist) and able to dispense wisdom (moreso than the protagonists other “wisdom givers”, Stoick and Gobbler, the former of which’s primary trait is entirely ignoring his son) character. She remains so for approximately twenty minutes, where after the illusion is shattered and she becomes, if anything, a liability.

I say that her flaws have been wrongly prioritised because they have centered on the issue from a feminist perspective, and this view is compelling – she’s a “strong female character” who, as explained by Tasha Robinson, ends up losing all her perceived power and requires rescuing by the “real” heroes, the men. This certainly happens, and I wouldn’t deny that this just plays into the sloppy characterisation of “strong women” that Tasha eloquently described. But her major flaw here is just that her character isn’t well developed, irrespective of her gender. And don’t worry, there’s a more significant target for the ire of feminists, as I’ll explain below.

Said mum – Valka – has a few opportunities to instill some real depth of character, if only the writers were willing to let it get there. She begins by explaining to Hiccup that she left the town when they were attacked by Dragons and she discovered one (who is now her mount) fawning over baby Hiccup. She then gets accidentally dragged away but decides to stay because she realises that Dragons have real hearts and emotions and feelings and that she doesn’t want to contribute to further Viking vs Dragon bloodshed, believing Berk and her husband incapable of changing their ways. This is all wonderful, but that’s basically what we learned in the first half hour of the first film. Her absence from her family, though, indicates a strong trait within her that this is something she cares greatly about – until her husband turns up, at least

Within minutes (and after he immediately forgives her, which in itself is somewhat puzzling), she’s decided to return to Berk because they had a little sing-song and he asked her to. What I thought would happen – and I think would have created a much greater moment of tension – is if Stoick began his song and dance, she joined in as she did in the film, and then at the end said “No” when he asked her to return – it would have shown that she’s a three dimensional character, a mother and a wife who misses her family and her previous way of life but that there are other things she wants too; This is a horrific choice for a mother to have to make, but she cares so greatly about this cause that she’s willing to sacrifice her family still – just as she has for the past 15 or so years – and the song and dance stirred within her a nostalgia and memory of a time when life was simpler and possibly happier, making the decision all the harder. A similar moment happened in the Harry Potter series (excellently executed in the films, which I wasn’t anticipating) near the end when Hermione and Harry are in the tent searching for the Horcruxes after Ron has stormed off. They’re both getting a bit depressed about it all, but they have this beautiful moment where they’re able to forget about it all for a moment and just dance together, to be “normal teenagers”, to enjoy each others company before returning to the horrible reality that they faced in the tent – they didn’t just laugh and say “Oh sod it, let’s just go to Ron’s aunt’s house and ride it out!” It was a reprise, but they understood that they had responsibilities beyond their immediate happiness.

So far, not so good: We have a character who has demonstrated that she’s incredibly talented at riding dragons but otherwise has failed to actually tell our main character anything he didn’t already know. She’s immediately turned her back on her previous decision because her husband asked her to. And then, as soon as the fighting starts, she needs to be rescued twice within pretty quick succession by her husband (something she has presumably avoided in the last 15 years when he hasn’t been around). Her largest contribution to Hiccup and Toothless’ success was the “revealing” of Toothless’ blue back fins, that enabled him to turn more sharply. Thanks, Mum! This is basically something she could have tweeted to him in 140 characters.

Now, to her credit, there is an explanation for her turning her back on her previous way of life – her problem (And reason for not returning sooner) is that she didn’t believe that Berk (or, more importantly, Stoick) could change. Part of this is because she didn’t even try, but whatever. So when she learns that Berk has changed, courtesy of her son, her reason for staying with the Alpha was lost. Except that immediately after this decision, we discover that – coincidentally – the enclave is under attack in a way that it never has been before, and the Alpha dies with a gentle pat on the face. In other words, as soon as her family turns up, her entire world comes crashing down around her – and she just returns to it!

But there are other problems, too – Astrid being the more deserving recipient of feminist ire, in my view. In the first film, her role was pretty significant; Birk was unsure of who he really was, and what he could do, and she believed in both him and herself, so she kicked his arse into gear and helped him do what he had to do. She was the one to convince him to go and rescue Toothless as his father went off to go fight the dragons on the island. She was by far the best “warrior” of all the kids, and was absolutely integral to Hiccup’s eventual success – so she wasn’t the protagonist, but she a protagonist for sure.

But in the 2nd film? Hiccup still doesn’t truly know who he is, but she can’t help him this time. She doesn’t need to kick his arse, because in pursuit of some sense of identity, he seems more than willing to be reckless and act without his previous film’s characteristic hesitation. Furthermore, whilst she demonstrates her dragon-riding chops at the beginning of the film by winning the “race”, we discover at the end of the film in the closing segment that the only reason she won at the beginning was because Hiccup didn’t bother to turn up. As soon as he does, he wins pretty unequivocally. The final nail is the coffin is that she’s relegated to the same league as the other goonish screen fillers whose role on the first film was at least justifiable by dint of their helping to flesh out the society and culture of Berk. In this film, we already know what Berk is. We know what its relationship with dragons is. At no point do they really help the protagonists in their quest, they primarily just get themselves into scrapes and then get themselves out of them again. And poor Astrid is one of them! She went from being a great example of a female character who not only goes toe to toe with the male hero, but exists entirely independently of him to basically just being his trophy betrothed concubine.

Another weakness, I felt, was the relationship between Hiccup and his parents. I think it was meant to come across in a “He finally thought he could have the two-parent family lifestyle that he always wanted, but it was cruelly snatched from him”, but it came across a lot more like he’d simply swapped one parent for another, especially given Valka’s immediate resumption of previous service, sorry for the disruption, won’t happen again. I think the reason for this is that we never really get the idea that Hiccup’s life suffered as a result of his single parent upbringing – OK, so in the first film we see that his father struggles to relate to him, and his expectations of what his son would be and what his son really is diverge – but it doesn’t play a particularly significant role within the film, because Hiccup manages to overcome all of his problems more or less immediately anyway, thanks to a combination of his own actions and the urgings of Astrid. His father’s major function in the first film is to act as a hurdle to overcome. Furthermore, he was the de-facto prince of Berk, and we can therefore be assumed was granted a pretty plush upbringing. So when he gets the mother he never knew back in his life, it’s hard to avoid asking the question “Well… so what?” When Stoick then bites the dust and Hiccup is back to having a single parent, it’s hard to imagine how this’ll actually has a meaningful difference. This is compounded by his almost immediate forgiveness of Toothless – another excellent potential source of conflict, albeit internal this time – to just combine into the feeling that none of these events surrounding his relationships have much gravity, as they don’t appear to impact his behaviour at all.

Then finally, away from characters, we have the final Act 3 sequence, wherein Toothless defeats the “new” Alpha some 15 minutes after he has become the Alpha and, in turn, becomes the new Alpha. I think the idea of Toothless ending up being the Alpha is great – it makes sense in the context of the mechanics of the film, and it follows the first film’s sense of Hiccup-Toothless symmetry; In the first film, they end up with both missing a limb, not only cementing their bond due to their differences-in-common but also because, even more than before, they need each other to experience a full life – Hiccup can hardly walk let alone fly without Toothless, and Toothless can’t even get out of a small canyon without Hiccup. At the end of HTTYD2, we get that same symetry, with both Toothless and Hiccup becoming the “Alphas” of their respective groups. Hiccup’s heavy cloak over his shoulders at the end is even mirrored by Toothless’ blue back-spikes along his back as a visual sign of a coming of age. I also thought the blind-fold scene, whilst short-lived, was a really great way of re-cementing the bond between Hiccup and Toothless after their brief separation, and it was a great contextual way of demonstrating both Hiccup’s willingness to forgive and Toothless’ willingness to trust his friend.

But did it have to be so uneventful? In the first film, we had a giant, massive dragon that could physically overwhelm Toothless who, whilst powerful for his size, was no where near a match for. He was, however, quick and agile (as long as Hiccup was on his back!) and in the end, it was leveraging this trait that won the day. He faced an almost identical enemy in this film, as he was left fighting a giant, massive dragon that could physically overwhelm him. But his victory was brought about by simply sitting on a rock in a single place and blasting the Alpha in the face with his explosive shots. I understand that the other dragons slowly changing their allegiance and firing on the Alpha was a significant story point, but it didn’t seem like Toothless had really done enough to justify their respect yet. I was hoping for a Test Drive esque sequence of aerial acrobatics where Toothless showed again that it wasn’t all about pure power, but about the application of ability and skill and fighting smart – but he didn’t, he basically reinforced that it was all about brawn, a trait which the entire film had taught us to understand that the Alpha was simply superior in.

Beyond this, there were a few smaller problems that don’t really matter – the “thing” with the wingsuit that Toothless and Hiccup kept trying and failing to do until the end never really made much sense to me. What were they trying to even do? I understand that the heat from Toothless’ blasts was causing Hiccup to rise, but why did they keep flying into rock formations? What was he trying to do when Toothless “saved” him, and what did they do differently at the end to make it “work” (even though they still ended up arse-about-face)? The whole thing just didn’t read clearly to me at all. Similarly, John Snow Eret was basically an entirely irrelevant addition to the cast.

Again, I want to emphasise that this is a critical review – I actually really liked the film and want you all to see it. But these flaws just seem so… obvious and so easy to fix, and I’m not sure why they didn’t. The main story beats would hardly have to change. It could end in the same way, with the same characters in the same positions, if only they altered the journey a little! Maybe next time?!