giovedì 17 giugno 2010

QWidget: Cannot create a QWidget // Maya exited with status 1

Yesterday I've seen this error, for the first time, using batch rendering with Mental Ray. The problem was a plug-in (Maxwell Render plug-in for Maya 2011) never used in my scene but oddly loaded opening the file. The plug-in could not be unloaded because of a reference to maxwellpreviewdata. If I "forced" Maya to unload the plug-in, I got an error that stated:

Plug- in cannot be unloaded because it defines a MPxData derived type that is still in use.

Uninstalling the plug-in is the easiest thing to do, it's a temporary solution that fixes the problem, allowing Mental Ray to work fine again.
As a matter of fact, if I reinstalled the plug-in, the problem came up again.
Next I tried to delete unknown and locked nodes, running the MEL commands:
  1. lockNode -lock off `ls -type unknown`;
  2. delete `ls -type unknown`;
to clean up the file but it didn't work, Maxwell Render Plug-in was loaded again opening the scene.
The last step I made was a "brute force attack" to the scene not to waste my time.
I saved the scene as Maya Ascii file, opened it with Wordpad, deleted the line:

requires "Maxwell Render 2.0.39"

and saved the ascii file.

It worked, the plug-in isn't loaded opening the file and Mental Ray can melt again my cpu. This solution is very rough and I'd like to find out a more elegant fix.
Anyway I hope to be helpful.

Best regards.

lunedì 14 giugno 2010

Installing Bonus Tools for Maya 2011 [win64] on Windows 7

In my humble opinion, Autodesk should change the way to automate the building of packages for Windows. I've never seen so many errors and requirements to install a very small piece of software like Bonus Tools for Maya.
"Bonus Tools is a free collection of useful Maya scripts and plug-ins. After installing Bonus Tools, users will have a pull-down menu for easy access to the tools that cover all aspects of everyday use: general UI, modeling, animation, texturing, rendering and cloth." 
Cool! Unfortunately installing this piece of software on a fresh install of Windows 7 x64 is very hard, at least for me.
Double click on the msi file and the first problem appears:

"The InstallScript  engine is missing from this machine. If available, please run ISScript.msi, or contact your support personnel for  further assistance."

What's Installscript? It's a system to create Windows setup files:according to InstallShield,, it should keep "customers happy". Actually I'm not happy and Installscript acts like a virus: you can install it, you can't remove it, you have to live with it. No way to uninstall it via Add/Remove Programs or using Windows Installer Clean up.
InstallShield explains here how to determine the version number of the ISScript engine we need, download it, and install it.
Unfortunately  I could not use the procedure explained to determine the version number I needed, so I tried it out myself.
Version 8 works for me.
It seems that installing multiple ISScript versions doesn't affect pc performances.
Ok, another problem:
"Registry Error: Module path is empty. Unable to set up Registry details to configure Bonus Tools." 

Unable to set up Registry: it seems a problem due to system privileges. I ran a dos command prompt as Admin. I navigated to the location of the msi file and typed:

msiexec /i MayaBonusTools2011_win64.msi

This procedure avoids the registry error. Finally Bonus tools have been installed.
Now I have to figure out how to install them on Vista x86. Other kind of problems on Vista.

lunedì 24 maggio 2010

CGPersia Toolbar 0.1b

New Beta version available here.
Nothing fancy in this version, I added a few search options (it's possible to search keywords in  blog and specific forums). Menus have been reorganized.
This version is supported by Firefox 3.6.*. Next release will be available for next versions of Firefox.
Best regards.

giovedì 6 maggio 2010

Cylon Centurion - Final render

It's time to complete my homage to Battlestar Galactica, one of my favorite TV shows. The first model to render is the fabulous Cylon Centurion, "a fully armored, metallic automaton that functions as the basic foot-soldier of the Cylon ground forces".
I used Autodesk Maya 2011 to model and render  my centurion. The Cylon soldier has got a lot of bevelled and rounded surfaces, so I decided to use Subdivision Surfaces when possible.
Finding good photos and references was the most difficult part of this process. I found out this site and it was a good starting point for the body. Unfortunately, the head and some details are barely visible, but I found out 
two more photos for the head.





Due to the low-quality photos, the head was quite complicated but the images I found in a second moment were good and the modeling part turned into a great amusement. I used a low poly sphere to start sculpting the head. On the left there's the original model, on the right my low poly cage.



I converted the low poly cage into a subdivision surface to smooth the head. After conversion, all edges were creased: the result is very good for me.
Only the head was modeled with polygons, all other parts were approximated  using subdiv surfaces.



Once the model was finished, I had to assign good materials to subdiv surfaces. I used a metal material created by Jeff Patton, a great CG artist, for all metallic parts. I downloaded a good, free angular map to lluminate my model with measurements of real light.



Test above is really good for me but I'd like to add my centurion to a photo representing a real scenario.



With Final Gather turned on, rendering took 1 hour on my computer but I like very much the result: the centurion is hunting rebels in a Caprica's wood.
The next model to render will be my new Viper MK II.

domenica 18 aprile 2010

Opening Sopcast links from within Firefox on Ubuntu Karmic 9.10

I'd like to open sop:// protocol links automatically in Firefox. The most popular solution I found is:

 1. In Firefox, in the Location bar, type about:config and press Enter.
 2. Right-click anywhere in the grid, choose New, then String.
 3. In the Enter the preference name prompt, type in network.protocol-handler.app.sop and press OK.
 4. In the Enter string value prompt, type sopcast-player and press OK.
 5. Try to open sop:// link on your favorite website and you will be presented with dialog box where you can search location of sopcast player. Navigate to ~/usr/bin and point to sopcast-player and click OK.
 6. OK out of dialog box and now all sop:// links should open sopcast player automatically.

This solution doesn't work for me. When I try to to open sop:// link, I'm not presented with "Open with..." dialog box. I receive an error message like:

Firefox doesn't know how to open this address, because the protocol (sop) isn't associated with any program.

In my case Firefox 3 does not actually launch sopcast-player using the network.protocol-handler.app configuration option.
If I go to Edit -> Preferences -> Applications, the sop protocol is not listed and I cannot add it there.
So I tought to retrieve all needed parameters from Windows and add the protocol manually via config file. mimeTypes.rdf stores information about which action is to be performed when downloading certain types of files, such as opening the file in a specific program or saving it to disk. mimeTypes.rdf is stored on our hard drive in ~/.mozilla/firefox/xxxxxxxx.default/
1.  Quit Firefox
2. we can back up the profile directory: if something goes wrong we can restore original files.
3. Let's open up mimeTypes.rdf. We have to find the section and modify it in this way (adding the line <RDF:li RDF:resource="urn:scheme:sop"/>):

<RDF:Seq RDF:about="urn:schemes:root">
    <RDF:li RDF:resource="urn:scheme:mailto"/>
    <RDF:li RDF:resource="urn:scheme:irc"/>
    <RDF:li RDF:resource="urn:scheme:ircs"/>
    <RDF:li RDF:resource="urn:scheme:webcal"/>
    <RDF:li RDF:resource="urn:scheme:dlc"/>
    <RDF:li RDF:resource="urn:scheme:sop"/>
</RDF:Seq>

4. Now we have to add these parameters below the line </RDF:Seq>:

<RDF:Description RDF:about="urn:scheme:sop"
                              NC:value="sop">
   <NC:handlerProp RDF:resource="urn:scheme:handler:sop"/>
</RDF:Description>
<RDF:Description RDF:about="urn:scheme:handler:sop"
                              NC:alwaysAsk="true" />


Done! Now if we open sop:// protocol links in Firefox, we will be presented with "Open with..." dialog box. Or, once Firefox is loaded, we can go to to Edit -> Preferences -> Applications and set the location of sopcast-player.

EDIT (09/12/2010):
It may be necessary to modify the boolean value of network.protocol-handler.expose-all on Ubuntu 10.04:

 1. In Firefox, in the Location bar, type about:config and press Enter.
 2. Set the value of network.protocol-handler.expose-all to false .
 3. Try to open sop:// link on your favorite website and you will be presented with dialog box where you can search location of sopcast player. Navigate to ~/usr/bin and point to sopcast-player and click OK.
 4. OK out of dialog box and now all sop:// links should open sopcast player automatically
 5. We can restore the value of network.protocol-handler.expose-all to true.

Best regards.

venerdì 16 aprile 2010

CGPersia toolbar for Firefox

CGPersia is a great forum dedicated to 3D arts and related softwares. CGPersia has a lot of sections and sub-sections. Since I visit CGPersia every day, I created a toolbar extension for Firefox to speed up my navigation and to easily search threads and posts.


The very early version of the toolbar is available here.
It does not contain all of the features that are planned for the final version, but it works fine for me.
Probably I will add drop-down menus with dynamic links to hottest and most  viewed threads and a window for advanced search.
I'm releasing it because a 3d passionate could find it useful.

Best regards.

mercoledì 14 aprile 2010

Creating a 3D terrain from height measurements

Sometimes we architects have to create a digital representation of a ground surface topography (DEM) for 3D visualizations. I usually start with a .dwg file and a bunch of  height measurements. The image on the left is a typical case.
I invented an "original" way to crank out a digital elevation model.
I usually use AutoCAD Map and a couple of extra tools.
I export all measurements in a text file and then import it into AutoCAD Map. Exporting all measurements is quite simple: I use CAD2FILE, a free Lisp program that allows me to export all needed parameters into a text file.

We can select the file type to create (on the left) and the properties to send to the file. In my case I select Insertion Point and click  Okay.

The result is a text file with this structure:

Start X,Start Y,Start Z,Text Value,
2318050.04,4644289.52,0,12.4,
2318382.41,4643741.07,0,12.4,
2318385,4643737.46,0,12.4,
2318387.03,4643734.37,0,12.4,
...

Start X, Start Y,Start Z are the coordinates of the insertion point of the measurement. Value is the measurement.

Cool! What I wanna do now is fix this file because AutoCAD Map can import a series of x, y and z coordinates only, without other parameters.
To do this I wrote a simple Java program named Virgola:




// Author: Stefano Bolli
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import java.io.*;

public class Virgola {

public static void main(String[] args) {
Virgola virgola = new Virgola();
}

public Virgola() {

// Text directory
File textDir = new File(".");
// Filter for text files
TextFilter tfilter = new TextFilter();
// Text files
String[] textList = textDir.list(tfilter);

if (textList.length == 1 ) {
System.out.println("I found the file:" + "\n");
System.out.println(textList[0] + "\n");
System.out.println("I'm fixing the file...");
readFile(textList[0]);
}
else if (textList.length > 0) {
System.out.println("\nFound multiple files. Indicate the file you wanna fix:");
System.out.println("\n");

for (int i = 0; i < textList.length; i++)
System.out.println(i + ") " + textList[i]);
try {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String fileChoosen = in.readLine();
int x = Integer.parseInt(fileChoosen);
readFile(textList[x]);
} catch (IOException e) { }
}
else
System.out.println("No text file found");
}

public void readFile(String fileToRead) {
try {
BufferedReader br = new BufferedReader(new FileReader(new File(fileToRead)));
String line;
Vector vector = new Vector();
while ((line = br.readLine()) != null) {
// Store the row in the vector.
vector.addElement(line);
}
br.close();
SaveFile(vector, changeNameToFile(fileToRead));
}
catch (IOException e) { } }
public String changeNameToFile(String name) {
String newName = name.substring(0, name.lastIndexOf(".")) + "_fixed_by_Virgola.txt";
return newName;
}
public void SaveFile(Vector v, String fileToSave) {
try {
BufferedWriter out = new BufferedWriter(new FileWriter(fileToSave));
for (int i = 0; i < v.size(); i++) {
String s = (String)v.elementAt(i);
if (!s.startsWith("Start")) {
out.write(cleanLine(s) + "\n");
}
}
out.flush();
out.close();
} catch (IOException e) {
}
}
public String cleanLine(String line) {
String oldLine = line.substring(0, line.lastIndexOf(","));
String newLine = oldLine.substring(0, oldLine.indexOf(",0,")) + oldLine.substring(oldLine.lastIndexOf(","));
return newLine;
}
/** * Filter for text files. */
class TextFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
boolean acceptFile = false;
if (name.endsWith(".txt"))
acceptFile = true;
return acceptFile;
}
}
}


If someone needs this program, I can compile it and send as .exe file.


Ok, now we can import the text file into AutoCAD Map and create the terrain.
The final mesh is a triangular irregular network and can be imported into 3d softwares like Maya o 3DS Max: as you can see, I was working on a level land with a river. There are a few errors I can fix quickly before smoothing the mesh.

Best regards.

JDownloader Click'N'Load on Ubuntu Karmic

JDownloader is a terrific Java software to simplify downloading files from One-Click-Hosters like Rapidshare.com or Megaupload.com. These sites allow us to upload any kind of file that can be downloaded by other users. If the file size exceeds the allowed limit, the data are splitted into a lot of parts, zipped and uploaded to the hosters. If we don't have a Premium Account, we have to download one part at time. Click'N'Load is a JDownloader's built-in technology to downloading a container file that lists the different parts. Installing Click'N'Load on Windows is pretty simple. On Ubuntu we have to install it by ourself:

Download the Linux/Mac Installer/Starter, open it and change the path to the Installation folder, make it executable with the terminal command:

 stefano@SERVER:~$ chmod +x jd.sh

and run it. This file will download the latest Jdownloader.
Now, what we wanna do is add some protocols to Firefox to handle Click'N'Load.
On Linux/MAC, some needed protocols are not controlled by the OS. If you are using Firefox, you may add the protocols by ourself:
  1. Open Firefox advanced configs by typing “about:config” in the address bar.
  2. Right click –>new: create the following entries for each protocol:
    1. Replace PATH_TO_SCRIPT with the path to jd.sh. First Line is String
    2. Second Line is Boolean
  3.  Restart JDownloader
 network.protocol-handler.app.jd = PATH_TO_SCRIPT/jd.sh
 network.protocol-handler.external.jd=true
 network.protocol-handler.app.jdlist = PATH_TO_SCRIPT/jd.sh
 network.protocol-handler.external.jdlist=true
 network.protocol-handler.app.ccf = PATH_TO_SCRIPT/jd.sh
 network.protocol-handler.external.ccf=true
 network.protocol-handler.app.rsdf = PATH_TO_SCRIPT/jd.sh
 network.protocol-handler.external.rsdf=true
 network.protocol-handler.app.dlc = PATH_TO_SCRIPT/jd.sh
 network.protocol-handler.external.dlc=true

martedì 6 aprile 2010

Funky gallo

My brother Massimo manages a team of players in an Italian fantasy soccer league named Hattrick. The team is named Alligallya, a play of words from an old Italian song . He asked me for a logo for his team and I was very happy to sketch a funky cock (on the left... I'll buy a pen tablet as soon as possible, I think I need it :) ) and trace it in Photoshop. No special effects, I used transparent gradients for reflections and soft shadows to fake depth. This kind of works remembers me how lazy I'm: the head is good, the torso and everything else are not exceptional. But I need a rest after a couple of hours. Probably I'll fix the torso tomorrow. I like to help my brother, his team is quite scanty (lol, it's a joke, Max) :)
Best regards

giovedì 11 marzo 2010

A pilot for my Viper MK II: sculpting the head

My Viper needs a pilot, so I have just started to sculpt the head.

The first step: I have created a low poly head in Maya and then I have imported it into ZBrush. The goal is achieving the normal map from the hi-res model and using it in Maya. Nothing fancy here, I need a simple model: the pilot will be visible in a few frames during the animation, the fighters are very detailed and I can't "spend" a bunch of polygons. I found out some interesting photographs browsing the internet to use as reference for my 3D head.


The image on the left is the result of my work. Using the standard brush and the move tool, I have sculpted a simple head in 30 minutes. I'm pretty happy about my head, I'm creating a tough, die hard pilot! I have used a couple of alpha brushes to add details like the beard, the eyebrows and hair. Probably this step is useless, but ZBrush is so amusing! Now I can create the normal map to "smooth" my low poly head.



The next step is boring (for me): it's time to use Photoshop to paint a texture on the UV map. Probably it's the moment where I waste a lot ot time. I can create a model very quickly but I'm never satisfied when I use Photoshop. Actually I'd like  to send my model to the texturing department but I  dont'work for Pixar, it's all home made. In this case I created the texture in 3, 4 hours making it again, and again, and again. I used a lot of references I found in internet. The result is not phenomenal but I can live with it.  I really don't like flat hair but I cannot use fur, it's too expensive. No eyes at this moment, this guy is still blind!

The day after: I have tought of using a technique for video games to have my hair. The idea is simple: creating a lot of cards to fake the hair. The result should not be terrific but this guy will have a helmet and I won't spend a lot of resources for the hair. The problem is that I have to come back to Photoshop to create a new texture with a good alpha channel. The image on the right shows the cards on top of the head.




What a crew cut for this guy! I think the result is pretty good, considering I'll must model the helmet. It's very important to program what we are going to see in the animation not to waste useful resources. The final texture is a tga file with an alpha channel for the transparency. I used a single hair wisp scaled, mirrored and altered a lot of time to achieve a minimum of variety. 1 hour of Photoshop for this work. As said before, this result could be better but I have to model the helmet, the body, the boots and the hands yet. And this guy will be visible for a few frames. Ok for now, it's time to find a reference of the helmet used in Battlestar Galactica.
Best regards!