Frenchdog’s Weblog

An ICEd Polygonise Operator

June 29, 2009 · 8 Comments

Hi,
If you have read my previous posts, you are aware of the speed problem of my first polygonise operator. Processing a scalar field using a
distance like formula is very slow even on a medium point cloud !
So I spend some time learning how to implement an octree structure in my C++ plugin. It was really interesting but then I realised it was a serious task, a real developer job in fact.  As I do those search in my (short) spare time, I was rather upset by the amount of time before I can get something working.   And to be honest, I was not very confident on writing enough efficient code for this task.
So I decided to use ICE for the big bottleneck of the polygonise operator, the processing a scalar field in a voxel grid.  I build two ICEtrees (voxel center and corners) to store all the needed voxels data.

Hi,

If you have read my previous posts, you are aware of the speed problem of my first polygonise operator. Processing a scalar field using a
distance like formula is very slow even on a medium point cloud !

So I spend some time learning how to implement an octree structure in my C++ plugin. It was really interesting but then I realised it was a serious task, a real developper job in fact.  As I do those search in my (short) spare time, I was rather upset by the amount of time before I can get something working.   And to be honest, I was not very confident on writing enough efficient code for this task !

So I choosed to use ICE for the big bottleneck of the polygonise operator, the processing a scalar field in a voxel grid.  I build two ICEtrees (voxel center and corners) to store all the needed voxels data.

ICE_SPH_Polygonised_02

It is easy to get the distance between each voxels corners and an other particle cloud using  just an ICEtree. And it is FAST !
The other advantage is that the formula for the scalar field is open. You can plug any super formula you want as far as it returns a scalar value :) .
ICE_SPH_Polygonised_03

The custom operator job is to read the scalar field, send it to the marching cube function and then use the result to build the triangles.
ICE_SPH_Polygonised_01

Here is a screen capture on my old laptop (XP32bit,  Intel core duo 1.83GHz and a GEFORCE GO 7600…).

→ 8 CommentsCategories: dev · xsi

First animation test with the Polygonise operator for ICE.

May 23, 2009 · 2 Comments

Here is the first animation test of my Polygonise operator (a C++ plugin for ICE particle clouds). I used a sample scene from the really promising ICE SPH Fluids from Thiago Costa and Grant Kot. I’m starting to work on the optimisation speed.

The major bottleneck is in the way you get values on the height points of each cubes in the 3D grid used for the marching cube algorithm. Those values are computed by a formula using  the distance between each cubes points and each ICE particles. For 30*30*30 cubes (27 000 points) and 1000 particles,  it starts to be a lot of processing.

The first optimisation I add today is a cutoff distance. The cubes points who are not in a bounding box around a particle, will not be evaluated. I put a user parameter to specifies the bounding box size of search around each particle. With this technique the meshing is much faster than before but certainly not production ready. On my old laptop with the Viscous_101 sample scene from Thiago, it takes 30 seconds to mesh 1000 particles… so I guess I need more optimisations work :p.

Anyway, I really want to push this project as far as I can.  See you soon !

→ 2 CommentsCategories: dev · xsi

Polygonise operator for ICE point clouds.

May 21, 2009 · 2 Comments

Here is my new little personal developement work, a Softimage ICE cloud mesher.  For the moment it is a raw implementation of the marching cube algorithm without any speed optimisation. I first did a simple metaball system to better understand how it works (but as there is already a metaball plugin for XSI from Michele Sandroni, I didn’t  push it to farther). Then I start this mesher operator to create a polygon surface “around” a particle field. 

 

mesh and particles

mesh and particles

 
I’ve got a working plugin, so I can’t resist to show you a preview :
http://www.vol2nuit.fr/guillaume/Dev/Polygonise/polygoniseICEcloud_alpha1.mov

Now, I need to work on the speed for the mesh generation !

→ 2 CommentsCategories: dev · xsi

No Shame

May 6, 2009 · Leave a Comment

I just found on an old hard drive a backup of one of my first 3d animation !

I was pretty sure it was lost in the final crash of my computer in 2003. Watching this little thing give me a cookie-Proust effect (I don’t think we can say this in english, so more info here http://www.haverford.edu/psych/ddavis/p109g/proust.html  ). At this time I was doing  a lot of (boring…) architectural 3d illustrations. 3D animation was most of the time just a hobby.

This one is a kind of video clip for an imaginary rock band. Modeling and rendering was done in LightWave 6.0, animation in Project:Messiah and compositing in Combustion 1.0. 

I must admit that the character animation is closer to an animatic than a polished final shot… Anyway, I put it on youtube without shame !
 


→ Leave a CommentCategories: misc

New Perrier Commercial

April 26, 2009 · 10 Comments

I was speaking about our last work at la maison in my previous post and here is already a link on youtube !
A lot of 3d fluid simulations in a rather short amount of time (in a fluid dynamic time scale), but I’m really pleased by the work of the la maison crew :) .

→ 10 CommentsCategories: misc

How to resample curves in Softimage

April 26, 2009 · 2 Comments

Hi,

Its been a long time since my last development post ! I was a “little” bit busy on the last Perrier commercial at la maison. It was a very interesting project and I hope to give you a web link soon !

In this cloudy parisian weekend, I was cleaning … some files on my laptop when I realised that I could send some of my plugins to the web instead of just let them sleep on the hard drive. 

 Here is the first one, a resample operator. As far as I know, you can’t resample curves in Softimage. I like the “resample” SOP in Houdini as you can choose the  number of points or a fixed segment length to resample a curve, so I add the same feature in this Softimage custom operator. It is a win32 dll, but if you want sources for other platforms, you can send me an email !

PS: no picture or video for this plugin, I’m too lazy !

Edit : I just found an old ICE wire dynamic scene to illustrate this plugin ! It is an unfinished project to find an alternative to Houdini wire solver. But as it is greatly improved in Houdini10 , I’m not sure I will finished it…  At least it is a good example for the resampleOp. A point cloud was used to deform a curve by setting curve points position from particles position.

Here is the video : http://www.vol2nuit.fr/guillaume/blog/resample_xsi_curve_op/resample_xsi_curve_op

→ 2 CommentsCategories: xsi

My wife is a photographer.

April 5, 2009 · Leave a Comment

→ Leave a CommentCategories: photography

Render Curve Compound Update.

February 28, 2009 · Leave a Comment

The StrandDeform is an attribute used to “extrude”  ICE strands. It was on my to do list to add it in my render curve compound to reduce the number of particles needed to create a curve. But, as I don’t spend too much time in ICE, I never add it. Fortunatly, Ahmidou Lyazidi, a french director at la station animation add this feature and send it too me. He also debug the U array needed to create the strands (since XSI 7.01, the array initialisation doesn’t work exatly the same way than in XSI 7.0).

You can download the Render Curve Compound 1.2 here.

→ Leave a CommentCategories: dev · xsi

Making Waves: The 14 Days of Vincent Laforet

February 13, 2009 · Leave a Comment

Here is what you can do with some little toys like a Red One and a 5D Mark II cameras. You also need to be in Hawaii with a very good surfer…

http://vincentlaforet.smugmug.com/gallery/6961015_exAjb/1/470408047_95AKN/Large

→ Leave a CommentCategories: photography

An Expression Class for the XSI SDK (part 2)

February 12, 2009 · Leave a Comment

Now that you know the purpose of the Expression() object, I’m going to show some examples. I hope you will find it easier and more elegant than the classic string concatenation (and also I hate the word “konkatenation”).

First example : We really need to clamp a null position inside a cube  to create the best character rig ever done (simple as that).

There is no built in clamp function in XSI (I know, it sucks…). Instead we can use a conditional expression or a combination of MIN and MAX expressions. On top of that, you add the script concatenation and it will looks like a very ugly  thing. Fortunately, the brand new Expression object is there to save your mental health ! Lets code now :

#First you import the xsi_expr module and get the Expression class
#(I presum that you already know  a way to set a path to a module from xsi)
import xsi_expr
from xsi_expr import Expression
#Then the ‘exotic’ XSI python things
xsi = Application
xsilog=xsi.LogMessage

#Lets build a simple  implicit cube and a null
cube = xsi.ActiveSceneRoot.AddGeometry(”cube”)
nullInsideCube = xsi.ActiveSceneRoot.AddNull(’inside_cube’)

#Then the null x, y z positions parameters 
nullPosx = nullInsideCube.posx
nullPosy = nullInsideCube.posy
nullPosz = nullInsideCube.posz 

#Here is the first Expression Object to get the cube limits from its length.
cubeLimitMax=Expression(cube.length)
cubeLimitMax.div(2)
#Then we create the min limit from the max limit like this:
cubeLimitMin=Expression()
cubeLimitMin.sub(cubeLimitMax.Value)

#Then we can create the expressions objects for the position x, y ,z of the null. 
posInCubeX = Expression()
posInCubeX.clamp(nullPosx, cubeLimitMin.Value, cubeLimitMax.Value)
posInCubeY = Expression()
posInCubeY.clamp(nullPosy, cubeLimitMin.Value, cubeLimitMax.Value)
posInCubeZ = Expression()
posInCubeZ.clamp(nullPosz, cubeLimitMin.Value, cubeLimitMax.Value)

#And finally apply the expressions to the parameters
nullPosx.AddExpression(posInCubeX.Value)
nullPosy.AddExpression(posInCubeY.Value)
nullPosz.AddExpression(posInCubeZ.Value)

#if we need to see an expressions value we can use the
#xsiShow method like this : 
posInCubeX.xsiShow()
# INFO :
#MIN( MAX( inside_cube.kine.local.posx,  - cube.cube.length / 2 )
#, cube.cube.length / 2 )         

#but you can also log a message like this
#xsilog( posInCubeX.Value)
… 

Here is an other exemple just to show how to use the pow and fit methods : 

import xsi_expr
from xsi_expr import Expression
xsi = Application

#Lets build two nulls

 

 

A = xsi.ActiveSceneRoot.AddNull(”A”)
B = xsi.ActiveSceneRoot.AddNull(”B”)

#Position x from B is the power of position y from A.
Bposx = Expression()
Bposx.pow(A.posy, 2) 
#Apply the expression
B.posx.AddExpression(Bposx.Value)

#Rotation z from A is drived by rotation z from B
#But it is  ”re-scaled” between 0 and 90 when B rotate between 0 and 360.
Brotz = Expression()
Brotz.fit(A.rotz, 0, 360, 0, 90)
#Apply the expression
B.rotz.AddExpression(Brotz.Value)
             

#Lets see our expression :
xsilog( Brotz.Value )
# INFO :
#cond( A.kine.local.rotz<0, (A.kine.local.rotz/0)
#*0, (A.kine.local.rotz/360)*90 )
#Now try to create this expression without the Expression Object !

 

If you are not exhausted by this post, you can try the module on your own here.

Happy scripting !

Cheers

 

 

Guillaume Laforge

→ Leave a CommentCategories: dev · programming · xsi