MathSculptor

From Second Life Wiki
Jump to: navigation, search

Introduction

Math Sculptor is a free application for creating Second Life Sculptured Primitives (scupties). It can run on most Microsoft Windows based PCs. What makes it unique is:

  • It is easy to use. You do not need to be an expert with high end 3D graphics programs.
  • It has an "Addin" architecture allowing others to expand on the functionality.

MathSculptor1.jpg

Download

Visit http://mark.burhop.net to download the applcation/framework. There is also a small library of sculpted prims created with Math Sculptor.

Who is it for?

There seem to be three "poles" for people working with Sculpties, artists who create nice shapes, software developers that create nice software, and mathemations that create nice geometric algorithms. Some people are combinations but you get the idea. Despite the diversity of these "poles", Math Scultor is trying to make them all happy:

  • For the artist, I'm trying to provide a simple tool to create useful shapes for their work.
  • For the mathematician, I'm trying to provide a simple way to turn functions and algorithms into geoemtry with very little programming knowledge.
  • For the software developer, I'm trying to provide a framework that alleviates them from having to worry about some of the more mundain details (setup scripts, creating a graphics engine, data persistence, etc). I'm also trying to encourage some standard .NET Interfaces (see MathSculptorInterface)that can be used across applications.

UI

The UI contains two ToolBars for working with the sculpies. The Addin Toolbar provides a button for running an AddinTool. Each addin is essentially a mathematical algorithm that takes inputs (parameters) provide by you. Math Sculptor takes care of collecting these parameters in the panel on the left and then calling the algorithm to generate the sculptie geometry. F or example, a very simple addinTool might create cylinders and have input parameters of radius and height.

If the "Automatic" checkbox is on, each time you make a change on the left, Math Sculptor calls the AddinTool's algorithm to generate new geometry. WIth the example above, dynamically changing the radius will cause the cylinder to change its size. If you have a slow computer or a complicated algorithm, you can turn this off.

On the right side Math Sculptor is the graphics area. You can drag the mouse to cause the sculptie to spin in space. If you want particular views, you can then make use of Geometry ToolBar. It provides buttons to zoom in, zoom out, or display front, back, top, bottom and side views. It also allows you to change the display from solid, to wireframe, to points.

The menu at the top provides the usual features like open and save. Open simply allows you to open a sculptie image file and display it.


Framework and Addins

In general, the Math Scuptor Framework covers all the common features needed in most applications including the user interface, an object model, and persistence. The main area it does not cover are the alrogithms and methods used to create specific sculpties. These algorithms are contains in Addins, separate DLLs which have a common interface.

Essentially, anyone wanting to create a new tool need only create a new .NET project and code up their algoithm. A predefined exmaple project is included with the setup implement a particular interface.


I'm a programmer and want to know more

Each addin is simply a Microsoft .NET assembly that implements a particular interface (ISculptAddin). Math Scultor will use Reflection to read the assembly, find all the classes implementing the ISculptAddin, and then instanciate them. The interface provides methods for calling the algorithm, getting its parameter types and setting the parameter values. It also collects some information from the addin like a description of what it does, names of the parameters, and an bitmap to place on the tool bar.

This approach has a few advantages:

  • You don't need a lot of code from Math Sculptor, just a simple DLL with the interfaces. In OO terms, we've "decoupled the algorithm from the interface".'
  • You don't have a lot of extra support code to write.

In theory, you could take the Addin to other applications. If they make use of the same interface, you are ready to go. If you are a GOF fan, someone could esily write a adaptor between this interface and another application's addin/plugin/programing interfaces.


I'm a mathematician and want to know more.

I don't know of any math experts that can't do at least a little programming. Essentially, you have to create a function that takes u and v parameters and returns three numbers representing x, y, and z values. The UV parameters are expected to be from 0. to 1. double precission. The XYZ values will be integers from 0 to 255 (reprented by a single byte). The reason bytes are used is that they correspond to the red/green/blue values that will be stored in the bitmap image.

Sculpties are generally represnted by a 64x64 pixel image. So your function or algorithm will be sampled 64 times in the U and V "directions" starting at 0. and ending at 1 (although it is possible resolution would increase in Second Life were to make use of larger bitmaps).

Have more question, comment or want to know the latest?

Visit the Talk page for Math Sculptor