Monday, April 30, 2012

Creating a Netview Tool

How do you create a custom tool having complex user interface?
Using a PPG Layout? very good. But, I like to create a tool using Netview.
This time, I will write how to creat a custom Netview tool.

1) The first step is creating a relational view.
    Open the relational view editor by choosing View > New Custom Relational View.

2) Input the name of your tool to the 'View Name' textbox.
    Choose an item from the Set View > Netview in the right-click menu.
   
3) Setting to be invisible the toolbar of the Netview.
   Choose an item from the Toolbar > None in the right-click menu.
  
 
4) The next step, Create the HTML file of your tool.
    The following is the source code template of the Netview tool.
    Please, modify this code and save.

<html>
<head>
<title>My Netview Tool</title>
<script language = "javascript">
//*** Basic information of this tool ***
//Please modify these parameters.

//The name of this tool. 
//You have to make it the same as the name of the relational view.
var gsThisToolName = "My Netview Tool";  
//The view's width
var gnViewWidth = 220;
//The view's Height
var gnViewHeight =160;
//Single view mode or not
var gbSingleMode = true;

//*** End basic information ***

var xsi; //The softimage application object 
initTool();

function initTool(){
 //Get the softimage application object
 var xsiApp = new ActiveXObject( "XSI.Application" ) ; 
 xsi = xsiApp.application;

 //If this tool is single view mode, only one view is opened.
 if(gbSingleMode){
  var oViewList = xsi.Desktop.ActiveLayout.views;
  var oViewListCount = oViewList.count;
  var f = false;
  for(var i = 0; i < oViewListCount; i++){
   var oView = oViewList(i);
   if(oView.type == gsThisToolName){
    if(!f){
     oView.state = 0;
     oView.Resize(gnViewWidth, gnViewHeight);
     f = true;
    }else{
     oView.state = 1;
    }
   }
  }
 }
}

//*** User functions ***
//Please modify as you like.
function myRBt_onClick(in_Val){
 xsi.SetViewCamera(in_Val, 1);
}

function myCheck01_onClick(in_Val){
 var oCamera = xsi.GetViewCamera(1);
 xsi.SetValue(oCamera + ".camvis.gridvis", in_Val, null);
 xsi.SetValue("Views.ViewB.*.camvis.gridvis", in_Val, null);
}

function myCheck02_onClick(in_Val){
 var oCamera = xsi.GetViewCamera(1);
 xsi.SetValue(oCamera + ".camvis.selectioninfo", in_Val, null);
 xsi.SetValue("Views.ViewB.*.camvis.selectioninfo", in_Val, null);
}
//*** End user functions ***

</script>
</head>
<body bgcolor="#aba8a6" topmargin="3" leftmargin="3" scroll="no">
<font size="2">
<!-- HTML body. Please modify as you like. -->
<b>Sample</b><br>
<!-- Radio buttons. -->
<input type="radio" name="myRButton" checked onClick="myRBt_onClick('user');">User
<input type="radio" name="myRButton" onClick="myRBt_onClick('top');">Top
<input type="radio" name="myRButton" onClick="myRBt_onClick('front');">Front
<input type="radio" name="myRButton" onClick="myRBt_onClick('right');">Right
<hr>
<!-- Checkbox -->
<input type="checkbox" name="myCheck01" checked onClick="myCheck01_onClick(this.checked);">Grid
<input type="checkbox" name="myCheck02" onClick="myCheck02_onClick(this.checked);">Selection Info
<hr>
<!-- Text Field -->
<input type="text" name="myText" size="24" value="Hello, world!" onChange="xsi.logmessage(this.value);"
 onKeypress="javascript: if(event.keyCode==13)this.blur();">
<hr>
<!-- Button -->
<input type="button" name="myButton01" value="Cube" onClick="xsi.CreatePrim('Cube', 'MeshSurface', null, null);">
<input type="button" name="myButton02" value="Sphere" onClick="xsi.CreatePrim('Sphere', 'MeshSurface', null, null);">
<br>

</font>
</body>
</html>

5) Open the View_Properties window by choosing Set View Properties in the
    right-click menu.  And enter the address or the file path of the HTML file.

   
6) Then, Save the relational view by choosing File > Save in the right-click menu.
    You can open your tool from the view menu. But, your tool menu is under 'Others'.

7) Open the xsivw file with a text editor.
   Enter the category name as you like in the category property.


   You can open your tool from the menu set by you.
   
    
    

Saturday, February 4, 2012

Generate Rock Compound

I built an ICE compound generating a rock.
The algorithm is the same as the one that I posted before.
Please don't say to me that there are already compounds with similar.
I had decided to built this compound when I started my blog.

Compound Name: "sto Generate Rock" 
- Subdivisions: The number of segments.
- Rock Scale: Scale of the Rock.
- Cubelike(0-1): Shaped like a cube.
- Enable Cell Noise: Add the effect of cell noise.
- Displacement: How far points are moved.
- Number of Kernel Points: Sets the number of kernel points.
- Cell Noise Seed: The random seed of the cell noise.
- Variance: Specifies the range in which  kernel points will be moved.
- Smooth: How many times the smoothing algorithm is repeated iteratively.
- Enable Crack Noise: Add the effect of crack noise.
- Crack Depth: Depth of cracks.
- Crack Scale: Scale of cracks.
- Crack Noise Seed: The random seed of  the crack noise.
- Enable Rock Face Noise: Add the effect of rock face noise.
- Amplitude: How far points are moved.
- Scale: The granularity of the noise pattern.
- Medium Noise Seed: The random seed of the rock face noise (medium).
- Detail Noise Seed: The random seed of the rock face noise (detail).

Get an empty mesh(From the Get > Primitive > Polygon Mesh > empty).
Create an Ice tree in the empty mesh.
Add an "sto Generate Rock" compound and connect to the Ice tree.

Download -> here

Saturday, January 7, 2012

Creating a cube by ICE Modeling

I built a ICE compound creating a cube because I could not find ports of subdivisions on "Primitive Mesh" node.


I thought that a cube can be create by combining 6 plane grids.
First Build arrays of vertex positions and polygonal descriptions for each plane.
Next combine each arrays.


Compound Name: "sto Create Cube"
 - Length: The size of the cube.
 - Subdivisions U: The number of segments(U-axis).
 - Subdivisions V: The number of segments(V-axis).
 - Subdivisions Base: The number of segments(Base-axis).

Download -> here

Monday, December 19, 2011

Creating a grid by ICE Modeling

I studied about ICE topology mesh.I tried creating a grid by ICE modeling.
The following is the algorithm for creating grid topology.


Compound Name: "sto Create Grid"

 - U Length: The length of U-axis.
 - V Length: The length of V-axis.
 - Subdivisions U: The number of segments(U-axis).
 - Subdivisions V: The number of segments(V-axis).

Download -> here

Saturday, December 10, 2011

Gaussian blur

I built a ICE compound to smooth/blur a weight map by a Gaussian function.











The following is the ICE tree of a Gaussian function and the graph of result.











The following is the function calculated by the ICE tree.
exp( -Distance * Distance / ( 2 * Radius * Radius ) )



Compound Name:  "sto Gaussian Blur Map"





- Mute: Disable the calculation.
- Radius: The value of blur size.
- Value: The Input value.

Download -> here

Friday, November 25, 2011

An experiment on procedural terrain generation

I experimented on procedural terrain generation.

Terrain generation using perlin noize is a popular technique.
I built the ICE Tree using this technique.
I generated the terrain shape by adding noises of large scale, mid-scale and detail.
The key of this ICE Tree is Exponent node.
Squaring the noise value, it comes to be visible like a mountain. 

Download sample scene -> here

Sunday, November 6, 2011

Procedural Rock

I found a very wonderful tutorial about creating procedural rock for 3dsMax.
http://saschahenrichs.blogspot.com/2010/03/3dsmax-environment-modeling-1.html
I tried it using Softimage ICE.

This is the ICE tree completed. Download this sample scene -> here

1.
Create a cube. 
 - Subdivision values : about 50 - 100
Because of setting higher subdivision values last, you should not freeze the geometry operator.
Then, create a weight map.
2.
Create ICE tree.
Get a stoSpherify node and connect it.
3.
Get stoCellNoiseMap(ver.1.1) node and Set Data node.
Connect stoCellNoiseMap node to Set Data node.
Set "Self.cls.WeightMapCls.Weight_Map.Weights" to reference value of Set Data node.
4.
Get Sculpt node and connect it.
Set "Self.cls.WeightMapCls.Weight_Map" to reference value of Sculpt node.
5.
Get Transform Mesh node and connect it.
Change the size of the object as you like.
6.
Add a weight map.
Get Turbulize Value by Range node, FCurve node and Set Data node.
Connect Turbulize Value by Range node to FCurve node,  FCurve node to Set Data node.
Set "Self.cls.WeightMapCls.Weight_Map1.Weights" to reference value of Set Data node.
Adjust FCurve.

7.
Get Sculpt node and connect it.
Set "this.cls.WeightMapCls.Weight_Map1" to reference value of Sculpt node.

8.
Get Turbulize Mesh node and connect it.
Adjust value of properties of Turbulize Mesh node to seem to look like a rock surface.
9.
Set higher subdivision values to cube geometry operator.
 - Subdivision values : about 160 - 250