Welcome to Math2Model, an online editor for parametric modeling of objects described through mathematical functions. It features two ways of user input: Code-based modeling and node-based modeling.
Math2Model is a tool that allows the instant rendering of mathematical functions given in parametric form (with parameters u
and v
as input). One simple example would be rendering a sphere model in parametric format:
fn sampleObject(input: vec2f) -> vec3f {
let parameters = vec2(input.x, 2.0 * input.y) * 3.14159265359;
let x = sin(parameters[0]) * cos(parameters[1]);
let y = sin(parameters[0]) * sin(parameters[1]);
let z = cos(parameters[0]);
return vec3(x, y, z);
}
Listing 1: Code for describing a sphere model in our code editor.
The code from Listing 1 produces the output shown in Figure 1.
Figure 1: Parametrically described sphere, rendered with Math2Model.
Math2Model is a tool for everyone who wants to render mathematical functions in real time or create parametric models with feedback in real time. It features two user interfaces: one for programmers, where they can directly describe mathematical objects in source code (see Figure 2), and another for non-programmers, which allows parametric modeling through a node editor (see Figure 3).
Figure 2: Image of Math2Model's code editor for describing parametric objects in WGSL source code.
Figure 3: Image of Math2Model's node editor for describing parametric objects through graphical modeling.
Math2Model implements a version of the rendering technique presented in Fast Rendering of Parametric Objects on Modern GPUs, adapted to a web implementation using the WebGPU graphics API.
It uses a level-of-detail (LOD) stage to create enough geometric detail. It renders sufficiently subdivided patches of input parameters in order to achieve close to pixel-perfect geometric precision.
Read our CONTRIBUTING.md
This project depends on Node.js with npm and Rust.
- Install Node.js and Rust
npm install
in the main foldercd parametric-renderer-core
andnpm install
Now the dependencies have been installed.
To run it
npm run dev
to start up the web servercd parametric-renderer-core
andnpm run build
in a separate terminal to build the WASM package.npm run docs:dev
to run the documentation page
As for everything else, check out our CONTRIBUTING.md